Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: ryanastiefes on December 19, 2014, 06:36:32 PM

Title: Problem with MHRx:RD registers
Post by: ryanastiefes on December 19, 2014, 06:36:32 PM
I am writing to my DM using the modbus protocol from an HMI. Using floating point registers (F40001, and F40003) I can write the registers MHR0:RD and MHR:2:RD). My problem is the number differs from what I putting in from my HMI and what is writing in the my DM.

Hardware is all up to date
Using Lookout 6.7 for HMI

Title: Re: Problem with MHRx:RD registers
Post by: Controls Guy on December 19, 2014, 08:29:48 PM
You have the "Off by one register plus wrong word order" issue you can get with floats

24.2456  -> 253,246,193,65 (byte values)
24.125   -> 0,0,193,65

981.2389 -> 74,79,117,68
983.8592 -> 253,246,117,68

(Note bytes 253 and 246 that are actually part of the first value are being interpreted as part of the second)

You'll definitely have to change word order on one end or the other.  Lookout is probably easier.

You won't be able to write to MHR0, and I don't think Do-More is going to let you cast 1&2 as a double because of alignment, so in addition to fixing the word order you're probably going to need to change Lookout to 2&4 and stop trying to use either 0 or 1 as part of a 32-bit write.

Title: Re: Problem with MHRx:RD registers
Post by: ryanastiefes on December 19, 2014, 09:03:39 PM
Thank you sir!