Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ARM serial communication

Status
Not open for further replies.

ZeleC

Full Member level 5
Joined
Dec 18, 2002
Messages
261
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,298
Activity points
2,173
Hello guys,
does anyone of you have a serial interrupt routine for LPC2100 familly i managed to echo using polling but cant its not working in interrupt mode .
And if there is someone who can help me maybe i will post the code that i written
thx
 

actually i made it work here for some that may need it
#include <LPC21xx.H> /* LPC21xx definitions */
#define CR 0x0D
int TXchar (int);
int RXchar (void);

void int_serial (void) __irq;
char recChar,c;

int RXchar (void) { /* Read character from Serial Port */

while (!(U0LSR & 0x01));

return (U0RBR);
}

int TXchar (int ch) { /* Write character to Serial Port */

if (ch == '\n') {
while (!(U0LSR & 0x20));
U0THR = CR; /* output CR */
}
while (!(U0LSR & 0x20));
return (U0THR = ch);
}


/****************/
/* main program */
/****************/
int main (void) { /* execution starts here */
// U32 a ;
/* initialize the serial interface */
PINSEL0 = 0x0005; /* Enable RxD1 and TxD1 */
U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock */
U0LCR = 0x03; /* DLAB = 0 */
U0IER = 0x01; /* Enable RDA and THRE interrupts */
VICIntSelect &= ~0x00000040; // UART0 selected as IRQ
VICVectAddr14 = (unsigned int)int_serial;
VICVectCntl14 = 0x26;
VICIntEnable |= 0x40;


while (1) {

}
}

void int_serial (void) __irq {
recChar = recChar+1 ;
if ((U0IIR & 0x0E) == 0x04) { /* Receive interrupt */
c = (char)U0RBR;
TXchar(c);
}
VICVectAddr = 0; /* Acknowledge Interrupt */

}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top