HI GUYS ,
Hendrik some time ago showed a little trick where by port may be accessed via the lookup command using an offset
This works because most of the ports are usually memory mapped sequentially from the base port of portA.0
How ever if they are not can the other ports not in memory sequence be addressed in this manor , if so how ?
cheers
sheldon
example chip 16f1947 has ports A-G
portA.0 - portE.7 are arranged in memory
Memloc - Port - Lookup offset value from portA
00Ch port A.0-7 , 0-7
00Dh port B.0-7 . 8-15
00Eh Port C.0-7 , 16-23
00Fh Port D.0-7 , 24-31
010h Port E.0-7 , 32-39
28Ch Port F.0-7 , ???
28Dh Port G0.5 , ????
As such ports A- E can be used in lookup command like this
Code:
For T = 0 to 10 ' Select 10 ports for Pulses
LOOKUP T, [1,1,2,4,5,16,17,18,19,20,21],PortOffset ' Offsets from Port A to point to PortA & PortsC ( value of offset relates to Port bits in mem map of chip)
next T
Bookmarks