View previous topic :: View next topic |
Author |
Message |
stma
Joined: 16 Feb 2004 Posts: 26
|
RS232 Parity problems |
Posted: Fri Nov 03, 2006 5:52 am |
|
|
Using compiler version 3.181
I declare my RS232 as
Code: | #use rs232(baud=9600,parity=N,xmit=PIN_B7,rcv=PIN_B6,bits=9,invert) |
When the program is relatively small it operates fine with the RS232 data being displayed as expected. (Using Tera Term).
However when more functionality is added then the RS232 data received can only be viewed (other than corrupt data) when the parity is set to odd or even.
Anyone any ideas.
Thanks
Steve |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Fri Nov 03, 2006 7:46 am |
|
|
Do not exist any relation between the parity, the complexity that a program
can be and data corruption, but if to add more functionalities means to enable
some timers, that could be the problem of receiving corrupted data.
Work around, try disabling global interrupt when your code get or put a char to
prevent data corruption.
Humberto |
|
|
Guest
|
|
Posted: Fri Nov 03, 2006 8:46 am |
|
|
Thanks Humberto.
Had thought about that before I tried changing the Parity setting.
I have no timers running at all in the program. Most of the time it is asleep and woken up on interrupt to check a port then write some data to an eeprom.
BUT the code added is not even called upon when the RS232 data is written to the screen.
Still confused. Why would this cause a problem that can be solved by using a parity setting to display the RS232 data?
Thanks
Steve |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Sat Nov 04, 2006 12:16 am |
|
|
Just some comments:
1) Are you using the Parity for any kind of checking or error detection in your communications ?
2) Are you really using the nineth bit for addressing or something else?
If not, did you try using:
Code: |
#use rs232(baud=9600,parity=N,xmit=PIN_B7,rcv=PIN_B6,bits=8,invert)
|
Posting a compilable code is a must if you expect better helping.
Humberto |
|
|
Guest
|
|
Posted: Tue Nov 07, 2006 4:48 am |
|
|
Thanks again Humberto. Great advice.
Changed to bits=8 and all fine.
Kicking myself that I didn't spot that.
Cheers
Steve |
|
|
|