PIC to PIC serial communication

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

PIC to PIC serial communication

Postby MaxD » Sat May 12, 2012 5:32 pm

I'm doing a project that serial communication between PIC. I use a PIC 16f877a as master device and another PIC 16f877a as slave device. Also, I'm using MODBUS protocol in the communication. So, in the slave program code, for example, master want to read coil from slave then the slave need to response the status to the master.

My question is, in slave device, how to assign the coils of the ports to read whether it is ON/OFF(1/0)? If master only want to read PORTA & PORTB from the slave device.
MaxD
Newbie
 
Posts: 11
Joined: Thu Apr 26, 2012 10:51 am

Re: PIC to PIC serial communication

Postby shahrul » Sat May 12, 2012 7:52 pm

Modbus operate in address value or bit value. You can see example code here MODBUS.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: PIC to PIC serial communication

Postby MaxD » Mon May 14, 2012 5:27 pm

Shahrul, I'm not really understand your interupt code, can you briefly explain it? thank you. =)
MaxD
Newbie
 
Posts: 11
Joined: Thu Apr 26, 2012 10:51 am

Re: PIC to PIC serial communication

Postby shahrul » Mon May 14, 2012 10:18 pm

MaxD WROTE:Shahrul, I'm not really understand your interupt code, can you briefly explain it? thank you. =)

I don't know how to explain, better search on google for other explanation.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor


Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 19 guests