Heres some of the code, this all works fine using simple delay or other timer
Main:
; Check for incomming USB data while waiting
@ ON_USBRX_GOSUB _HandleRX
lcdout $FE, 1, dec Size
pause 2000
if portB.0=1 OR Run=1 then
high porta.3
T0CON.7=1 'start TMR0
mark:
if not match01 then goto mark 'match01 var INTCON.2 '50msec delay
T0CON.7=0 'stop timer
match01=0 'clear interupt flag
INTCON.5=0 'set interupt enable to 0
low porta.3
if plugged then ARRAYWRITE USBTXBuffer, [Size,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] ;send position
GOSUB WaitToSend
time=time+1
lcdout $FE, 1, dec time 'use to check whats happening here
TMR0H=$C9 '300msec
TMR0L=$10
T0CON.7=1 'start TMR0
space:
if not match01 then goto space
T0CON.7=0 'stop timer
match01=0 'clear interupt flag
INTCON.5=0 'set interupt enable to 0
TMR0H=$F6 '50msec pulse
TMR0L=$D8
endif
goto Main




Bookmarks