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

analog value to MODbus to send.

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



Joined: 03 Dec 2005
Posts: 182
Location: Australia SA

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

analog value to MODbus to send.
PostPosted: Sat Mar 10, 2007 4:46 am     Reply with quote

I have been toying with MODbus and having trouble with applying an analog value to send via MODbus .

yes obtaining the analog read is OK, it is how to apply the input and input value to the MODbus LAN???

ie if input_1_value = Read_ADC();

How do I assign input_1_value to the modbus LAN.

from example code:
"modbus_read_discrete_input_rsp(MODBUS_ADDRESS, 0x01, &data);" is data the value for input_1_value or is there another method to use. Confused

same with "modbus_read_holding_registers_rsp(MODBUS_ADDRESS,(modbus_rx.data[3]*2),hold_regs+modbus_rx.data[1]);"
is hold_regs+modbus_rx.data[1] the value of input_1_value?? Confused

Andrew
_________________
What has been learnt if you make the same mistake? Wink
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Re: analog value to MODbus to send.
PostPosted: Sun Mar 11, 2007 3:51 pm     Reply with quote

Storic wrote:
I have been toying with MODbus and having trouble with applying an analog value to send via MODbus .

yes obtaining the analog read is OK, it is how to apply the input and input value to the MODbus LAN???

ie if input_1_value = Read_ADC();

How do I assign input_1_value to the modbus LAN.

from example code:
"modbus_read_discrete_input_rsp(MODBUS_ADDRESS, 0x01, &data);" is data the value for input_1_value or is there another method to use. Confused

same with "modbus_read_holding_registers_rsp(MODBUS_ADDRESS,(modbus_rx.data[3]*2),hold_regs+modbus_rx.data[1]);"
is hold_regs+modbus_rx.data[1] the value of input_1_value?? Confused

Andrew


I think the most important part of your post is that you wish to read an analog value from a discrete input. Discrete means data bit.

MODBUS specification suports 4 standard data types
1) Holding registers, INT16 Read/Write
2) Input Registers, INT16 Read Only
3) Discrete Inputs INT1 Read Only
4) Discrete Outputs INT1 Read/Write
Storic



Joined: 03 Dec 2005
Posts: 182
Location: Australia SA

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

Re: analog value to MODbus to send.
PostPosted: Mon Mar 12, 2007 6:37 am     Reply with quote

Neutone wrote:

I think the most important part of your post is that you wish to read an analog value from a discrete input. Discrete means data bit.

MODBUS specification suports 4 standard data types
1) Holding registers, INT16 Read/Write
2) Input Registers, INT16 Read Only
3) Discrete Inputs INT1 Read Only
4) Discrete Outputs INT1 Read/Write

from the above Can I assume that discrete input is reading either on or off ("1"or"0") and the input register is 16 bit data. will this mean that I can have the analog value converted to a digital Input Registers (16bit).

if this is the case then do I assign the input register the analog value (in bit form) and the discrete input the input assigned to the input register.

Andrew
_________________
What has been learnt if you make the same mistake? Wink
magnoedu



Joined: 29 May 2009
Posts: 11

View user's profile Send private message MSN Messenger

help-me
PostPosted: Thu Jun 25, 2009 11:29 pm     Reply with quote

I have same problem but it seems still not learned to get accurate value ad in this matrix and write
Code:
int16 hold_regs [] = (0x8800, 0x7700, 0x6600, 0x5500, 0x4400, 0x3300, 0x2200, 0x1100);

I'm trying so
Code:
hold_regs [0] = Read_ADC ();

I wanted to know if and when you do please help us.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Jun 25, 2009 11:36 pm     Reply with quote

Holding registers are mainly intended as analog output register and for values, that are updated from both sides.
They must be supposed to be overwritten by the master at any time. ADC values should rather go to input registers.
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