Equating Ports to Data Bits
Hi There,
I'm to this forum so I'd first like to say hi to all you people out there. My question seems rather trivial but I can't seem to figure it out. Basically I have a 16 bit bus which is scattered through PortA, B, and C on an 16F877A. I would like to define the 16 bit data and have each bit of the data automatically associated with the PortX.Y like so
BUS_DATA var word
BUS_DATA.0 = PortA.0
..etc
The problem is that I can't get it to work and had to do the following routine:
If BUS_DATA=1 then
PortA.0 = 1
Else
PortA.0 = 0
Endif
...etc
This is rather lengthy and eats lots of space. I've done it before were I define a byte like MY_INFO var PortE.0 but that's an entity on it's own. I can't seem to associate data bits with port bits.
Can anybody help me out?
Many thanks,
Osiris
Two ways as far as I know
Hi there,
If you have a variable say "PORTDATA" then it could be like this
Code:
PORTA.1 = PORTDATA.0
"" "" ""
PORTB.1 = PORTDATA.15
and so on. Or you can create bit alliases like
Code:
PORTA.1 VAR PORTDATA.7
and so on.
Can you post your entire code.
Hi,
I would like to see the entire code and find out whats going on. Sometimes "typos" are hard to find.