Here is something to try.
Add this to the beginning of your program before MAIN and remove lines:
eeprom 1,[00]
P VAR BYTE
read 1,p
WRITE 1,P
P=P+1
P = P-1
Code:
cnt var byte 'A VAR for counting the FOR/NEXT
Pb1 var byte 'The VAR that is being counted and saved
P var byte 'The VAR that the saved data is read into to show position
Plog data 0 'DATA storage area
READ Plog, P 'At program start, reads saved DATA into P
Now for a SUB routine.
Code:
POS_1: 'LABEL
for cnt = 1 to 1 'Write DATA one time
Pb1=Pb1+1 'Pb1 is increased by one
write Plog, Pb1 'Write Pb1 into Plog
read Plog, P 'Makes P = to Pb1
pause 100 'Time to write to DATA area
next 'See if FOR/NEXT is finished
RETURN 'Return to SENDER
Put a GOSUB POS_1 inside of all the SUB routines that move the motor. "RIGHT1" for example.
Bookmarks