I am a newbie so forgive. I am trying to loop through a stamp set of
instructions several times (to get triplicate readings) I am using
the FOR-NEXT code but am unable to program anything that makes sense.
Any hints would be appreciated.
Thanks Mike Z
'{$STAMP BS2}
'-----Define variables, set status of pins -----
reps VAR WORD
x VAR WORD
y VAR WORD
z VAR WORD
cnt VAR WORD
cmt VAR WORD
clt VAR WORD
S0 CON 0
S1 CON 1
S2 CON 2
S3 CON 3
LED1 CON 11
LED2 CON 12
LOW S0 'Sets status of TSL230 pins
HIGH S1
HIGH S2
LOW S3
LOW 4 'Toggle state to enable/disable chip – change this if there is
no
'output from the TSL230
'-----Main program loop-----`
ROUTINE1
LOW LED1
PAUSE 2000
FOR x = 1 TO 2000
COUNT 5, 1, cnt 'Count on pin 5 for 1 ms, store value in cnt
DEBUG DEC cnt, CR 'Send value of cnt, as a decimal to the computer
NEXT 'Do it all over again, 2000 times
IF x=2000 THEN ROUTINE2
ROUTINE2:
PAUSE 2000
FOR y = 1 TO 2000
COUNT 6, 1, cmt 'Count on pin 6 for 1 ms, store value in cmt
DEBUG DEC cmt, CR 'Send value of cmt, as a decimal to the computer
NEXT 'Do it all over again, 2000 times
IF y=2000 THEN ROUTINE3
ROUTINE3:
HIGH LED1
LOW LED2
PAUSE 2000
FOR z = 1 TO 2000
COUNT 7, 1, clt 'Count on pin 6 for 1 ms, store value in clt
DEBUG DEC clt, CR 'Send value of clt, as a decimal to the computer
NEXT 'Do it all over again, 2000 times
HIGH LED2
IF z = 2000 THEN ROUTINE4
ROUTINE4
FOR reps = 1 TO 3
GOTO ROUTINE1
NEXT
END