How do I setup DIRA when pins are scattard around?
xsmoker
Posts: 9
I need to have pins that are not grouped together set as output for a byte. I need P9,10,11,15,24,25,28,29 set with DIRA command with P9 the lowbit. How would I use the DIRA command with staggard pins?
Thanks,
X
Thanks,
X
Comments
DIRA |= %00_11_00_11_00000000_1_000_111_000000000
Ok, that works for DIRA, but how about for OUTA? How do I get data from a variable out to these pins? Unfortunately I'm using all the pins so I can't just group them together.
In other words, I can't use:
Post Edited (xsmoker) : 4/4/2008 5:12:22 AM GMT
If an OUTA bit is 1 and you want to change it to 0, OUTA = OLD ^ (OLD ^ NEW) = 1 ^ (1 ^ 0) = 0
If an OUTA bit is 0 and you want to change it to 1, OUTA = OLD ^ (OLD ^ NEW) = 0 ^ (0 ^ 1) = 1
If an OUTA bit is 1 and it's to be left unchanged, OUTA = OLD ^ (OLD ^ NEW) = 1 ^ (1 ^ 1) = 1
If an OUTA bit is 0 and it's to be left unchanged, OUTA = OLD ^ (OLD ^ NEW) = 0 ^ (0 ^ 0) = 0
See if you can work out the Spin statement for the whole thing.