
Originally Posted by
tazntex
Is there any supplement to this manual or other clear examples to shed some light on things like i=i+1?
PBP is PicBasicPro...emphasis on BASIC. There really isn't a supplement to the manual for BASIC, because the whole manual is about BASIC. I can't cite any specific BASIC tutorial other than to Google it and see what you find. Your question on the 'i = i + 1' is reference, albiet indirectly in the manual. i is a variable stored in local memory. = and + are the operators. Whatever is on the right side of the = goes to the left side of the =. Therefore, whatever was in 'i', gets 1 added to it and put back in 'i'.
And your program needs fixing..........
Code:
IF relay = 1 THEN outr1
...............................
IF relay = 12 THEN outr12
Check the PBP manual under branch, save some space and headache
Code:
outr1:
IF stat = 1 THEN high1
LOW 0: GOTO loop
high1:
HIGH 0:
gosub loop1
low 0: GOTO loop
HIGH 0: will be recognized as a label and not a command, same thing with the rest of the chunks in the rest of the program. You can't have a colon at the end of a line unless it's a label.
Code:
IF relay = 1 THEN loop
.............................
IF relay = 12 THEN loop
How about this instead:
IF relay => 0 AND relay <= 12 THEN GOTO LOOP
Bookmarks