can i manipulate the values at the port pins individually,,
i.e., if i want the 6th pin of port0 to be high, can i assign 1 to that particular pin, without disturbing the other port pin values???? if yes, please tell me how
(i am a beginner)
see http://www.keil.com/forum/docs/thread14534.asp
Yes you can. Your processor is a champ at doing single-bit operations.
Take a look at the sample code that gets installed with the compiler. There is code showing how to flash a LED, but a lot of other useful examples too.
And the processor manufacturer will also have a number of application examples you should download and take a look at. The examples are specifically intended to get new users up and running quickly.
That thread was for ARM processors who do not have single-bit instructions.
dude... but in the example, P0=j was given where j is a hexa no. here its good that i can set/reset each and every bit individually...
but in my program,,
the command is ..... PORTA.0=k; (this is the command i used in CVAVR compiler, to set/reset the 0th bit of port A depending upon the value of k which is a run time variable. more specifically speaking k is actually k[1] i.e., it is an element in an array whose value changes in the program).
so obviously i cant use k for the whole port (similar to the one used in the blinky example in the keil compiler)
ANY SUGGESTIONS PLEASE..........
is there any way where we can directly assign either 0/1 to a particular port pin of the 8051 controller?? i.e., without considering the other pins into picture.
can i use something like this.....
like PORT1.3=k (where it means pin3 of port1 should be k where k is a run time variable)
"but in the example, P0=j was given where j is a hexa no. ..."
There is more than one example. Here's another:
sbit P0_6 = P0^6; void main(void) { P0_6 = k; /* 'k' defined elsewhere */ for (;;); }
Yes, the processor can support direct assign of single bits on the port. But "dude" can probably help you more.
I don't have any C51 compiler installed at home, but did do a grep and did find Keil example code that did bit assigns to individual port pins.
sbit P0_6 = P0^6;
would u please explain me the operation of this instruction.i am a beginner and i dont know the commands like P0^6
http://www.keil.com/support/man/docs/c51/c51_le_sbit.htm
thanq very much
... read "the bible"
here are the links to "the bible" Chapter 1 - 80C51 Family Architecture: Chapter 1 - 80C51 Family Architecture: www.nxp.com/.../80C51_FAM_ARCH_1.pdf Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf Chapter 3 - 80C51 Family Hardware Description: www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf