Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Serial Communication RS232

Status
Not open for further replies.

Hasnatsaeed

New Member
Hi.i am trying to communicate with 16f877a via serial port .The problem is that nothing is happening.the code is simple and its working 100% fine(compiling and simulating).i am using the CCS compiler so that everything is in C.i have attached the source file and the design.kindly debug it.i am desperate about it.thank u
 

Attachments

  • serial.c
    624 bytes · Views: 179
  • design2.GIF
    design2.GIF
    76.2 KB · Views: 323
Hi, you want to check out the output in the virtual terminal? Right? Or are you using a virtual com port for viewing it in an application?

First if all, MCLRE is floating, no code will be executed. Pull it high.

What is the oscillator frequency that you have set for the processor? Also check out the baudrate set in the virtual terminal properties.
 
The processor frequency is 20MHz......and my baud rate is 9600...the same is in the hyper terminal i setup...i just want to see the output on hyper terminal simple.nothing more or less but nothing appears.some say that may be my processor's frequency is not compatible with the baud rate i am using or it may be the capacitor's compatiblity with the baud rate..i could not understand either of these.plz help
 
The processor frequency is 20MHz......and my baud rate is 9600...the same is in the hyper terminal i setup...i just want to see the output on hyper terminal simple.nothing more or less but nothing appears.some say that may be my processor's frequency is not compatible with the baud rate i am using or it may be the capacitor's compatiblity with the baud rate..i could not understand either of these.plz help

Did you connect #5 of the connector to 0V as explained by Ian.??

EDIT.
The pin outs
 

Attachments

  • MAX232.gif
    MAX232.gif
    26.8 KB · Views: 185
Last edited:
yes i did connect to the ground

hi,
OK.
Even with different baud rates set for the two devices, most often you should see corrupted characters on the PC terminal.

With the 20MHz xtal and for a 9600 baud rate, what are BRGH and SPBRG set to in the PIC.?
 
i dont know...i never set it...i built a project in CCS and it never asked for such things..all it asked was baudrate,parity etc.i am attaching a picture of the configurations i set before compiling the project
 

Attachments

  • config.GIF
    config.GIF
    26.1 KB · Views: 175
some of my friends implemented the serial communication using atmel and they were having the same problem but when they changed their capacitors ,that were attached to max 232 ,from 10 uf to 11 uf..it worked...so i was wondering if mine is the same problem?
 
some of my friends implemented the serial communication using atmel and they were having the same problem but when they changed their capacitors ,that were attached to max 232 ,from 10 uf to 11 uf..it worked...so i was wondering if mine is the same problem?

I have used capacitor values from 1uF thru 10uF and never had a problem

Do you have access to an oscilloscope.?
 
Last edited:
was it with pic16f877a?......i too used 10 uf capacitors b4 shifting to 22uf but no difference.still nothing...yes i do have an access to an oscilloscope
 
was it with pic16f877a?......i too used 10 uf capacitors b4 shifting to 22uf but no difference.still nothing...yes i do have an access to an oscilloscope

Use the scope to monitor the pins into and out of the MAX232.

On the PIC side of the MAX the signals should swing from +5V to 0V and on the PC side approx +/9V swing, when a data string is being sent and received.

The display pattern on the scope should change as the data changes..

Do you follow OK.?
 
yes i do..you i should connected the oscilloscope's positive probe on TX pin of the pic16f877a?.chk it..and then connect the probe to the output pin of max232?.and chk it..is that what you are saying?
 
yes i do..you i should connected the oscilloscope's positive probe on TX pin of the pic16f877a?.chk it..and then connect the probe to the output pin of max232?.and chk it..is that what you are saying?

Connect the 0V side of the scope probe to the 0V of the PIC and MAX, use the tip of the scope probe to measure the different pins, signals
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top