I am using DEMO9S08AW60E and using Codewarrior(Version: 5.9) with Processor Expert.
PTFDD = 0x00; // to activate/intialize the port F and D
PTDDD = 0x00;
if ((PTDD_PTDD2 |= 0x02))
{
PTFD_PTFD0 |=0x01;
}
else
{
PTFD_PTFD0 &=0x01;
}
According to the schematic of the board, Switch 4 is connected to PortD/Pin2. And the set of LED are connected to the PortF/Pin(0-7). The idea is to switch the LED on when the button is pressed: I have used a pull up resistor with the help of PROCESSOR EXPERT. Logically, I feel my code is fine but there doesn't seem to be any effect.
I would like to know where I am going wrong and hope you will able to help.
Best Answer
This is equal to:
This does probably not what you want either:
The resulting value of
PTFD_PTFD0
is0x00
or0x01
, depending on the value of least sigificant Bit.It looks like you wanted:
This sets the LSB to zero.