ARM komunikasi serial

Z

ZeleC

Guest
Hello guys,
apa ada diantara kalian ada yang rutin interupsi serial untuk Familly i LPC2100 berhasil echo menggunakan polling tetapi cant nya tidak berfungsi dalam modus menyela.
Dan jika ada seseorang yang bisa membantu saya mungkin saya akan posting kode yang tertulis i
thx

 
Punya kode iar.com melihat ke contoh:
http://www.iar.se/p126332/p126332_eng.php
ftp://ftp.iar.se/WWWfiles/arm/Projects/Philips.zip

Aku pernah mendengar orang-orang yang bekerja sepotong lembut.

 
sebenarnya saya membuatnya bekerja di sini untuk beberapa yang mungkin membutuhkannya
# include <LPC21xx.H> / * LPC21xx definisi * /
# define CR 0x0D
int TXchar (int);
int RXchar (void);

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

int RXchar (void) (/ * Baca karakter dari Serial Port * /

while (! (U0LSR & 0x01));

return (U0RBR);
)

int TXchar (int ch) (/ * Tulis karakter ke Serial Port * /

if (ch == '\ n') (
while (! (U0LSR & 0x20));
U0THR = CR; / * output CR * /
)
while (! (U0LSR & 0x20));
return (U0THR = ch);
)/****************/
/ * Program utama * /
/****************/
int main (void) (/ * eksekusi dimulai di sini * /
/ / U32 a;
/ * Menginisialisasi serial interface * /
PINSEL0 = 0x0005; / * Aktifkan Rxd1 dan TxD1 * /
U0LCR = 0x83; / * 8 bit, tidak Parity, 1 Stop bit * /
U0DLL = 97; / * 9.600 Baud Rate @ 15MHz VPB Clock * /
U0LCR = 0x03; / * DLAB = 0 * /
U0IER = 0x01; / * Aktifkan RDA dan THRE menyela * /
VICIntSelect & = ~ 0x00000040; / / UART0 dipilih sebagai IRQ
VICVectAddr14 = (unsigned int) int_serial;
VICVectCntl14 = 0x26;
VICIntEnable | = 0x40;while (1) (

)
)

int_serial void (void) __irq (
recChar = recChar 1;
if ((U0IIR & 0x0E) == 0x04) (/ * Menerima interrupt * /
c = (char) U0RBR;
TXchar (c);
)
VICVectAddr = 0; / * Akui Interrupt * /

)

 

Welcome to EDABoard.com

Sponsor

Back
Top