LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple slaves


@RavensFan wrote:

Yes.  You can do reads and writes in the same VI.


The register I want to write to is a "Write Holding Register", function 06/16, and that includes "split" and single registers.

Can I use the "Write Multiple Registers"-function if I, mostly, will write to single registers? How much does it matter if I use the "Write Multiple Registers"-function or the "Write Single Register"-function?

0 Kudos
Message 31 of 41
(1,284 Views)

Yes you can use Write Multiple Registers even if it is writing to only a single register.  I don't think there is any advantage significant advantage of using one over the other for only a single register.

 

If they are not consecutive, then you definitely need to break it up into multiple Write functions.

0 Kudos
Message 32 of 41
(1,282 Views)

@RavensFan wrote:

Yes you can use Write Multiple Registers even if it is writing to only a single register.  I don't think there is any advantage significant advantage of using one over the other for only a single register.

 

If they are not consecutive, then you definitely need to break it up into multiple Write functions.


Alright, thank you.
I am trying to send a high and low byte. High=the code for the wanted unit, low=1 (execute command). They are set in an array, which are then merged and sent to register 36. Running this does not give me another unit on my output. Am I setting the Write-function wrong? 


0 Kudos
Message 33 of 41
(1,278 Views)

I don't understand what you mean by "running this does not give me another unit on my output".

 

What is "another unit"?  What is the output you are referring to?

 

The array manipulation looks just fine to me.  Just like you said in your note, of the  high vs. low byte order is wrong, then just swap the wires going into the Join.

 

 

0 Kudos
Message 34 of 41
(1,272 Views)

@RavensFan wrote:

I don't understand what you mean by "running this does not give me another unit on my output".

 

What is "another unit"?  What is the output you are referring to?

 

The array manipulation looks just fine to me.  Just like you said in your note, of the  high vs. low byte order is wrong, then just swap the wires going into the Join.

 

 


Sorry, the output I am referring to is the register I read, for example Temperature.

I am trying to change for example the Temperature, that is in Celsius, to Fahrenheit. But the conversion is never made when writing to the "change unit"-register and sending the high=1 and low=code for Fahrenheit (33).
I have tried to swap the hi/lo without luck..
Is it Ok to send high as a "1", or should I send it as hex?

0 Kudos
Message 35 of 41
(1,268 Views)

What values are you sending?

 

Your array in the VI was saved as a default of an empty array.  So nothing is being sent unless you have typed in those values before you run it.

 

There is no such thing as sending something as decimal or hex.  It just sends a byte of a certain value.  It is just a visual display to the programmer as to whether you want to visual that value on screen as hex or decimal.  And for the number one, it would look the same either way.  dec.1 = hex 1.   For larger values,  decimal 239 would look like hex EF.

 

And are you sure you are writing to the correct address?  You are talking about temperature and Fahrenheit vs.Celsius here.  On your front panel, you are talking about Bar, Pa, mmH20 which would all be pressure units.  I imagine they would be a different starting address than the temperature.

0 Kudos
Message 36 of 41
(1,261 Views)

@RavensFan wrote:

What values are you sending?

 

Your array in the VI was saved as a default of an empty array.  So nothing is being sent unless you have typed in those values before you run it.

 

There is no such thing as sending something as decimal or hex.  It just sends a byte of a certain value.  It is just a visual display to the programmer as to whether you want to visual that value on screen as hex or decimal.  And for the number one, it would look the same either way.  dec.1 = hex 1.   For larger values,  decimal 239 would look like hex EF.

 

And are you sure you are writing to the correct address?  You are talking about temperature and Fahrenheit vs.Celsius here.  On your front panel, you are talking about Bar, Pa, mmH20 which would all be pressure units.  I imagine they would be a different starting address than the temperature.


I just tried changing units for Temp (reg. 42) and Pres (reg. 36) in separate writes, which are in different registers yes. 

The values I send are (for setting perssure unit):
Starting addr.:36

Registers: Lo/hi - 1 and 239 (tried to swap these as well)

0 Kudos
Message 37 of 41
(1,259 Views)

Do any errors come back?

 

I'm not familiar with that equipment, so besides pointing out the things I see, there are no other ideas I have that point to the problem.  You're on your own unless the vendor can help.

 

Something you can try to see what is going on.  Snoop on the serial coms and see what messages are occurring.  NI IO Trace could help.  If they provide software of their own to communicate with the device, see if you can change it with that?  And if you can, use NI IO Trace to see if you can snoop on those serial commands and compare them to yours.  If NI IO Trace can't, then there are tools available on the web for monitoring serial ports.

0 Kudos
Message 38 of 41
(1,256 Views)

@RavensFan wrote:

Do any errors come back?

 

I'm not familiar with that equipment, so besides pointing out the things I see, there are no other ideas I have that point to the problem.  You're on your own unless the vendor can help.

 

Something you can try to see what is going on.  Snoop on the serial coms and see what messages are occurring.  NI IO Trace could help.  If they provide software of their own to communicate with the device, see if you can change it with that?  And if you can, use NI IO Trace to see if you can snoop on those serial commands and compare them to yours.  If NI IO Trace can't, then there are tools available on the web for monitoring serial ports.


No errors with the setup I have right now. The attached reg. says it will return 0 if OK and 8000 if an error occur - am I suppose to see one of these somewhere? 


Another question regarding the Write-function. If I want to try to write a Tag to a split register (see attached file) but there are no "Quantity" for the Write-function - how does that work?

0 Kudos
Message 39 of 41
(1,253 Views)

I tried the NI I/O Trace and I used the latest VI. Trying Reading/writing to one sensor, reading one sample (outer for-loop N=1) and having the Write button pressed (lit green). In the Write-function I sent array [11;1], 11 for Pa and 1 for execute, to Writing reg. 36. I also tried to send array [1;11] so see if the swap made any differences.

I have attached the log files from the NI I/O Trace - I dont really know how to read possible errors. The two log files don't differ much more than line 21, but that makes sense..
Can you see something weird?

 

 

0 Kudos
Message 40 of 41
(1,242 Views)