[Icc-avr] dumb pointer question
Paul Mateer
paul.aa9gg at gmail.com
Tue Oct 9 13:24:48 PDT 2007
Hello All.....
Please tell me what I'm doing wrong here:
void Process_Cmd(void)
{
unsigned char *P_PORT;
int w_port, w_pin;
w_port = WHICH_PORT & 0xF0;
w_pin = WHICH_PORT & 0x0F;
if(w_port == 0x10) P_PORT = &PORTA; // PORT A
if(w_port == 0x20) P_PORT = &PORTB; // PORT B
if(w_port == 0x30) P_PORT = &PORTC; // PORT C
if(w_port == 0x40) P_PORT = &PORTD; // PORT D
if(w_pin != 8)
{
if(PORT_CMD == OFF) P_PORT &= ~w_pin;
if(PORT_CMD == ON) P_PORT |= w_pin;
}else
{
if(PORT_CMD == OFF) P_PORT = 0;
if(PORT_CMD == ON) P_PORT = 0xFF;
}
}
//------------------------------------------------------------------------------------------------
I always seem to stumble when it comes to pointers
--
Paul Mateer, AA9GG
Elan Engineering Corp.
www.elanengr.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20071009/e844f6ac/attachment.html
More information about the Icc-avr
mailing list