> Ivan Petrushev escribió:
>
>
> > ########################################
> > #include <pic.h>
> > char ee_count = 0;
> > char tmp;
> >
> > void main(void) {
> > OSCCON = 112; //4Mhz
> > //I was not sure if I will need interrupts, and some other version of
> > the same code tried to use interrupts, but it didn't happen neither
> > GIE = 1;
> > PEIE = 1;
> > RCIE = 1;
> > ANSEL = 0;
> > TRISA = 0;
> > TRISB = 4; //RB2 - in, RB5 - out
> > PORTB = 0;
> > TXSTA = 32; //async mode
> > RCSTA = 128; //usart enable
> > SPBRG = 2; //19.2 kbps
> > RA3 = 0;
> > while(1) {
> > RA3 = 1;
> > if (RCIF){
> > RA0 = 1;
> > ee_count++; //write on which address in eeprom
> > EEADR = ee_count;
> > tmp = RCREG;
> > EEDATA = tmp;
> > EECON1 = 4;
> > //write eeprom - this is taken from the pic16 documentation and it is working
> > #asm
> > movlw 0x55
> > movwf 0x18d
> > movlw 0xAA
> > movwf 0x18d
> > bsf 0x18c,1
> > #endasm
> > while (EECON1 & 2){ //eeprom write finished
> > #asm
> > nop
> > #endasm
> > }
> > RA0 = 0;
> > }// if RCIF
> > RA3 = 0;
> > } //main loop
> >
> > }
> > ########################################
>
> Hi, a little late. I hope is not too late.
>
> You are not checking for any errors in the reception. If
> the RCSTA.OERR bit is set reception will be stopped until
> CREN is cleared & set again.
>
> Also, take into consideration that storing a byte in eeprom
> can last about 4msec and that 1 byte being transmitted at
> 19200bps will delay close to 0.5msec
>
>
>
>
>
> --
> ------------------------------
> Mauricio Giovagnini (Maunix)
>
http://www.maunix.com.ar
> Cordoba, Arg.
> LinkedIn Profile:
http://www.linkedin.com/in/mgiovagnini
>
>