Hi guys ,
well the internal osc is 32Mhz ,
The code that works is here but after this point it jumps a bit cos of other routines that follow , i have manged to get around it in that instead of pausing 350us at the end of each scan it goes and goes do other things so its not as bad .
I guess what i am looking for is Either
A. ASM code example to replace the working code so that it may allow for less time issues for the cpu when doing other things
B. As the CPU has inbuilt PWM , can this be used in place of the ASM , existing code , knowing the a single PWM output is to be sent to all available output pins sequentially
Cheers
Sheldon
Working Code
Code:
For T = 0 to 9 ' Select IR LED for Pulses
LOOKUP T, [1,2,4,5,16,17,18,19,20,21],PortOffset ' Offsets from Port A to point to port A and port C I/O ports ( number of offset relates to bits offset in mem map of chip)
Cycles = 0 ' Set to 0
for Cycles = 1 to Pulse_cnt ' Each IR led increments the amount of pulses by 2 for IR LED ID use
PORTA.0[PortOffset] = 1 ' Set IR LED High
pauseus 2 ' Remain on for 2uS
PORTA.0[PortOffset] = 0 ' Set IR LED Low
pauseus 9 ' remain off for 9uS
next Cycles
Pulse_cnt = Pulse_cnt +2 ' increment pulse count by offset of 2 for each IR LED
pauseus 320 ' Wait 350us( adj) between pulse bursts and selecting next IR LED
Next T
Bookmarks