Port Data Direction Register
sxman
Posts: 7
Good morning-
Could any of you learned people out there tell me if it is possible to change the DDR for a specific pin?
ie I'd like to be able to (say) change the direction of rc.7 without having to write a complete new byte to the !rc register
eg setb !rc.7 (which I know doesn't work)
rather than
mov !rc, temp ( where temp.7 contains the value I want to write to !rc.7)
Thanks
Could any of you learned people out there tell me if it is possible to change the DDR for a specific pin?
ie I'd like to be able to (say) change the direction of rc.7 without having to write a complete new byte to the !rc register
eg setb !rc.7 (which I know doesn't work)
rather than
mov !rc, temp ( where temp.7 contains the value I want to write to !rc.7)
Thanks
Comments
I assume you mean something like this:
mov w,!rc
xor w,#%10000000
mov !rc,w
Unfortunately, the mov w,!rc instruction is thrown out by the assembler.
I was actually thinking of something like:
mv w, #%10000000
xor !rb, w
Unfortunately that isn't allowed by the assembler either.
I did a bit of checking around with google and it doesn't look like it's possible to do anything but write to the register with the "mov" command. You may need to use a register to save a copy of the port dir register make your changes to it and than move that into the !rx register.
Yup, that was my conclusion earlier today- and it works OK. But (strange how there's always a but) I was trying to avoid using a dedicated register for this action as, due to the position of the routine using this command, it would really need to be a page $00 register and I've used them all up. Anyway, thanks again for your suggestions.