Twido Modbus

J

Thread Starter

jalahezc

TwidoSwite, having problem reading multiple registers, I am only able to read four registers regarding of the number I input.

Please see below code, can someone please explain what is wrong?

LD 1

[ %MW20 := 16#010F ]
[ %MW21 := 16#0300 ]
[ %MW22 := 16#0203 ]
[ %MW23 := 16#0292 ]
[ %MW24 := 16#000C ]
LD 1
AND %MSG2.D
[ EXCH2 %MW20:11 ]
LD %MSG2.E
ST %Q0.0

I know this is also probable an easy question, but so far I have not been able to find the bug.

Also, what it would be the easiest way to send multiple read command to the same slave, since I am only able to ready 12 registers per command.
 
> TwidoSwite, having problem reading multiple registers, I am only able to read four registers
> regarding of the number I input.
>
> Please see below code, can someone please explain what is wrong?
>
> [ %MW20 := 16#010F ]
> [ %MW21 := 16#0300 ]
> [ %MW22 := 16#0203 ]
> [ %MW23 := 16#0292 ]
> [ %MW24 := 16#000C ]
> LD 1
> AND %MSG2.D
> [ EXCH2 %MW20:11 ]
> LD %MSG2.E
> ST %Q0.0
>
> I know this is also probable an easy question, but so far I have not been able to find the bug.
>
> Also, what it would be the easiest way to send multiple read command to the same slave, since
> I am only able to ready 12 registers per command.

This is relevant to something I am trying to achieve - I cannot seem to figure out though where exactly the returned data appears in the physical memory. For example I am trying to do the following which is read register 2130 on an energy meter configured as a slave using modbus (plenty of comments in there should explain some of what should be going on?):

(* SETTING DESIRED MEMORY WORDS TO SETUP MODBUS COMS*)
(* MW0:030F = RECEIVE 16 BYTES WHICH IS 1 INTEGER*)
(* %MW1:0000 = NO OFFSET OR DATA DELETE FOR RECIEVED DATA *)
(* %MW2:0852 = REGISTER 2130 IN SLAVE HOPEFULLY*)
(* %MW3:0010 = FIRST WORD ADDRESS IN SLAVE REFERENCED HOPEFULLY*)
(* %MW4:000F = READ 16 BYTES HOPEFULLY WHICH ON 16 BIT PROCESSOR SHOULD = 1 SIGNED INTEGER*)

[ %MW0 := 16#030F ]
[ %MW1 := 16#0000 ]
[ %MW2 := 16#0852 ]
[ %MW3 := 16#0010 ]
[ %MW4 := 16#000F ]
(* ERROR CHECKING*)
LD 1
AND %MSG1.D
(* PERFORM MODBUS READ FUNCTION TO RETURN FRAME 10 WORDS LONG*)
(* USE RETURNED VALUE WHICH SHOULD HAVE ADDRESS OF %MW7 (MW4 + 3 POSITIONS DOWN IN STACK AS PER MODBUS DATA DEFINITION *)

(* [ EXCH1 %MW0:10 ]*)

I cannot find the returned data though for some reason - is it not in %MW7 like I think it should be?
 
Top