Serial comm using pic16f877a....

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
Hi,

I have connected the 12 with 15pF with 20Mhz at both side and taking power from external source with ground connected to uSB and vcc left open of USB...
but nothing is working same as in past!
 
Last edited:

tshuck

Joined Oct 18, 2012
3,534
Try changing the UART parameters, i.e. BRGH...


Now, Rritesh, it had come to my attention that you have an identical thread over on ETO. While I have no problem attempting to get information from more than one place, you are simply pasting things from this thread over there and vice versa, without actually attempting anything for yourself. That I will not tolerate. You are meant to learn here, and what you have done is copy some of Ian's code here, and some of what I've said there.

If you want to learn, read the datasheet, in particular, the section on the UART module. If you have any specific questions, feel free to ask, however, from this point forward, you will be doing your own work.
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
I have seen one error while TRISC setting it should be...
TRISC=0b100000000; but still not working sending only nulll character (00), why??
 
If you can find this book in your college library: "PIC Microcontroller and Embedded Systems" by Muhammad Ali Mazidi, read the section called: "Serial Communication". It is for the PIC18F, but with the help of the datasheet and some porting, you can write the same for the PIC16F series.

Start with a simple circuit with an LED blinking for approximately 500ms. Then you know the frequency and the timing in the microcontroller is correct. There is a simple calculation on how you can calculate the baud rate inside the book I mentioned, or even the datasheet for the respective microcontroller will tell you that.

Plus, and also don't forget to change the Tx pin to output, and the Rx pin to input.
 
I have done this...
TRISC=0b100000000;
Okay, you have done that.

So, try sending a letter 'a' to the computer. If you find other things on the computer than 'a', your Baud Rate Generator settings are wrong. Recalculate them.

Look at the datasheet for PIC16F877A - page 113. The formula to calculate the baud rate depends on the BRGH and the SYNC bit in the TXSTA register.
 
How about the BRGH bit?

Also, when you plug in the UART->USB converter for the first time, have you seen anything, like a "Found new hardware"?

Or, if you can go to My Computer -> Device Manager and check the "Ports" section. There will be another extra port if you have connected the converter. If it said "Prolific USB-to-Serial Port" or the "FTDI" one with COMX (Where X is the port number), then in the RealTerm, you should select the respective port number.

Example in my computer with the converter plugged in, it's COM12, so in the RealTerm, I select the COM12 as the serial port.

And, what is the output on the RealTerm?
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
How about the BRGH bit?
it is one i.e. set...
Also, when you plug in the UART->USB converter for the first time, have you seen anything, like a "Found new hardware"?

Or, if you can go to My Computer -> Device Manager and check the "Ports" section. There will be another extra port if you have connected the converter. If it said "Prolific USB-to-Serial Port" or the "FTDI" one with COMX (Where X is the port number), then in the RealTerm, you should select the respective port number.

Example in my computer with the converter plugged in, it's COM12, so in the RealTerm, I select the COM12 as the serial port.

And, what is the output on the RealTerm?
Yes i detect the hardware and realterm also show for example com 5 and 50 usb serial....like that.

And, what is the output on the RealTerm?
it only show null 00 when i do reset many times it comes in series nothing else....
 
Top