PDA

View Full Version : is there interrupt serial communication in pbp?



mimmmis
- 12th September 2008, 13:05
can it be done?
i have the following code. But in order to work i must send always data to serin.I want when the program to be executed all until a new B0 comes.

INCLUDE "MODEDEFS.BAS"

B0 VAR WORD
B1 VAR WORD
Pause 500
SerOut2 PORTC.6,84,["Hi!",13,10]

start:
SerIn2 PORTC.7,84,[DEC B0,DEC B1]
IF(B0==1) Then
Low PORTC.1
High PORTC.2
EndIF
IF(B0==0) Then
Low PORTC.1
Low PORTC.2
EndIF
IF(B0==2) Then
Low PORTC.2
High PORTC.1
EndIF
IF (B1==3) Then
Low PORTC.2
High PORTC.1
Pause 10
Low PORTC.2
Low PORTC.2
Pause 10
EndIF
IF (B1==4) Then
Low PORTC.2
High PORTC.1
Pause 500
Low PORTC.2
Low PORTC.2
Pause 1000
EndIF
GoTo start
End

mackrackit
- 12th September 2008, 13:32
You will need to use hardware serial (HSERIN).
Here is a thread to get you started.
http://www.picbasic.co.uk/forum/showthread.php?p=51502

Here is another thread. post #11 has a nice test program.
http://www.picbasic.co.uk/forum/showthread.php?p=8601#post8601

mimmmis
- 16th September 2008, 12:53
thanx mackrackit! sorry for the delay...:-) . Your advice was extremely helpful!