Hi everybody!
I have a problem about RF and PIC16F877A.
In my project I'm sending the data from PC via rs232 (and max232 and atx-34 s) and and receive via arx-34 c and send to the pic from RC7/RX (26th) pin of 16f877a.
I can see the tx sends the data and rx receives the data. But the problem is pic16f877a can't process the data. What could be the reason.
PS: I'm sending ascii data like B.
e.g. data1=getchar();
if (data1=='B')
{
output_high(port_d5);
delay_ms(1000);
Output_low(port_d5);
}
Make sure the polarity af the data is correct, ie not inverted.
And the obvious stuff like baud rate, no. of start and stop bits and whether there is parity or not, if your sending a parity bit and the receiver doesnt expect it you'll get a framing error.
Which brings us to something else, check the error register within the pic using a simulator and see if there is an error generated or not.
I will check the polarity today. But I'm sure about baud rate and I am sending with a low baud rate (baud rate=300).
I am sending 5 byte AA then 5 byte 00 and finally 5 byte FF. No parity bit.
I used the program on proteus using VMETER. But I can't test RF with proteus.
And I want to ask something else should I use a pass filter or how can I use it?
As I said I can't simulate RF on proteus am using VTERM called device to test the code. It sends char and pic gets it. Program works well. But not in real world .
try with 9600 baud see if it is not the baud rate problem...
try echoing the received char may be not receiving correctly because if it receive junk character it will go in continuous while loop...
have you set the controller's clock frequency setting despite of having connected an oscillator..?
i mean to say try some standard value in your case you can use 1200 or 2400..
about the clock i was asking for the simulation only just click on the controller and set the processor frequency setting to 4Mhz....
The controller frequency is already 4 Mhz.
By the way I solved the case I asked for 16f84.
Probably I will use 16f84 for RF and send the data from 16f84a to 16f877a.Whole circuit consists of 4 sensors, 4 dc motors and 1 RF and these make 16f877a circuit more complicate.
Yes code is working. I'm using RS232 and sending data from PC via tx to PIC16f877a. The problem is rx can't take the data correctly. Maybe I have to use some filters twin t notch.