Nick
- 17th April 2005, 15:10
Hi Team,
I’m using PBP 2.45a and I’m trying to get a PIC 16F628
to do some LED blinking and then go in stand by until it
receives an “OK” on the serial in or a large timeout goes by.
I’m using variable index to control this timeout.
This is how I thought of doing it but it does not seem to work (at list the
timeout part). After the initial shot on power ON it just hangs up and does nothing.
Code:
INCLUDE "bs2defs.bas"
@ device pic16F628, intrc_osc, wdt_on, pwrt_on,mclr_off,protect_off
red VAR PORTB.4
green VAR PORTB.5
serial_in VAR PORTB.0
password VAR BYTE
index VAR BYTE
cmcon=7
TRISB=%10000001
Pause 1000
loop:
index=0
High red
Pause 500
High green
Pause 500
Low red
Pause 500
Low green
main_loop:
index=index+1
SerIn serial_in,T2400,100,again,["O"],password
IF password="K" Then
GoTo loop
Else
again:
IF index>99 Then
GoTo loop
Else
GoTo main_loop
EndIF
EndIF
End
Any ideas what I’m doing wrong?
Thank you for your attention.
I’m using PBP 2.45a and I’m trying to get a PIC 16F628
to do some LED blinking and then go in stand by until it
receives an “OK” on the serial in or a large timeout goes by.
I’m using variable index to control this timeout.
This is how I thought of doing it but it does not seem to work (at list the
timeout part). After the initial shot on power ON it just hangs up and does nothing.
Code:
INCLUDE "bs2defs.bas"
@ device pic16F628, intrc_osc, wdt_on, pwrt_on,mclr_off,protect_off
red VAR PORTB.4
green VAR PORTB.5
serial_in VAR PORTB.0
password VAR BYTE
index VAR BYTE
cmcon=7
TRISB=%10000001
Pause 1000
loop:
index=0
High red
Pause 500
High green
Pause 500
Low red
Pause 500
Low green
main_loop:
index=index+1
SerIn serial_in,T2400,100,again,["O"],password
IF password="K" Then
GoTo loop
Else
again:
IF index>99 Then
GoTo loop
Else
GoTo main_loop
EndIF
EndIF
End
Any ideas what I’m doing wrong?
Thank you for your attention.