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.

RS485 communications between two 16F876 PICs

Status
Not open for further replies.

hexviper

Newbie level 3
Joined
Dec 4, 2009
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Michigan
Activity points
1,306
While there are many posts related to communication between PICs I am unable to find clear code (prefer basic since I am new) that would help me understand how to accomplish successful communication.

The circuit I am working on is really quite simple.

The master PIC populates a variable with a pulsewidth value and I would like to pass the numeric value (between 1 - 65) to the slave PIC via RS485.

The master should only send when the slave is ready for new data.

Both PICs are using a 4MHz xtal and the distance between PICs is no more than 50ft.

Once I have managed successfully communicate between both PICs, I will be happy to post the code and schematics of this project for others to use.

Any help would be greatly appreciated.
 

what language are you using MPASM, CCS C etc.??
 

arbj -

I'm using PICBasic Pro 2.43 within MPLAB IDE.

Since I'm new to the PIC, I decided to start with PICBasic.

Also, I should mention that I am interfacing the two PICs with MAX487E. Just happened to have these on hand. Same pinout and functionality as the MAX485.

Thanks for replying.
 

Hi

Are you looking for full duplex RS485 or half duplex?

for half duplex network use MAX485 as drivers & receivers to interface the network
from the hardware point of view

use 1 I/O line from the PIC as the Tx & RX select line for the MAX485 transceivers
and PIC uart TX for & PIC uart RX for RX

All slave in the network must be in listen state and only the master can ask a slave whether he is free to receive data whether the slave is ready the master can autorize him to switch from TX to RX state for an answer

All the best

Bobi

The microcontroller specialist
 

bobcat1 -

I am usng half duplex as follows:

16F876 for master and slave with MAX487E interface.
RC7 as Receive, RC6 as transmit and RC5 as I/O control.

From a harware perspective, I think I have everything everything I need, however, the code is what eludes me. I've tried several methods without success.

With a pulsewidth measurement taking place every 500ms on the master. I am trying to send the numeric value stored in variable, to a variable on the slave side to be processed. The slave is then ready for the next value from master.

Thanks for the reply. I do appreciate the help.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top