Jump to content

Yannux

Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Yannux

  • Rank
    Newbrie
  1. Thank you for replies ! Finally, I found that my crystal oscillator produces a bad frequency, so the baudrate wasn't good. I just changed capacitors values and now it works fine ;-) To AudiTTR : Enable interrupt is not needed. The TXIF is set by uart regardless interrupt settings. Enable interrupt is needed only when you want to produce an interrupt when a data has been sent. Regards, Yann PS : excuse my poor english but i'm a french guy
  2. Hi all ! I wanted to test rs232 communication and i tried this code : #include <system.h> #pragma DATA _CONFIG, _HS_OSC & _WDT_OFF & _CP_OFF & _LVP_OFF & _MCLRE_ON #pragma CLOCK_FREQ 4000000 void main() { option_reg = 0x80; /* USART Configuration */ set_bit(trisb, 2); set_bit(trisb, 1); set_bit(rcsta, SPEN); /* Serial port activation */ spbrg = 103; /* Baudrate 9600 with 4Mhz Clock */ clear_bit(txsta, SYNC); /* Asynchronous mode */ set_bit(txsta, TXEN); /* TXEN = 1 */ txreg = 0x31; while(1) { while (!test_bit(pir1, TXIF)); txreg = 0x31; } } But the mcu seems to never pass the while instruction. Someone can help me ? Thx, Yann.
  3. Hi all, I just want to know if I can use the eeprom_read / write functions with a 16F628 device. Thx, Yann.
×
×
  • Create New...