2
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API #include <LPC214x.H> /* LPC214x definitions */ typedef unsigned char uc; #define RDR 0x01 #define THRE 0x20 void uart0_init() { /* initialize the serial interface */ PINSEL0 = 0x00000005; /* Enable RxD0 and TxD0 */ U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */ U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock U0DLL = 194 for 30MHz and U0DLM= 0x01; U0DLL = 0x84; at VBP + 60MHz */ U0LCR = 0x03; /* DLAB = 0 */ } uc get_char() { while (!(U0LSR & RDR)); return (U0RBR); } void put_char(uc dt) { while(!(U0LSR & THRE)); // Wait until UART0 ready to send character U0THR = dt; // Send character } void puts(uc *st) { while(*st) {

Mycortex Googlecode Com Svn Trunk LPC 2148 EasyARM Finals 05 2

  • Upload
    crsarin

  • View
    214

  • Download
    1

Embed Size (px)

DESCRIPTION

jmm

Citation preview

  • pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    #include /* LPC214x definitions */

    typedef unsigned char uc;

    #define RDR 0x01#define THRE 0x20

    void uart0_init(){ /* initialize the serial interface */ PINSEL0 = 0x00000005; /* Enable RxD0 and TxD0 */ U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */ U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock U0DLL = 194 for 30MHz and U0DLM= 0x01; U0DLL = 0x84; at VBP + 60MHz */ U0LCR = 0x03; /* DLAB = 0 */}

    uc get_char(){ while (!(U0LSR & RDR)); return (U0RBR);}

    void put_char(uc dt){ while(!(U0LSR & THRE)); // Wait until UART0 ready to send character U0THR = dt; // Send character

    }

    void puts(uc *st){ while(*st) {

  • pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    put_char(*st++); }}

    int main (void) { uart0_init();

    puts("UART0 echo test [press any key]"); while (1) { put_char(get_char()); }}