Sending logical 1-0 to ports
Thanks for you help!
Now i will ask you something more specific. I am trying to figure out but i still can't.
My microcontroller has 4 ports.
P0(0-->7), P1(...), P2, P3
How can i say that the P2(1) = 1 for example?
I have an example that says:
----------------------------------
/*put this in initialize()*/
sbit ena=0x81;
sbit rs=0x82;
sbit rd_wr=0x80;
rd_wr=1; /*all writes to LCD*/
void lcddatwr(uchar dbyte){
rs=1;
ena=1;
P1=dbyte;
ena=0;
}
---------------------------------
I can understand that
0x81 = 81H = 8000 0001. (in schematic it is the 1st pin)
What is this hex number. A place in memory? Is it a comand that when i say ena=1 to give the pin 5v voltage? And if yes, why is it 8000 0001 and not 7000 0001 or 9000 0001.
So my general question is how can i seperate the 2nd bit from the 1st port from the 2nd bit from the 2nd or even the 3rd port?