Hi What is the code used to say port2 = port2 anded with 0x7f This will clear all bits of port 2 but bit 7? I thought it was P2 &= 0x7f this doesnt work, so i tried P2 = (P2 && x7f) This also didnt work. Anyone know what it is?
bible time here are the links to "the bible" Chapter 1 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_ARCH_1.pdf chapter 2 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_PROG_GUIDE_1.pdf chapter 3 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_HARDWARE_1.pdf Erik
Thanks Is there more chapters? Alex
yes, but they are irrelevant (datasheets for 1993 vintage chips) Erik
I forgot to mention I'm looking for the code in C also. Those 3 files dont explain the operations in c.
P2 &= 0x80
yeah well thats like i said, I also forgot to mention that to clear it I actually have to set the bits high because its inverted so useing what you said it would be P2 &= 7F which doesnt seem to work
I forgot to mention i'm looking for the code in c also. those 3 files dont explain the operations in c. Read up on "port latch" and you will find out what the problem is. It has nothing to do with c or assembler, it has to do with hardware erik
"I actually have to set the bits high because its inverted" If you want to set bits 0-6 and leave bit 7 unchanged you need to OR: P2 |= 0x7f;