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.

[SOLVED] problem in uart communication

Status
Not open for further replies.

avirajose

Junior Member level 3
Joined
Nov 28, 2011
Messages
29
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
India
Activity points
1,491
hi all,
i have succesfully interfaced the pc with my pic microcontroller 16f877a. But i don,t get the data correctly fpom the pc.

First off all, may i mention, i didn't go for max232. Can any one mention in which format the data is sent from pc--hex or ascii?..
i try to find the data recieved.. and i get-----103 for 1, 51 for 2, 102 for 3, 25 for 4....

can any one help me why it is so.....is it due to ,the missing max232?
 

it depends upon you what type of data you need.
HEX formate is easy to handle in pic i think.
you normally set the bits of registers in HEX formate.
for asci you have to consult the asci table
 

avirajose said:
i have succesfully interfaced the pc with my pic microcontroller 16f877a. But i don,t get the data correctly fpom the pc.

First off all, may i mention, i didn't go for max232.
If not max232, then what is the interface between PC and PIC? Could you post the schematic?
 

Hi,

What are you using for the level translation from Pic +5 voltages to PC +_12v ? 1488/89 chips or transistors ?

What frequency are you using for the crystal or oscillator on the Pic and what baud rate settings have you selected ?
Showing your program code might be helpful.

The Max232 actually inverts the data.

Think using ascii is the better option, using hex on the pc would be a real pain, a simple pic subroutine to convert the ascii back to hex is all thats needed.
 

Two points:

1. Data isn't hex or ASCII, it's just a stream of bits. It's up to your application to interpret it as one or the other.
2. Do you realize the MAX232 inverts the bits? It's is supposed to do this as well as shift the voltage levels. The serial input on the PC does the opposite to reverse the polarity again. If you just link the two together your data is 'upside down' 1 becomes 0, 0 becomes 1 and you also risk damage to the PIC as the PC serial voltages are outside the PICs safe limits.

Brian.
 

it depends upon you what type of data you need.
HEX formate is easy to handle in pic i think.
you normally set the bits of registers in HEX formate.
for asci you have to consult the asci table

thankyou,,,
but i need to know in which format data is send from pc to pic.
 

Hi,

Just said -

Think using ascii is the better option, using hex on the pc would be a real pain, a simple pic subroutine to convert the ascii back to hex is all thats needed.

Here is a picture of my rs232 link receiving and sending data - unless your PC is sending masses of raw data created in hex then surely using ascii is the way to go.
( you are not trying to download your own program code by any chance ? - you need a bootloader for that )
 

Attachments

  • ScreenShot002.jpg
    ScreenShot002.jpg
    10.7 KB · Views: 65
Last edited:

hai thank u all for ur valuable time and ideas......
max232 salved my problem and the steream i get was ascii......
can i interface 2 pic without max232
 

Yes, the MAX232 is to convert the logic levels to RS232 standard so it can be sent along long cables and back again. If you are just linking 2 PICs over short distance you can simply cross the TX pin of one with the RX pin on the other.

Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top