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 support@ccsinfo.com

EC2 Illegal Data Address

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



Joined: 16 Sep 2011
Posts: 3
Location: INDIA

View user's profile Send private message

EC2 Illegal Data Address
PostPosted: Fri Sep 16, 2011 2:07 am     Reply with quote

Hi Everybody!

I got CCS complier couple of weeks back and was trying to implement the sample code provided along with the complier. I tried using ex_modbus_slave.c with following configuration:

Code:


#define USE_WITH_PC 1
#include <18F4520.h>
#fuses   HS, NOWDT, NOPROTECT
#use     delay(clock=4M)
#define MODBUS_TYPE                       MODBUS_TYPE_SLAVE
#define MODBUS_SERIAL_INT_SOURCE          MODBUS_INT_RDA
#define MODBUS_SERIAL_RX_BUFFER_SIZE      64
#define MODBUS_SERIAL_BAUD                9600
#define MODBUS_SERIAL_RX_PIN              PIN_C7   // Data receive pin
#define MODBUS_SERIAL_TX_PIN              PIN_C6   // Data transmit pin
#define MODBUS_SERIAL_ENABLE_PIN   Pin_C5
#define MODBUS_SERIAL_RX_ENABLE    Pin_C5

#include <modbus.c>

#define MODBUS_ADDRESS 01


and configured modbus viewer with following configurations:

Master/Slave : Master
Binary/RTU : RTU
Adress : 1
comp port : Active

with these configuration I'm not getting proper feedback from slave:

My transmit data is [01][03][00][00][00][64][44][21]
received data is [01][83][02][C0][F1]

and status displays EC2 Illegal Data Address

what should be done??

the complier version is 4.124

thank you:
MD
pic_MD



Joined: 16 Sep 2011
Posts: 3
Location: INDIA

View user's profile Send private message

PostPosted: Fri Sep 16, 2011 10:03 pm     Reply with quote

No replies yet?? :(
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sat Sep 17, 2011 4:00 am     Reply with quote

Quote:
what should be done??

Consider the address range provided by ex_modbus_slave. Holding registers have addresses 0 - 7, your test accesses 0 - 99 (register numbers 1 -100).

More generally:
- Get the MODBUS Application Protocol Specification from modbus.org and learn how the protocol works.
- Analyze the ex_modbus_slave code to understand what it's doing and how the exception is brought up
pic_MD



Joined: 16 Sep 2011
Posts: 3
Location: INDIA

View user's profile Send private message

PostPosted: Mon Oct 10, 2011 2:54 am     Reply with quote

Hi,

I got modbus working! however when I try to put more data through holding register I get a garbage value.
I did increase the length from 8 to 32.
My data is as follows:
Code:

 hold_regs[i]=f;   ///pow(10,dec[i]);
          hold_regs[8]=20;
          hold_regs[9]=40;
          hold_regs[10]=20;
          hold_regs[11]=40;
          hold_regs[12]=20;
          hold_regs[13]=40;
          hold_regs[14]=20;
          hold_regs[15]=40;
          hold_regs[16]=20;
          hold_regs[17]=40;
          hold_regs[18]=20;
          hold_regs[19]=40;
          hold_regs[20]=20;
          hold_regs[21]=40;
          hold_regs[22]=20;
          hold_regs[23]=40;


My first 8 values are process values, but I don't get all the above values on holding resister! Embarassed What should be done! Please help.
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