LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Making individual Vi's?

Solved!
Go to solution

Well right now, my "different" Vi's for each command are simply

Input Address

Command CST String

Input Value

 

And i have a simple concatenate to merge them all and send them to 1 write and read command (with a True or False switch to turn this on and off).

 

The real problem is that they each have different outputs, which is why I want a multitude of VI's. But that will cause me to have a large case structure, which is annoying. I'm hoping I can find a way to simply call the right function based on the nature of the command I'm sending (this is where I beleive OO kicks in as mentionned above) I'm looking at OO programming right now to see if I can fix this problem. 

0 Kudos
Message 11 of 22
(992 Views)

What do you mean different outputs? Do you mean a different data type and/or connector pane?

=====================
LabVIEW 2012


0 Kudos
Message 12 of 22
(988 Views)
And where are you placing this case structure, and why?
0 Kudos
Message 13 of 22
(984 Views)

Well if you open the spreadsheet I have attached (There are no macros by the way - incase you don't like opening spreadsheets...) you can see the commands I need to be able to use on demand.

 

You'll notice some of their Response (what I will end up reading after a write) are strings while others are numbers (nnnnnnnn is a number whiel *R is a char output for example).

 

You'll also notice the syntax to write to my device (RS 232 btw), is

<a> = address,

XXX = String

nnn = number

with some of the commands using all and others using only a few of these instances. (Reset for example is a simple % while setting the Distance is more complex). 

 

 

For writing, I could use one write to RS232 function with a bunch of unbundles, and concatenate. By this I mean, % would be represented as _%_\r\n

And become %\r\n when I write while Buffer Status Command would become 1BS\r\n

 

For post-reading however, I'll need to operate on the output on a case by case fashion. Depending on what I write, a different data type will come out of device. I'll need to account for that to read and convert appropriately. I could hardcode this, with just a case for each different type of output and bundle a True/False with my command about the data type of the output. That would work I guess.

 

 

 

0 Kudos
Message 14 of 22
(976 Views)

This is probably very trivial... I've already worked with RS232 and I'm confortable with all the reading and writing, as well as the bundling. case structures and property nodes. I just had 10 commands when I communicated to another device so didn't feel the need to not hardcode it.

 

0 Kudos
Message 15 of 22
(971 Views)
Your architecture makes no sense. Did you look at the driver guidelines? Did you look at any similar drivers? Did you look at the 34401 example? If you have a single VI for each function, there is no need to complicate things with case structures. If it returns data, add a VISA Read. If returns a numeric value, convert it. You seem to be bouncing back and forth between generic and specific. You certainly don't need 70 VIs if you do generic reads and writes.
0 Kudos
Message 16 of 22
(962 Views)

"If it returns data, add a VISA Read."

 

You mean with a property node that checks if there are bytes at port? Yeah that works lol. I'm stupid.

 

"If returns a numeric value, convert it"

 

How can I check if it's a numeric value? Unless I preembed a true or false value in the initial cluster containing in part my data to write.


 



 

 

0 Kudos
Message 17 of 22
(959 Views)

On driver guidelines.

 

I need to send a simple ASCII command through RS232. I've done it using the basic read write and I'm getting correct response, now I'm just moving on to getting the commands to do it on call through an array.

 

 

0 Kudos
Message 18 of 22
(957 Views)
Based on the description of each command in the manual, you absolutely know which command returns data and you absolutely know which strings need to be converted to numerics. I don't see where any cluster or Boolean is necessary.

The basic example is a poor choice to base your driver on.
0 Kudos
Message 19 of 22
(951 Views)

Unfortunately, that is the limit of my knowledge. I've been using the basic Write and Read and expanding it.

 

How would you suggest I go about it?

 

What I'm doing is essentially sending in a cluster of data (Address + CMD + Numerical). Then concat, and then sending it to write. Based on what the cmd is, I use a case statement to convert what is read.

 

Is that not the best way to do it?

 

:S

 

Which example should I use to guide myself?

 

Thanks again by the way. I'm still learning!

 

0 Kudos
Message 20 of 22
(939 Views)