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.

modbus communication with pic18F4520

Status
Not open for further replies.

srjth.m1

Full Member level 3
Joined
Aug 6, 2012
Messages
157
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,298
Location
India
Activity points
2,126
I want to communicate with my pic with pc using MODBUS here my pc is acting as a master and mcu as slave am using flowcode software and max485 as driver my problem is that when am connecting the terminals mcu sending 255 to computer,i want to send some other data,how can i make 4 registers of modbus in program?
 

Hi,
I have worked with modbus. But i did not understand what you are trying to say. Can you please elaborate. It will be good if you attach your program here.
 

you know about Registers of modbus am asking how to implement those in program?
 

Ya as you are doing, i have also used the PC as a master with a modbus software running on it and communicate with the slave devices. The software contains some four options 1. Input status 2. Input register 3. Output status 4. Output register.
For each case there should be a packet format and after receiving it, slave will update it's output value or reply it's input value to master.
 

can you send me the slave code ? pls tell which software you used?
 

Sorry i dont have the coding for that one. The application software is i think modscan32 like that. May be google it.
 

anybody can able to help me about the entire topic??
 

Hi,
In your microcontroller you choose any two ports say port A and configure it as input and Port B and configure it as output.
There should be some slaves know and all should be in receive mode initially.
When the PC modbus application sends the packet which addressing a slave
a. for its input value, then that particular slave will change to transmission mode and reply the packet with port A input value for the query and then it will back to receive mode.
b. for its output value, then the particular slave will change its port B value based on the received value.

The packet details are available in wiki itself if you search for modbus communication. I meant the above for the packet in RTU frame format.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top