This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

will nrf24le1 impossible to design a low stanby remote controller ?

I meet problems:

  1. how to make all IO as input pull up??? like

P0DIR=0xFF;

P1DIR=0xFF;

P0CON = 0x50;

P0CON = 0x51;

..........??

how can I make all pins pull up? it seems only one pin can be pull up.

  1. how can I enable all pins wake up when LOW? the key will connect pin to GND when pressed.

    OPMCON= 0x00; // unlock needed?

     WUOPC0 = 0XFF;//
    
     WUOPC1 = 0XFF;//
                                  
     OPMCON = 0x06;// lock?
    
  2. how to enter standby? like following?

    PWRDWN = 0x04;

     delay(100);
     ................
    
  3. is read the pin value like this?

unsigned char pin0value= P0;

unsigned char pin1value= P1;

the pin value I read is in change(not pull up all pins sucessfully?)

This is a simple function but I still can not make it working.......... so please help.

Parents
  • void main(void) { P0DIR = 0xff; P1DIR = 0x3f; PWRDWN = 0; OPMCON= 0x00; P1CON = 0x50;
    P1CON = 0x51;
    P1CON = 0x52;
    P1CON = 0x53;
    P1CON = 0x54;
    P1CON = 0x55;
    P0CON = 0x50;
    P0CON = 0x51;
    P0CON = 0x52;
    P0CON = 0x53;
    P0CON = 0x54;
    P0CON = 0x55;
    P0CON = 0x56;
    P0CON = 0x57;

    	rf_init();								                       
     	EA=1;  
    	LED1=1;
    	delay(50);
    
    	TX_Mode();								
    	while (!(TX_DS|MAX_RT));				
    	sta = 0;
    	PD_Mode();							
    	delay(50);
    	
    	LED1=0;   
        WUOPC0 = 0XFF; 
        WUOPC1 = 0X3F;                            
        OPMCON = 0x06;
    	PWRDWN = 0x01;
     	while(1);
    

    }

    also I ve try folowing code:

    void main(void) { P0 = 0x00; P1 = 0x00; P0DIR = 0xff; P1DIR = 0x3f; PWRDWN = 0; OPMCON= 0x00; P1CON = 0x50;
    P1CON = 0x51;
    P1CON = 0x52;
    P1CON = 0x53;
    P1CON = 0x54;
    P1CON = 0x55;
    P0CON = 0x50;
    P0CON = 0x51;
    P0CON = 0x52;
    P0CON = 0x53;
    P0CON = 0x54;
    P0CON = 0x55;
    P0CON = 0x56;
    P0CON = 0x57;
    LED1=1; delay(500);

    LED1=0;   
        WUOPC0 = 0XFF; 
        WUOPC1 = 0X3F;                            
        OPMCON = 0x06;
    PWRDWN = 0x01;
     	while(1);
    

    }

    it also failed to enter sleep

  • but when WUOPCx inverted , they will never be able to wake up by press keys. also when wake up pwrdwn=1 should reset the mcu? but the mcu never reset.

Reply Children
No Data
Related