here is what I have, after i send the "1" to start moving it starts but never stops:
#chip 12F683, 8 'mhz
#config INTRC_OSC_NOCLKOUT, MCLRE=off, WDT=off, BOD=off
dir gpio.0 out '3ms min pulse for reliable running
dir gpio.1 out
dir gpio.2 out
dir gpio.3 in 'stop switch
dir gpio.4 out
dir gpio.5 in 'serial rx
dim xlt as word
dim xrt as word
#define RecAHigh GPIO.5 off
#define RecALow GPIO.5 on
InitSer 1,r1200,1,8,1,none,invert
xlt = 0
xrt = 0
temp = 0
wait 2 s
main:
SerReceive 1, temp
if temp = 49 then
xrt = temp - 48
xrt = xrt +50
goright
end if
goto main
sub goleft
repeat xlt
set gpio.0 on
wait 3 ms
set gpio.0 off
set gpio.1 on
wait 3 ms
set gpio.1 off
set gpio.2 on
wait 3 ms
set gpio.2 off
set gpio.4 on
wait 3 ms
set gpio.4 off
end repeat
xlt = 0
bob = 0
end sub
sub goright
repeat xrt
set gpio.4 on
wait 3 ms
set gpio.4 off
set gpio.2 on
wait 3 ms
set gpio.2 off
set gpio.1 on
wait 3 ms
set gpio.1 off
set gpio.0 on
wait 3 ms
set gpio.0 off
end repeat
xrt = 0
bob = 0
end sub
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
here is what I have, after i send the "1" to start moving it starts but never stops:
#chip 12F683, 8 'mhz
#config INTRC_OSC_NOCLKOUT, MCLRE=off, WDT=off, BOD=off
dir gpio.0 out '3ms min pulse for reliable running
dir gpio.1 out
dir gpio.2 out
dir gpio.3 in 'stop switch
dir gpio.4 out
dir gpio.5 in 'serial rx
dim xlt as word
dim xrt as word
#define RecAHigh GPIO.5 off
#define RecALow GPIO.5 on
InitSer 1,r1200,1,8,1,none,invert
xlt = 0
xrt = 0
temp = 0
wait 2 s
main:
SerReceive 1, temp
if temp = 49 then
xrt = temp - 48
xrt = xrt +50
goright
end if
goto main
sub goleft
repeat xlt
set gpio.0 on
wait 3 ms
set gpio.0 off
set gpio.1 on
wait 3 ms
set gpio.1 off
set gpio.2 on
wait 3 ms
set gpio.2 off
set gpio.4 on
wait 3 ms
set gpio.4 off
end repeat
xlt = 0
bob = 0
end sub
sub goright
repeat xrt
set gpio.4 on
wait 3 ms
set gpio.4 off
set gpio.2 on
wait 3 ms
set gpio.2 off
set gpio.1 on
wait 3 ms
set gpio.1 off
set gpio.0 on
wait 3 ms
set gpio.0 off
end repeat
xrt = 0
bob = 0
end sub