Mondo-tronics H-Bridge code
bxgirten
Posts: 79
After Googling the Basic Stamp code for the Mondo-tronics H-Bridge circuit (and looking through the parallax forums search), I saw where MONDOMOT.BAS was converted from BS1 to BS2. When I try to execute the converted code, the interpreter throws errors. Example: the line A = B, but A and B are constants.
Does anyone have the corrected form of this code?
motAcc VAR BYTE
motDir VAR BYTE
spd VAR BYTE
cycles VAR BYTE
A CON 0 ' <
B CON 1 ' <
INPUT 0
INPUT 1
DIRS = %11
again:
FOR cycles = 0 TO 255
GOSUB motor
NEXT
spd = spd +1
IF spd <= 15 THEN again
spd = 0
motDir = motDir ^ 1
GOTO again
motor:
motAcc = motAcc & %1111
motAcc = motAcc + spd
IF motAcc >= 16 THEN motOn
A = B ' <
RETURN
motOn:
A = motDir: B = A ^ 1 ' <
RETURN
Thanks in-advance!
Does anyone have the corrected form of this code?
motAcc VAR BYTE
motDir VAR BYTE
spd VAR BYTE
cycles VAR BYTE
A CON 0 ' <
B CON 1 ' <
INPUT 0
INPUT 1
DIRS = %11
again:
FOR cycles = 0 TO 255
GOSUB motor
NEXT
spd = spd +1
IF spd <= 15 THEN again
spd = 0
motDir = motDir ^ 1
GOTO again
motor:
motAcc = motAcc & %1111
motAcc = motAcc + spd
IF motAcc >= 16 THEN motOn
A = B ' <
RETURN
motOn:
A = motDir: B = A ^ 1 ' <
RETURN
Thanks in-advance!