Paul:
Thanks for "chiming in" with a solution. I just want to make sure I understand what your code is trying to do so I can learn from it. I suspected there was a way to shoehorn this idea into PBP.
This array is establishing an offset from bit.0 on PORTA. I assume that most pics have PORTA-PORTX at consecutive regiester addresses (I only have a couple of datasheets to reference, but that's what I see)Code:Relay[1] = 14 'RB6 is 14 bits offset from RA0 Relay[2] = 20 'RC4 is 20 bits offset from RA0 Relay[3] = 26 'RD2 is 26 bits offset from RA0
With the Relay[] array containing the correct offets, one can now use that with porta.0[x] to select the desire bit. Since porta.0 points to a bit, the offset [x] is in bits as well.Code:for i = 1 to 3 x = relay[i] porta.0[x]=1 PAUSE 1000 porta.0[x]=0 PAUSE 300 next i
Did miss this "feature" in the PBP manual? Can I extend this idea further in that the inclusion of [X] to any reference that points to a register will actually cause an offset reference in accordance to the base reference. ( ie, if it was a word variable that [x] was added to, [x] would actually reference a register x*2 bytes offset?).
Steve




Bookmarks