| Details | Message |
|---|
Read-Only Author Alex Wrightson Posted 18-Oct-2005 07:51 Toolset C51 |  Logic Characters code Alex Wrightson 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? |
|
Read-Only Author erik malund Posted 18-Oct-2005 08:14 Toolset C51 |  RE: Logic Characters code erik malund 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 |
|
Read-Only Author Alex Wrightson Posted 18-Oct-2005 08:40 Toolset C51 |  RE: Logic Characters code Alex Wrightson Thanks
Is there more chapters?
Alex |
|
Read-Only Author erik malund Posted 18-Oct-2005 08:49 Toolset C51 |  RE: Logic Characters code erik malund yes, but they are irrelevant (datasheets for 1993 vintage chips)
Erik |
|
Read-Only Author Alex Wrightson Posted 18-Oct-2005 08:50 Toolset C51 |  RE: Logic Characters code Alex Wrightson I forgot to mention I'm looking for the code in C also. Those 3 files dont explain the operations in c. |
|
Read-Only Author m d Posted 18-Oct-2005 09:02 Toolset C51 |  RE: Logic Characters code m d P2 &= 0x80 |
|
Read-Only Author Alex Wrightson Posted 18-Oct-2005 09:08 Toolset C51 |  RE: Logic Characters code Alex Wrightson 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 |
|
Read-Only Author erik malund Posted 18-Oct-2005 09:14 Toolset C51 |  RE: Logic Characters code erik malund 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 |
|
Read-Only Author Stefan Duncanson Posted 18-Oct-2005 09:16 Toolset C51 |  RE: Logic Characters code Stefan Duncanson "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; |
|