LabVIEWForum.de - Write MB reg

LabVIEWForum.de

Normale Version: Write MB reg
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Seiten: 1 2
Hi!
I have a digi. sensor that can measure for example temp. etc. It communicates over modbus rtu.
I am trying to write reg. 42 (write holding reg. / func 06/16) in order to change the temp. unit from C to F.
The register is 2 bytes and wants: lo=data, and hi=1.
I have tried to send arary [33;1] to the hi/lo-func and in to the MB Write-func., but this doesn't work. I have also tried [1;33]..
I wonder if I am suppose to send something like [0;33] and [1;0], but can't get it to work.. Some ideas?
I have attached the VI and what the reg. I am trying to write looks like.
Hi solaz,

welcome to the forum!

Zitat:The register is 2 bytes and wants: low byte=data (code for temp unit =33), and high byte=0x01 (run command).
I have tried to send arary [33;1] to the hi/lo-func and in to the MB Write-func., but this doesn't work. I have also tried [1;33]..
I wonder if I am suppose to send something like [0;33] and [1;0], but can't get it to work.. Some ideas?
The MODBUS function is expecting U16 data, when writing to registers.
It handles byte order internally, you don't need to do this on your own!

So why don't you send an U16 value of "0121" (in hex display!, or 289=1*256+33 in decimal display) to the register?
I just thought doing that way made it easier to see what data you are sending to the register.
Hi solaz,

I don't use those MB functions, but I heard there are sometimes different schemes of addressing registers: some drivers count starting from zero, other drivers start counting from one.
So when trying to set register 42 according to your manual did you try to write to register 41 or 43 in your VI? (Just guessing here…)
Yes. I have tried different indexing.
Okay, so, when I read the register 42 is gives me 33, which is the number I wrote to it - so it seems to work by sending [1;33]. But why can't I see this unit change in the data I receive? I still see it in C unit. Hmm.
Hi solaz,

we don't know your device nor did we read its manual!

So I can only guess: your device is accepting the unit change and uses that unit just for display purposes. Data transmitted over MODBUS are still using SI units (as they should be IMHO)…
Hi solaz,

according to your manual the SV is given in °C:
[attachment=59014]
- You said your device accepted the new SV unit according to your WriteReg command.
- You said your device still sends SV with unit °C, regardless of the unit you set…
Did you ask the manufacturer of the device about this behaviour?

And: did you check the return value of your WriteReg command? Do you receive an OK or an ERROR?
Offtopic2
(12.04.2018 12:10 )GerdW schrieb: [ -> ]according to your manual the SV is given in °C:
Which manual? Where is it?

Gruß, Jens
Correct. The temp. values are by default in C and doesn't change the values after the unit change.
I have sent an email and waiting for a reply.

From what I can see when Tracing the IO port I get a zero = success.
How can I see this in Labview?

(12.04.2018 12:10 )GerdW schrieb: [ -> ]Hi solaz,

according to your manual the SV is given in °C:

- You said your device accepted the new SV unit according to your WriteReg command.
- You said your device still sends SV with unit °C, regardless of the unit you set…
Did you ask the manufacturer of the device about this behaviour?

And: did you check the return value of your WriteReg command? Do you receive an OK or an ERROR?
Seiten: 1 2
Referenz-URLs