HELLO,
I Want to interface USB & ps2 keyboard with lpc2148. so,can anyone give me idea how to initialize & configure it? & from where to start my program?
Can lpc2148 work as master in i2c communication?
thank you.
I used serial communication with the help of UART & DB9 connector.
I am new to this field. so, I don't know about USB interfacing.
Here is my code for "FINGERPRINT ACCESS SYSTEM".How can it help me for USB.
I want to display keyboard character on LCD.
#include<lpc214x.h> #include "lcd.h" //LCD INIT.,DATA & CMD #include "lcd_print.h" //WEL-COME SCREEN & MAIN MENU #include "baudrate.h" //FOR BAUDRATE SETTING #include "enroll.h" //ENROLL FUNCTION #include "diag.h" //DIAGNOSE FUNCTION #include "add_user.h" #include "identify.h" #include "deletealluser.h" #include "rtc.h" #include "sms_send.h" #include "gsm.h"
void serial_init() { U0LCR = 0x80; //UART0 CONFIG. U0DLL = 0x61; U0DLM = 0x00; U0LCR = 0x03;
U1LCR = 0x80; //UART1 CONFIG. U1DLL = 0x61; U1DLM = 0x00; U1LCR = 0x03; }
void DIAGNOSE_ISR() { lcd_clr(); diagnose(); }
void ENROLL_ISR() { lcd_clr(); enrollfunc(); //CALL FOR ENROLL FUNCTION }
void IDENTIFY_ISR() { lcd_clr(); identify(); }
void DELETE_ISR() { lcd_clr(); delete(); }
int main() { unsigned int a,b,c,d,e;
PINSEL0 = 0x00050005; // UART0 , UART1 PINSEL1 = 0x00000000; IO1DIR = 0x0BFF0000; // 0 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 .... VPBDIV = 0x00;
lcd_print();
serial_init();
RTC_Init (); RTC_SetTime (23,59,45); RTC_SetDate (31,12,2011);
// baudrate();
/* EXTMODE = 0x00; EXTPOLAR = 0x00; VICIntSelect = 0x0000; VICIntEnable = 0x03C000; VICVectCntl0 = 0x2E; VICVectAddr0 = (unsigned long) DIAGNOSE_ISR; //DIAGNOSE INTRRUPT ROUTINE VICVectCntl1 = 0x2F; VICVectAddr1 = (unsigned long) ENROLL_ISR; //ENROLL INTERRUPTS ROUTINE VICVectCntl2 = 0x30; VICVectAddr2 = (unsigned long) IDENTIFY_ISR; //IDENTIFY INTERRUPTS ROUTINE
while(1); */ while(1) { e = IO1PIN & 0x08000000; //admin mode if(e == 0x0000000) { lcd_data4(); delay_ms(5000); adminpass(); if(flag1 == 0x01) break;
while(1) { lcd_data3(); //========== Diagnose section ================== a = IO0PIN & 0x00010000; if(a == 0x0000000) { DIAGNOSE_ISR(); while((IO0PIN & 0x00010000) == 0x00000000); } //========== Enroll Section ==================== b = IO0PIN & 0x00000008; if(b == 0x00000000) { ENROLL_ISR(); while((IO0PIN & 0x00000008) == 0x00000000); } //========== Identify Section ================= c = IO0PIN & 0x00000080; if(c == 0x0000000) { IDENTIFY_ISR(); while((IO0PIN & 0x00000080) == 0x00000000); } //========== Delete section ===================== d = IO0PIN & 0x00100000; if(d == 0x0000000) { DELETE_ISR(); while((IO0PIN & 0x00100000) == 0x00000000); } } }
e = IO1PIN & 0x08000000; if(e == 0x08000000) //user mode { lcd_data5(); delay_ms(5000); lcd_clr(); delay_ms(1000);
while(1) { lcd_data6(); //========== Diagnose section ================== a = IO0PIN & 0x00010000; if(a == 0x0000000) { DIAGNOSE_ISR(); while((IO0PIN & 0x00010000) == 0x00000000); } //========== Identify Section ================= c = IO0PIN & 0x00000008; if(c == 0x0000000) { IDENTIFY_ISR(); while((IO0PIN & 0x00000008) == 0x00000000); } } } } }