Exemplo n.º 1
0
/*******************************************************************************
* MAIN FUNCTION                                                                *
*******************************************************************************/
int main(void)
{
	unsigned char ucStatus;
	unsigned char ucData;
	unsigned char key_send;
        unsigned char key;
	
        initialzie();

	while (1)
        {
		// If data is received...
		if (IRQ == 0)
                {
			ucStatus = ucNrf24l01ReceivePacket(&ucData, 1);

			// Make sure data is read out successfully.
			if (ucStatus != 0)
                        {
                                LCD_goto(0, 0);
                                LCD_putstr("Receive ");
                                LCD_goto(1, 0);
				LCD_putchar(ucData);
				// Turn on/off LED1 according to the data received.
				if (ucData == '1')
                                {
					LED1 = 1;
				}
				else if (ucData == '2')
                                {
					LED1 = 0;
				}
                        }
                }

            while((key = keypad_read()) != 0xFF)
            {
 			// Enable Tx mode.
                        key_send = keypad_wait(); //ASCII_value(keypad_wait());
                        LED1 = ~LED1;
                        __delay_ms(30);
                          LCD_goto(0, 0);
                          LCD_putstr("Transmit");
                          LCD_goto(1,0);
                        LCD_putstr("Mode");
                        __delay_ms(40);
			vNrf24l01EnableTx();

			ucStatus = ucNrf24l01TransmitPacket(&key_send, 1);

			// Change back to Rx mode.
                        vNrf24l01EnableRx();
            }
        }
}
Exemplo n.º 2
0
void LCD_putint(int value, u08 radix)	// wysy³a na port szeregowy tekst 
					// przedstawiaj¹cy value z podstaw¹ radix
{
  char string[18];			// bufor na wynik funkcji itoa
  itoa(value, string, radix);		// konwersja value na wartoœæ dziesiêtn¹
  LCD_putstr(string);			// wyœlij string na LCD
}
Exemplo n.º 3
0
void LCD_puthexU16(u16 value)
{
  char s[5];
  word2hex(value,s);
  LCD_putstr(s);
}