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.

UART/PIC16F876A Help please

Status
Not open for further replies.

b4xt0r

New Member
Hi I bought the PIC dev board for 28 pin pics on olimex and I am trying to get it to communicate via R232.
Programmer shows no sign of problems and the other sample programs work great. I take the hex file for my pic and program it, start hyperterminal and apply power to the microcontroler and I get no reply. Have changed settings in hyperterminal, jumper on board and have the RX/TX wires soldered. Am I missing something? What should be changed from default I could be missing? I will be able to check back on this topic when I am home in 4 hours. Thanks!
 
It would help if you post a circuit diagram and the code.

You need to get quite a few commands correct to get the EUSART to work and if any is wrong, you tend to get nothing at all and no indication why not.

What you can do is split things up as much as possible.

Write some test code to send a single character from the PIC regularly. You can then monitor the 5V signal with a 'scope or even an LED at a pinch. If stuff is being sent, check the RS232 levels. A 'scope lets you look at the waveform and lets you see if you have the right baud rate, number of bits etc.

You can check that you have hyperterminal working by connecting the RX to the TX signals, and turning the echo off on hyperterminal. With no link, if you type something, nothing should appear on screen. With a link, you should see what you type. You can do that test at either RS232 or 5V levels.
 
Have you tried creating a new hyperterminal session using Com1, setting the following:
"Bits per second" = 9600
"Data bits" = 8
"Parity" = none
"Stop bits" = 1
"Flow control" = none

If that does not work, check your cable is wired correctly with rx-tx, tx-rx and ground connections.
 
check your cable is wired correctly with rx-tx, tx-rx and ground connections.

Yes, that is likely the trouble. Olimex has a different way of naming Rx and Tx on their boards, so you may want to look into that.
 
Ok well I am sure that I have hyperterminal working as if I bridge rx and tx pins on the serial port the letters show up without having echo typed chars on.
My serial cable was handmade.. there is continuity through the cable. It correctly programs the pic. Should TX/RX be swapped? Or was that a reference to the board?
Also I need a free win32 based C/C++ compiler as I have looked for one supported by my model and cant seem to find one.
I have only used the sample .hex found on the olimex site, but this "should" work.
The only modifications to this board I have made thus far was to solder a wire from pin 17 to the max232's printed TX pin. and from pin 18 to RX.
I will look for a compiler but I just wished my computer had a serial port. Must use a laptop. Is there a way to realistically emulate USB as serial?
 
Should TX/RX be swapped? Or was that a reference to the board?

Sorry, that is with reference to the board. The Tx of the PIC should go to Rx on the board, and Rx on the PIC should go to Tx on the board. (Olimex marks the board with respect to the max232.)

Also I need a free win32 based C/C++ compiler as I have looked for one supported by my model and cant seem to find one.

Are you referring to a compiler for the microcontroller? or, as Bill suggested, for the PC?

If it is a PIC compiler you are after, SourceBoost has a 2k free compiler, and for the full featured one, will cost you around fifty bucks, and if you are working on 18Fxxx go for Microchips C18; if it is a PC compiler, follow Bill's suggestion.
 
Ok well somehow I was able to get the USART to work. Now I need the software to compile the c code to hex. I was under the impression there were some free ware/open source ones available but I'm not sure.
 
Sure lots of free tools out there. CCS C has a 2K limited version and and C18 has a free SE edition. Plenty of free tools out there, even BASIC.
 
Status
Not open for further replies.

Latest threads

Back
Top