
Originally Posted by
Josuetas
I have already wrote and read from each device with this method.
Darrel, Why would i go back to the previous version of the Macro? this is a real question, do you think of any reason?
Great! Glad you got it working. 
There's really no reason at all to go back.
As mentioned before, since the "PIN Numbers" are limited to 0-15, there should never be a reason to have the OWPIN?W macro the way it was before.
Even if you must use a word variable for some reason or another, you can just use the .LowByte modifier and PBP will use the OWPIN?B macro instead.

Originally Posted by
Josuetas
And since life is a Learning HighWay... can you explain a bit of the asm code and can you lead me to do it on 18F devices?
OK, well I should have done the 18F version at the same time I did the 16F. The differences in the chips, makes things different for these routines too. It would be too confusing the way it was, so I've changed the way my last example works so that they will work the same for both 16F and 18F's.
Up in Post #26, I've modified the macro to use an Offset from PORTA, instead of just the Address of PORTx.
This way, the actual usage of the WORD variables will be the same for both chips.
And here's the macro for the 18F's. This one goes in the PBPPIC18.MAC file.
Code:
;-- changed for addressing any pin with a word variable --
;-- highbyte = Offset from PORTA, lowbyte = PIN --
OWPIN?W macro Win
MOVE?CB high(PORTA), RS1
MOVE?CB low(PORTA), RR1
MOVE?BA Win+1
CHK?RP RR1
addwf RR1, F
MOVE?BB Win, R4
L?CALL CONVBIT
MOVE?AB RM1
endm
CONVBIT_USED = 1
endmod
The usage will be the same as in Post #26 for the 16F's. (please go back and review it again)
I'm still trying to figure out how I can explain the macro's. 
<br>
Bookmarks