11-10-2010 11:10 AM
Hi Fellow LabVIEW users
In the block diagram of the posted VI, thru serial comm, Byte #2 Node Address is either 00 or 01 (Hex). How do I get the VISA to write both values together? In this way both Bank A and Bank B will show values (on the front panel) rather than either/or. Should I use a flat sequence structure to send the data?
How can I do this? I am fairly new to LabVIEW any feedback is highly appreciated.
Thanks
Mahir
11-10-2010 09:32 PM
No, there is seldom any reason at all to use a flat sequence structure for anything.
Will you want duplicates of each control so that different values are sent for each address? Then it's jusy a matter of copying everything and using a second VISA Write and Read connected to the first Write and Read with the error in/error out connections.
A problem that I see is that you are constantly writing and reading - even when the controls don't change. Better to use an 'update' button. You also should disable the termination character (VISA Configure Serial Port) since you are reading hex. Otherwise your read will terminate early. And I also wonder why you are using string controls instead of U8 numerics. Sometime, someone is going to enter an extra character. You have nothing to limit the data to a single byte.
11-11-2010 08:52 AM - edited 11-11-2010 08:54 AM
Thanks Dennis for your reply.
I am very new to LabVIEW, perhaps it is better for me to tell you exactly what I am try to achieve.
At some point in time I want to hardcode (maybe partially) the following hex commands.
1) 3A00 0000 0000 FFFF FFFF FFFF 0000 0000 FF00 0000 0000 0000 0000 0033 (For switching on "Bank A" to full power)
2) 3A01 0000 0000 FFFF FFFF FFFF 0000 0000 FF00 0000 0000 0000 0000 0034 (For switching on "Bank B" to full power)
3) 3A01 0000 0000 33FF FFFF FFFF 0000 0000 FF00 0000 0000 0000 0000 0067 (For putting "Bank B", Module 1 to 60% power)
.
.
.
.
.
.
.
.
and so on and so forth.
The string controls ( Byte #2 to Byte 28) should not be present to the user on the front panel. The front panel user should only be able to switch on both banks with all subsequent modules. The user essentially wants to monitor the "lamps" and "ballasts".
To implement this should I use an event structure with embedded case structures in a producer consumer loop to account for the variations in this code? I believe I still need to constantly write and read.
Could you please further clarfiy how to use the "update button" and what it should do for me. If I disable the "VISA configure serial port" how do I select which I/O COM to use?
Thank you again for all your help. Long live the LAbVIEW user community.
11-12-2010 10:31 PM
The idea of an update button is to use a case structure that actually does the reads and writes in the "Update" case, and the other case does nothing. As far as disabling the termination character in the serial config, you don't want to disable the entire serial config, just wire a False constant to the top right terminal. It is labeled "Enable Termination Char." This will make it so that you won't have a termination character sent in your data stream.
11-17-2010 07:42 AM
Hi Dennis
Could you please show the sequence in which the VISA write and reads can be connected?
Is it still beneficial to use the update button if the string changes every 4-5 mins?
Thanks
mhaque
11-17-2010 10:11 AM
I was thinking about an alternative approach. If I used the state machine/ producer consumer architecture I could break up the 28 byte string and send to one VISA write/read. Each state would represent a different scenario, for example a different node address, different power level for each module etc. Would it be possible to concatenate the strings and form a correct 28 bye string to be sent to the communications board thru RS-485? Also I can assume there needs to be some kind of a delay to send each variation of the string. How will the "update function" pair up against continuously sending the string to VISA?
Please look at attached VI. Any comments, suggestions will be helpful.