View previous topic :: View next topic |
Author |
Message |
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
Modbus example not working |
Posted: Mon May 23, 2011 11:36 pm |
|
|
Hi,
I'm trying to implement Modbus protocol for quite sometime now, and not yet successful.
So, I made the connections to check if my RS485 is working.
I wrote this following program to check RS-485 connections are proper.
Code: |
#include <18F452.h>
#device ADC=16
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,ENABLE=PIN_C5,STREAM=PC)
#include <rs485.c>
void main()
{
rs485_init();
printf("hello world");
} |
It is working properly. But Now, I'm trying to implement the modbus communication example, given with the complier. It is not responding.
Please help. thank you.
Sid |
|
|
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
RE: |
Posted: Tue May 24, 2011 1:24 am |
|
|
MODBUS uses 9600 baud or 19200 as a standard ??
thanks
a |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9229 Location: Greensville,Ontario
|
|
Posted: Tue May 24, 2011 7:23 am |
|
|
WHICH Modbus 'standard' ??
WHICH Modbus device ???
Google ???? |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Tue May 24, 2011 9:48 am |
|
|
MODBUS is a protocol and does not have a standard speed. I currently
support systems that use MODBUS at many different speeds from 1200 up.
I don't know if you need RTU or ASCII mode.
RTU mode in the MODBUS protocol requires EVEN parity where you are
currently defaulting to odd. The full standard is at the following link. I
recommend you do some reading.
http://www.modbus.org/specs.php _________________ Google and Forum Search are some of your best tools!!!! |
|
|
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
|
Posted: Tue May 24, 2011 10:28 pm |
|
|
Well, I was looking forward to simply see how the example (Ex_modbus_Slave.C) provided with the compiler works.
But I wasn't getting any results. Is there anything wrong with the example?
I'm using Modbus Poll software at the PC end as my Master.
Regards,
Sid |
|
|
|