Re: Pulse Input > Array > Output help
what you are looking for is a ring buffer.
this will take ages and is unnecessary, just increment a pointer
For ArrayBit = 1 to 639
PulseArray.0[ArrayBit] = PulseArray.0[ArrayBit-1] ' move them all over 1x
Next ArrayBit 'Go do next count
according to this thread you may need to review the parameters
http://www.picbasic.co.uk/forum/show...ht=ring+buffer
Code:
TRISA=%00000000 ' Port A all output
TRISB=%00001001 ' Port B all output except 3 ,1
PulseArray var byte [32] ' 256 bits total if we can run at 1khz this will allow delay of upto 256ms
Arraytail var byte
clear
Arraytail=0
RunController:
PulseArray.0[Arraytail] = PortB.0 'set the last bit in the array as per b.0
Arraytail= Arraytail+1
latb.4 = !latb.4 ' use p4 to check loop time on scope
latb.5 = PulseArray.0[Arraytail] ' output this bit ~ 250ms delay
pauseus 900 ; adj to suit
goto RunController
Warning I'm not a teacher
Bookmarks