CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Modbus example not working

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Sid2286



Joined: 12 Aug 2010
Posts: 119

View user's profile Send private message

Modbus example not working
PostPosted: Mon May 23, 2011 11:36 pm     Reply with quote

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

View user's profile Send private message Send e-mail

RE:
PostPosted: Tue May 24, 2011 1:24 am     Reply with quote

MODBUS uses 9600 baud or 19200 as a standard ??

thanks
a
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue May 24, 2011 7:23 am     Reply with quote

WHICH Modbus 'standard' ??

WHICH Modbus device ???

Google ????
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Tue May 24, 2011 9:48 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue May 24, 2011 10:28 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group