Advertisement
sanpai

RFID CARD COMPARE

Nov 2nd, 2012
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. #include "LPC13xx.h"
  2. #include "uart.h"
  3. #include "stdio.h"
  4. #include "lcd.h"
  5.  
  6.  
  7. extern volatile uint32_t UARTCount;
  8. extern volatile uint8_t UARTBuffer[BUFSIZE];
  9.  
  10. int main (void) {
  11. /* Basic chip initialization is taken care of in SystemInit() called
  12. * from the startup code. SystemInit() and chip settings are defined
  13. * in the CMSIS system_<part family>.c file.
  14. */
  15. SystemInit();
  16. /* NVIC is installed inside UARTInit file. */
  17. UARTInit(115200);
  18.  
  19. char count=0;
  20.  
  21.  
  22.  
  23. while (1)
  24. { /* Loop forever */
  25. if ( UARTCount != 0 )
  26. {
  27. LPC_UART->IER = IER_THRE | IER_RLS; /* Disable RBR */
  28. UARTSend( (uint8_t *)UARTBuffer, UARTCount );
  29. lcd_putstring(0, "(uint8_t *)UARTBuffer");
  30. UARTCount = 0;
  31. LPC_UART->IER = IER_THRE | IER_RLS | IER_RBR; /* Re-enable RBR */
  32. }
  33.  
  34. if(UARTBuffer[1]=='3' && UARTBuffer[2]=='6' && UARTBuffer[3]=='0' && UARTBuffer[4]=='0' && UARTBuffer[5]=='6' && UARTBuffer[6]=='2' && UARTBuffer[7]=='1' && UARTBuffer[8]=='0' && UARTBuffer[9]=='6' && UARTBuffer[10]=='9')
  35. lcd_putstring(1,"ACCESS GIVEN"); // compare 12 bytes of the card value
  36. count++;
  37. if(count>=2)
  38. {
  39. lcd_putstring(2,"NO PARKING SPACE");
  40. }
  41. else
  42. {
  43. lcd_putstring(2,&count);
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement