proste echo rs232 i PIC18F2550

May 05, 2006 0 Replies

mam programik prosty ktory ma robic za "echo" po porcie RS232: Po wyslaniu jednego znaku PIC odpowiada non stop, jakby flaga odebranego znaku (RCIF) nie gasila sie pojego odczytaniu w funkcji getc()?? Ktos mial podobny problem?



#include "18F2550.h"



#use delay (CLOCK=16000000, RESTART_WDT) #rom 0x300000={0x0F3C ,0x1E3F/*07*/, 0x8183, 0xC007, 0xE007, 0x4007} #use rs232 (BAUD=57600, XMIT=_TxD, RCV=_RxD, RESTART_WDT,



disable_interrupts( INT_RDA ); disable_interrupts( INT_TBE );



// en asynchr rs 232 bit_clear( TXSTA, 4 ); //SYNC bit_set( RCSTA, 7 ); //SPEN bit_clear( RCSTA, 0 ); // Rx9D=0 bit_set( RCSTA, 4 ); // CREN=1



enable_interrupts( GLOBAL );



while(1) { restart_wdt (); ch = getc(); // wait for rcreg filled putc( ch ); }



Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required