Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

need help 89c51 serial communication

Status
Not open for further replies.

starlet

Junior Member level 2
Joined
Jun 12, 2003
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
262
89c51 uart source

hi friends

i have a problem in serial communication with at89c51. i want to send 8 bits of data 0-255, i first used serial mode 1 which works well 1-255 but for zero i used mode 3 (9 bit uart) but it caused a problem.
i am using odd parity in PC. and with 8 bits, 9600 baud rate, 11.0592MHZ in uc.

mov a,#161 (161 constant can be variable r0 )
mov c,p
cpl c ;for odd parity
mov tb8,c
mov sbuf,a

but still it works for 7 bits data <128 but it sometimes receives or some times not. i am confused
is there any problem in code? i am using visual basic, but i also tried Hyper terminal but when i transmitted 161 decimal it gives me 237 and many errors fomr >127 values.
need help. but please as soon as possible. i really need to know bug?
 

89c51 serial communication

Hi,

Why using parity if the mcu does not support parity !. You should use the PC in 9600 N81 (9600 Bits/s No parity 8 data bits and 1 stop bit.

use the 8 bit mode on your mcu and set the buadrate gen correct.
send a byte and check before you put a new byte in the send register if its empty...

that is all..

Paul.
 

visual basic 9 bits serial

ok now

9600,N,8,1 works well with MCU for 0-255 but PC was not determinig the two 0s value.
hyper terminal is still showing the black rightward sign for 2 consecative zeros but VB does not show anyone therefore VB is right (null showing) but buffer count increases which is clear that some is receiving.
i was checking hyperterminal. 0 is null char. but 2 zeros are making sign given in picture below (rightward black sign).
that was confusing me to go on parity communication. but it might be the only one case to show 2 null char by that sign which come only for consec. zeros not any other time like for 0 and 1, or 0 and non zero value.

also PaulHolland , parity check communication is supported on at89c51 using TB8 and RB8 bits in 9 bits UART mode. i just missed to check the Parity flag, if i change that then that communication will also be good as other on MCU at89c51.
 

9 bit serial communications with vb

Hi Starlet,

I know you can use the mcu in 9 bit mode and make the 8th bit your parity bit but why would you >??.. its not giving any protection better use CRC instead... btw: you know how to calculate parity quickly on an 8 bit word ???..

regards,

Paul.
 

89c51 communication 10 bit

i am using 89c51want to communicate to pc with data 8 bit , parity bit even , stop bit 1 . Have any body tried using mode 3 , if yes can you send the source code please.

Added after 6 minutes:

starlet said:
ok now

9600,N,8,1 works well with MCU for 0-255 but PC was not determinig the two 0s value.
hyper terminal is still showing the black rightward sign for 2 consecative zeros but VB does not show anyone therefore VB is right (null showing) but buffer count increases which is clear that some is receiving.
i was checking hyperterminal. 0 is null char. but 2 zeros are making sign given in picture below (rightward black sign).
that was confusing me to go on parity communication. but it might be the only one case to show 2 null char by that sign which come only for consec. zeros not any other time like for 0 and 1, or 0 and non zero value.

also PaulHolland , parity check communication is supported on at89c51 using TB8 and RB8 bits in 9 bits UART mode. i just missed to check the Parity flag, if i change that then that communication will also be good as other on MCU at89c51.
hello . can you send the source code for parity check commincation- please
 

why are you using hyperterminal?

You need a terminal program that displays the data in hex. AvrTerm.exe is very good for debugging micro to terminal applications.

look in this thread:



I also posted some simple uart source there.

Good Luck
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top