LET'S PRETEND I'm trying to control the brightness of SIX 'AC line' lights the 'Pic port to optocoupler at zero-crossing time' way. The assembler in me says 'load a byte from a look-up table of duty-cycle-bytes and with each transition of the AC line, rotate thru carry, with carry going to the appropriate PORTC bit, for each of PORTC's pins, and then wait.
I'd like to try to do it the high-level PicBasic 'increment the pointer' way.
I.e.,
1) Use a pointer byte (PortPtr) to select the duty-cycle bytes from an array variable (DutyCycle VAR BYTE(6) - (1 per pin) ).
2) Use another pointer byte (BitPtr) to point to the bits in those bytes and then...
3) Set PORTC's pins using PortPtr.
Kind of like if ...
PORTC.PortPtr = DutyCycle(PortPtr).BitPtr
... worked.
OF course, I'm here for a reason.;-)
How would YOU do that without using individual port pin statements?
Bookmarks