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.

PIC 16F877-TRANSMITTING & RECEIVING OF STREAM OF CHARACT

Status
Not open for further replies.

RICKYLO

Junior Member level 3
Joined
Jan 15, 2006
Messages
25
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,528
Hello to all,

Can any one help me with the C CODE to TRANSMIT stream of characters from one PIC and RECEIVE them on another PIC? Both PICs are 16F877
 

Re: PIC 16F877-TRANSMITTING & RECEIVING OF STREAM OF CHA

Hi!
What communication protocol do u want to use. IIC, SPI OR USART?
Regards.
 

a few factors to consider i think:
- how fast?
- amount of data bytes at a time? (continuous stream or once in a while)
- robustness? (noisy environment?)
 

AS I will use a 4x3 matrix keypad to enter data, a slow baud rate should do. I will be using a FM RF MODULE for the TRANSMITTING AND RECEIVING.
 

RICKYLO said:
AS I will use a 4x3 matrix keypad to enter data, a slow baud rate should do. I will be using a FM RF MODULE for the TRANSMITTING AND RECEIVING.

what RF module you're using?

Added after 58 seconds:

if still looking, i think you can find some module on https://www.rfsolutions.co.uk/acatalog/
 

I am using SIL FM TX/RX MODULE 433MHZ

Added after 1 minutes:

I have purchased the FM RX MODULE already. I need a Code in C language to program the PIC 16F877 to send and receive the data
 

is it this module you're using?
**broken link removed**

so you have 2 sides: one side with the transmit module, and one with the receive module.

interfacing to these modules can be through the UART of the PIC.

Tx pin to DATA OUT pin

RX pin to DATA IN pin.

both sides should be configured at the same baud rate.

you may need a lot of testing to get it rite as there are lots of inteference, antenna length, etc.
 

Your response tells me that you are informed and I´ll be glad if you can assist me with the code. I am using for my school project and since I am so new to C programming I don´t know how to go about it
 

sorry, C for PIC i can't help much as i've never done programming for PIC before.
 

I am using this RF Module:**broken link removed**
 

Re: PIC 16F877-TRANSMITTING & RECEIVING OF STREAM OF CHA

Hi!
This code may help u configure ur serial port. Just add it to ur own code.If u still cannot do it then feel free to ask.
/********************************************************/
/*USART MACROS */
/********************************************************/
#define enable_serial_port SPEN = 1
#define disable_serial_port SPEN = 0
#define recive_9bit RX9 = 1
#define recive_8bit RX9 = 0
#define single_recv_enable SREN = 1
#define single_recv_disable SREN = 0
#define continous_recv_enable CREN = 1
#define continous_recv_disable CREN = 0
#define address_detect_enable ADDEN = 1
#define address_detect_disable ADDEN = 0
#define transmit_9bit TX9 = 1
#define transmit_8bit TX9 = 0
#define enable_transmit TXEN = 1
#define disable_transmit TXEN = 0;
#define synchronous_mode SYNC = 1
#define asynchronous_mode SYNC = 0
#define baudrate_high BRGH = 1
#define baudrate_low BRGH = 0
#define trans_reg_empty TRMT
#define set_9th_bit TX9D = 1
#define clear_9th_bit TX9D = 0
/********************************************************/
void setup_usart(void)
{
TXSTA = 0X04;
RCSTA = 0X10;
SPBRG = 103; //set this value according to ur own crystal
//and desired baud ratetable available in data
//sheet
enable_serial_port;
enable_transmit;
clear_usart_recv_int_flag;
}
/**************************************************************/
char getch (void)
{
while(!RCIF)
{
}
RCIF = 0;
return(RCREG);
}
/***************************************************************/
void putch (char c)
{
TXREG = c;
DelayUs(100);
while(!TXIF)
{
}
TXIF = 0;
};
Best of luck.
Regards.
 

Hi Waseem,
Thanks a whole lot. I do more than appreciate your help. Let me try this code. I'll get back to you after I've tried it .

regards, Rickylo
 

Re: PIC 16F877-TRANSMITTING & RECEIVING OF STREAM OF CHA

Hi there Waseem,

I am back again with help in programming the PIC 16F877 for my project. You helped with a code and I am wondering which compiler are you using? I am also wondering if you can help with how to integrate this code to let the second PIC (the receiver) pick up signals sent by the TX PIC
Regards,
 

Re: PIC 16F877-TRANSMITTING & RECEIVING OF STREAM OF CHA

Hi!
I m using Hitech PICC. The code is doing both the things i.e it is both recieving and transmitting the data. Write ur code such that the reciever always waits for data at the serial port and the transmitter transmits the data.
My advice is that first establish a direct communication between the pic's i.e connect the transmit pin(RC6) of one pic to the recieve pin(RC7) of the other pic (recieving controller). Once the direct communication is established then move to the radio link. By doing so u will at least know that the software is ok and the problem is only with the radio link.
If u still face problems then ask without hesitation.
Best of luck.
Regards.
 

Re: PIC 16F877-TRANSMITTING & RECEIVING OF STREAM OF CHA

Hi There,

Wish to express my appreciation again for your prompt help. Words can´t express how happy I am. I've been battling with this project since last August and now , because of you help I am now about to take off.
I´ll get in touch again after I´ve tried it.

Regards, Rickylo
 

Re: PIC 16F877-TRANSMITTING & RECEIVING OF STREAM OF CHA

Hi There Waseem,


I am back again with my problem. I tried downloading the demo version of the compiler you are using but could not get any better site that provides it so I am wondering if you wouldn't mind sending me the hex-file for the code so that I can try it. I know it would mean that you´ll have to modify the code to add stream of characters or to make it such that I can supply my own data through a specific PIN on the transmitting PIC.
If you´ll agree to supply the hex file or show me which site I can downoad the demo copy of the compiler, I´ll be grateful. I can send you my school email address so that you can send me any information.

I hope I am not asking too much.

Regards, Rickylo
 

Re: PIC 16F877-TRANSMITTING & RECEIVING OF STREAM OF CHA

Hi!
Sorry for being late for the reply.
You can download the demo version from Hi_tech site www.htsoft.com
They have got another version, picc lite which is free of cost. But first u will have to register urself at their site.
As far as the hex file is concerned i will try to compile the code but u will have to wait for 2-3 days since i m very busy.
Regards.
 

Re: PIC 16F877-TRANSMITTING & RECEIVING OF STREAM OF CHA

Hi Waseem,

Thanks for your response. I´ll try to download the compiler tomorrow. Sure, you send the hex file when you are less busy.

Regards, Rickylo
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top