Hi I am trying coding a remote controller using nrf24le1 but failed. any sample code? it with several keys when push down the pin will connect to GND. when any key push down it will TX the P0 and P1 value, when no key pressed it will enter POWER DOWN mode. there is a LED indicate the status in the design.
it looks easy but my code not working.
void main(void)
{
unsigned char a=0;
io_init();
rf_init();
EA=1;
// pull up P0 key
P0CON = 0x50;
P0CON = 0x51;
P0CON = 0x52;
P0CON = 0x53;
P0CON = 0x54;
P0CON = 0x55;
P0CON = 0x56;
P0CON = 0x57;
WUOPC0 = 0XFF;
OPMCON = 0x06;
while(1)
{
TX_Mode();
while (!(TX_DS|MAX_RT));
sta = 0;
PD_Mode();
PWRDWN = 0x04;
delay(100);
if(a==0)
{a=1;}
else {a=0;}
LED1=a;
}
}
Regards,