Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*****************************************************************************
- * uarttest.c: UART test C file for NXP LPC13xx Family Microprocessors
- *
- * Copyright(C) 2008, NXP Semiconductor
- * All rights reserved.
- *
- * History
- * 2008.08.20 ver 1.00 Preliminary version, first Release
- *
- ******************************************************************************/
- #include "LPC13xx.h"
- #include "uart.h"
- #include "stdio.h"
- #include "lcd.h"
- #include "string.h"
- #define ARR_LEN 2
- #define TAG_LEN 11
- extern volatile uint32_t UARTCount;
- char UARTBuffer[BUFSIZE];
- char TAG[ARR_LEN][TAG_LEN]={{0x24,0x30,0x30,0x31,0x32,0x38,0x31,0x35,0x36,0x38,0x30 },
- {0x24,0x30,0x30,0x31,0x32,0x38,0x31,0x32,0x38,0x36,0x39 }};
- int main (void) {
- /* Basic chip initialization is taken care of in SystemInit() called
- * from the startup code. SystemInit() and chip settings are defined
- * in the CMSIS system_<part family>.c file.
- */
- SystemInit();
- init_lcd();
- /* NVIC is installed inside UARTInit file. */
- UARTInit(9600);
- unsigned char count=0,i;
- while (1)
- { /* Loop forever */
- if ( UARTCount != 0 )
- {
- LPC_UART->IER = IER_THRE | IER_RLS; /* Disable RBR */
- //UARTSend( ( char *)UARTBuffer, UARTCount );
- lcd_putstring(0,( char *)UARTBuffer);
- UARTCount = 0;
- LPC_UART->IER = IER_THRE | IER_RLS | IER_RBR; /* Re-enable RBR */
- }
- for(i=0; i<2; i++)
- {
- if(memcmp(UARTBuffer,TAG[ARR_LEN],TAG_LEN)==0)
- {
- lcd_putstring(1,"ACCESS GIVEN"); // compare 12 bytes of the card value
- count++;
- }
- else
- {
- lcd_putstring(1,"ACCESS DENIED");
- }
- }
- if(count>=2)
- {
- lcd_putstring(1,"NO SPACE");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement