Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Search function from write visa

Hi,

     I need to write commands to serial device(USB to I2C) that will control the SMPS by PMBus protocol. My command is look like 108812(in hex) i.e. 10 is device address 88 is for representing command code for input voltage reading and 12 is some times writing the value to device. First, I need to make a search function for finding the available devices and should display in drop down list(PMbus address indicator). All the addresses are start from 0 to 127 and I was thinking to take for loop and writing each address one by one to serial port and displaying the available addresses in drop down list and after It should work like if any address is selected(showing the parameters of one device) and then it will write the remaining command to serial device it will display the particular device status. How can write these all to write VISA and displaying the results all time.

 

Please Some one help me.

0 Kudos
Message 1 of 19
(4,016 Views)

Hi,
Please some one suggest me how can I do the following thing with only one write visa.
First problem
-----------------
I want to make a search function that will send all the address to serial device and reply with avalible addresses. My address consists of 7 bits which may be lies in between 0 t0 127. So, I need to send these all address one bye one and wait for reply of each address weather it is available or not. If so. then display the available address in dropdown list(PMBus address). I have a idea that take a for loop and impleting this.
Second problem
----------------------
After displaying all the available addresses in drop down list. User can select any of the address(that means he is writing to particular device) and able to send commands to the particular device. So, if he select the paricular address(like 10 or 22) then I want write reaming commands to that device.
Third problem
-------------------------
I have write(under regulated checkbox in my code) and read(under tab control) commands to serial device. Reading always should to run to get the values. Writing must be done when user enters the value in control and after clicking the send button.

At the moment i am writing whole command at a time like 1088(10 representing address and 88 representing command).

I don't know how to write these many thing always to one write visa. Please, some one help me with the provided code below and I am using labview 8.5
Thank you.:mansad:

0 Kudos
Message 2 of 19
(4,004 Views)

Oh my dear, Got strucked and crying for relife. Please some one help me:mansad:

0 Kudos
Message 3 of 19
(3,996 Views)

You did not pay much attention to the other suggestions in your original thread so I doubt that you will pay much attention here but I will give it a try.

 

Problem one/two - You will have to write this yourself. You have not made an attempt and you have not posted the instrument manual. I would do this task before entering the while loop. Use the addresses found to populate the combo box. You do this by writing to it's Strings[] property.

 

Problem three - Your existing architecture is just plain wrong. I would recommend just having the existing event structure but placing a VISA Write inside each. Currently, the code in the event structure does absolutely nothing. Place the code where you do the read inside the timeout event.

 

0 Kudos
Message 4 of 19
(3,989 Views)

Can you guide me bit clear then I will try my self by doing things. I want to write addresses to the device for selecting available devices. I will take a for loop and and write 0 to 127 values to port one by one and take the reply and display the available address in combo box but Its is confusing me always that how I can write these many times to write visa. After displaying the addresses user can select any address and add this address to the command always. Messed up with all these writing things.

0 Kudos
Message 5 of 19
(3,985 Views)

Not much different than the for loop you already have except you would pass an address to the write. If it's 0 to 127, set the for loop to iterate 128 times (wire 128 to the 'N') and create the address from the iteration terminal ('i'). You will have to determine from the VISA Read whether the address is valid or not. I have no clue because you have not provided any information on that.

0 Kudos
Message 6 of 19
(3,981 Views)

Sorry Dennis, The problem is my instructor also do not gave me the hardware. He just virtually told me and I am bit shy person to ask. So, I would follow him by doing this. I will make that search function but how I can write commands later after this to same write visa with selected address as high databyte.

0 Kudos
Message 7 of 19
(3,975 Views)

Now, I changed my total code to event structures. Though, I have some errors and couldn't solve it.

First problem is I can't wire to close visa and it arises error.

In second event case currently I am writing command like 1088(here 10 is address) but I want to make if first case runs and displays all the available addresses user can select the any address and it should replace the existing address and write to port.

In Third event case, I would like to write user entered data to port by appending the data to existing command in String concatenation. In this case also selected address should replace the existing address always.

Please any one should suggest me. Thank you.

0 Kudos
Message 8 of 19
(3,952 Views)

Please some suggest me weather above VI is going in right way and solving the existing errors. Please, I am trying hard to finish things.

0 Kudos
Message 9 of 19
(3,946 Views)

Hi,

    I just changed my code to event cases. The third event case has problem that i want write all the control values to serial device by user entered data in respective control. How can write all the user data to serial device in thirdcase. i want to like if user enter any data in nay control and after clicked send button then it has write only that values should write reading agine should come and display same controls from where I have written(in this case i will take local variables of that controls.) Please suggest me how can I do the process.

0 Kudos
Message 10 of 19
(3,926 Views)