modbus for pic18f4550

Status
Not open for further replies.

naveen.kumar

Newbie level 4
Joined
Jul 3, 2013
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
37
hello guys,

I am stuck with the problem in modbus protocol.... i need working code for pic18f4550 to communicate with the PC...please help me out for the problem guys....thank you in advance....
 

hello,

give some datas to get help..

Modbus RTU or Ascii ?
PIC is the slave and PC master ?
What kind of software PC side ?
Serial RS232 link between PIC and PC ?
only one slave or multi slave ?


post your code !
 

thank you for your valuable reply.

sir i have freemodbus code where there is code for pic24

i am using RTU method
ya pic is slave and PC is master
there is no perticular software but i will use pickit3 for that purpose.
i m using RS485 for communication.
i m using multislave.

thanks in advance...
but if i get atleast basic code for pic18f4550 it ll be useful for me ....
 

I have no working code right now. But I work on modbus protocol. U follow following step which help u

1. First check hardware properly
2. Send fixed data say 123, abc etc to PC continously.
3. Recive data from PC & send it back to PC with Additional information.
4. Now decide required fuction for your application, device ID, no of register to be read or write, exception response in case invalid data etc as per Std protocol
5. Use CRC calculation routine which is easily get on internet
6. Now Send Query from PC & Send response from controller after confirmation of Device ID, function code, data length, CRC check.
7. After this insert delay between 3 character as well as frame etc as per std. define
 

Sorry for invoking old thread

@golden electronics
7. After this insert delay between 3 character as well as frame etc as per std. define

Can you please tell me why to insert delays and where it was mentioned to do so?

MicroCon
 

hello,

You can find on the web, a lot of document concerning modbus protocol ..(see also Jbus ! )
3 or 3,5 car !
 

Attachments

  • Modbus_1.jpg
    136.1 KB · Views: 126
  • Modbus_Description.pdf
    150 KB · Views: 96
Last edited:

hello,

You can find on the web, a lot of document concerning modbus protocol ..(see also Jbus ! )
3 or 3,5 car !

7. After this insert delay between 3 character as well as frame etc as per std. define
As I understood the poster says to insert delay between 3 characters. There is nothing in the document about this (even in the document what you sent).
 

is not delay between 3 car,but a delai after each modbus trame, this delai permit to others slave to give answer to master.Without this delay,the bus Rs485 is allways busy.
and it's concerne also time response delai to a request of master.
After,you can follow or not the protocole.
it is YOUR choice.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…