M
mrhazard
Guest
Hei folkens, jeg prøver å sette opp en liten kode til ekko en røye i HyperTerminal men den ikke virker ...Her er min kode Jeg håper du kan hjelpe meg
Code:
# include <LPC214X.H>
# define CR 0x0d
void Initialize (void) / / Inicializacion de UART0
int putchar (int ch); / / Escribe un carácter en la puerta føljetong
int getchar (void); / / Lee un caracter en la puerta føljetong
/************************* MAIN *********************** ** /
int main (void)
(
Initialize ();// Inicialización de la UART0
mens 1 ()
(
putchar (U0RBR)int putchar (int ch) / * skrive tegn til seriell port * /
(
if (ch == '\ n') (
while (! (U0LSR & 0x20));
U0THR = CR; / output * CR * /
)
while (! (U0LSR & 0x20));
return (U0THR = ch);
)
int getchar (void) / * Les karakter fra Serial Port * /
(
while (! (U0LSR & 0x01));
return (U0RBR);
)
/*************** System Initialization ***************/
void Initialize ()
(
VPBDIV = 0x00;
/ * Initialize Pin Velg Blokker for TX og RX * /
PINSEL0 = 0x5;
/ * Aktiver FIFO og tilbakestille dem * /
U0FCR = 0x7;
/ * Sett DLAB og ord lengde satt til 8bits * /
U0LCR = 0x83;
/ * Baud rate satt til 9600 * /
U0DLL = 0x62;
U0DLM = 0x0;
/ * Clear DLAB * /
U0LCR = 0x3;
)
/************************************************* ********/
Code:
# include <LPC214X.H>
# define CR 0x0d
void Initialize (void) / / Inicializacion de UART0
int putchar (int ch); / / Escribe un carácter en la puerta føljetong
int getchar (void); / / Lee un caracter en la puerta føljetong
/************************* MAIN *********************** ** /
int main (void)
(
Initialize ();// Inicialización de la UART0
mens 1 ()
(
putchar (U0RBR)int putchar (int ch) / * skrive tegn til seriell port * /
(
if (ch == '\ n') (
while (! (U0LSR & 0x20));
U0THR = CR; / output * CR * /
)
while (! (U0LSR & 0x20));
return (U0THR = ch);
)
int getchar (void) / * Les karakter fra Serial Port * /
(
while (! (U0LSR & 0x01));
return (U0RBR);
)
/*************** System Initialization ***************/
void Initialize ()
(
VPBDIV = 0x00;
/ * Initialize Pin Velg Blokker for TX og RX * /
PINSEL0 = 0x5;
/ * Aktiver FIFO og tilbakestille dem * /
U0FCR = 0x7;
/ * Sett DLAB og ord lengde satt til 8bits * /
U0LCR = 0x83;
/ * Baud rate satt til 9600 * /
U0DLL = 0x62;
U0DLM = 0x0;
/ * Clear DLAB * /
U0LCR = 0x3;
)
/************************************************* ********/