INFO: Dieses Forum nutzt Cookies...
Cookies sind für den Betrieb des Forums unverzichtbar. Mit der Nutzung des Forums erklärst Du dich damit einverstanden, dass wir Cookies verwenden.

Es wird in jedem Fall ein Cookie gesetzt um diesen Hinweis nicht mehr zu erhalten. Desweiteren setzen wir Google Adsense und Google Analytics ein.


Antwort schreiben 

Write MB reg



Wenn dein Problem oder deine Frage geklärt worden ist, markiere den Beitrag als "Lösung",
indem du auf den "Lösung" Button rechts unter dem entsprechenden Beitrag klickst. Vielen Dank!

11.04.2018, 09:34 (Dieser Beitrag wurde zuletzt bearbeitet: 14.04.2018 22:26 von solaz.)
Beitrag #1

solaz Offline
LVF-Neueinsteiger


Beiträge: 9
Registriert seit: Apr 2018

2016
-
EN



Write MB reg
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.


Angehängte Datei(en) Thumbnail(s)
   

16.0 .vi  write_problem.vi (Größe: 91,3 KB / Downloads: 203)
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren to top
11.04.2018, 09:45
Beitrag #2

GerdW Offline
______________
LVF-Team

Beiträge: 17.398
Registriert seit: May 2009

LV2021
1995
DE_EN

10×××
Deutschland
RE: Write MB reg
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?

Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren to top
11.04.2018, 10:01 (Dieser Beitrag wurde zuletzt bearbeitet: 14.05.2018 17:43 von solaz.)
Beitrag #3

solaz Offline
LVF-Neueinsteiger


Beiträge: 9
Registriert seit: Apr 2018

2016
-
EN



RE: Write MB reg
I just thought doing that way made it easier to see what data you are sending to the register.


Angehängte Datei(en) Thumbnail(s)
   
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren to top
11.04.2018, 10:17
Beitrag #4

GerdW Offline
______________
LVF-Team

Beiträge: 17.398
Registriert seit: May 2009

LV2021
1995
DE_EN

10×××
Deutschland
RE: Write MB reg
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…)

Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren to top
11.04.2018, 10:25 (Dieser Beitrag wurde zuletzt bearbeitet: 14.05.2018 17:42 von solaz.)
Beitrag #5

solaz Offline
LVF-Neueinsteiger


Beiträge: 9
Registriert seit: Apr 2018

2016
-
EN



RE: Write MB reg
Yes. I have tried different indexing.
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren to top
12.04.2018, 08:03 (Dieser Beitrag wurde zuletzt bearbeitet: 14.04.2018 22:27 von solaz.)
Beitrag #6

solaz Offline
LVF-Neueinsteiger


Beiträge: 9
Registriert seit: Apr 2018

2016
-
EN



RE: Write MB reg
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.
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren to top
Anzeige
12.04.2018, 08:12
Beitrag #7

GerdW Offline
______________
LVF-Team

Beiträge: 17.398
Registriert seit: May 2009

LV2021
1995
DE_EN

10×××
Deutschland
RE: Write MB reg
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)…

Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren to top
12.04.2018, 12:10 (Dieser Beitrag wurde zuletzt bearbeitet: 12.04.2018 12:10 von GerdW.)
Beitrag #8

GerdW Offline
______________
LVF-Team

Beiträge: 17.398
Registriert seit: May 2009

LV2021
1995
DE_EN

10×××
Deutschland
RE: Write MB reg
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?

Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren to top
12.04.2018, 12:19
Beitrag #9

jg Offline
CLA & CLED
LVF-Team

Beiträge: 15.864
Registriert seit: Jun 2005

20xx / 8.x
1999
EN

Franken...
Deutschland
RE: Write MB reg
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

Wer die erhabene Weisheit der Mathematik tadelt, nährt sich von Verwirrung. (Leonardo da Vinci)

!! BITTE !! stellt mir keine Fragen über PM, dafür ist das Forum da - andere haben vielleicht auch Interesse an der Antwort!

Einführende Links zu LabVIEW, s. GerdWs Signatur.
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren to top
12.04.2018, 12:22 (Dieser Beitrag wurde zuletzt bearbeitet: 14.04.2018 22:28 von solaz.)
Beitrag #10

solaz Offline
LVF-Neueinsteiger


Beiträge: 9
Registriert seit: Apr 2018

2016
-
EN



RE: Write MB reg
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?
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren to top
Antwort schreiben 


Gehe zu: