LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Serial Misery....

Solved!
Go to solution

Zac_Acal wrote:

I can't see an output wire from my event structure.

 

the visa name and error wires are T'd off into the event structure but still go to the read part of the code irespective of the event structure (don't they?)

 

Yes i do need to learn more about data flow, and i'de like to attend the labview courses etc.... but right at this moment, sat in the lab at a quarter to six on a friday night i just wan't to get this bl**dy thing working....

 

Thanks


My mistake, I was writing that from memory. Yes, there is no wire from your event structure but an event structre will always wait until an event has occurred. You could use the timeout event (wire a value to the little hour class in the upperl left corner of the event structure) and then the event structure will complete if nothing happens in x amount of time. However, I don't think this would entirely solve what you are trying to do, at least not if you want the code following the event structure to always be running without an event occuring.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 11 of 36
(2,024 Views)

Yes your right,

                        i've just tried a small time out and it does allow the recieve part to exicute, but it seems to be a bit hit and miss weather i get any data back from the micro or not...

 

I think i will do away with the event structure then at least i know the exicution isn't hanging any where.

                   

0 Kudos
Message 12 of 36
(2,018 Views)
I think you should keep the event structure and get rid of everything else. You can simply place the Write (WE) and Read in the timeout event. The stop button should also have an event. Having the flush buffer being run with each iteration seems to me to be wasteful.
0 Kudos
Message 13 of 36
(2,010 Views)

Dennis Knutson wrote:

Broken Arrow,

 

Will that work? If the first check of the number of bytes is 0, that will be passed through the shift register. If the instrument still has not responded with the second read, the loop will terminate.


My example didn't have any safety valves in place. Check this out. It makes sure there's more than 0 bytes, and it'll timeout if 0 bytes remains. I've used this for years (but working from memory, I don't have my libs here). The timeout is empirical, however, so not ideal.

Richard






0 Kudos
Message 14 of 36
(2,000 Views)

Thanks broken arrow, i can't get it to work, it just recieves 0.

 

I will try dennis's soloution now....

 

Thanks guys,    (yes i'm still at work Smiley Indifferent

0 Kudos
Message 15 of 36
(1,984 Views)

It seems like a neat soloution but it also just recieves 0. Ni spy shows the buffer flush, the send WE, and the recieve 0  (not sure what the getAtribute is)

 

 

nispy.jpg

0 Kudos
Message 16 of 36
(1,980 Views)
I'm wrong, it is reading the data, just that it clears the front pannel display streight after...
0 Kudos
Message 17 of 36
(1,979 Views)
Solution
Accepted by topic author Zac_Acal

It will only be cleared if you read zero bytes and the solution to this has been already discussed.

 

Use a shift register and the concantanate string function if you want the sting indicator to show previous and current readings. You could use arrays or charts to show a history of the numerics.

 

p.s. The wait function in the timeout event should be removed. It does nothing.

 

And place your controls in the events that you have assigned for them, remove the 450 msec wait, and create an event for the stop button.

Message Edited by Dennis Knutson on 03-19-2010 01:50 PM
0 Kudos
Message 18 of 36
(1,974 Views)

Well it seems to be working great ! ,   i can go home now (and its only 08:20PM) allthough i have some hardware mods to do....

 

Thanks for all your help guys, the idea of putting everything into the event case has really neatened up the code too !

 

Thanks, Zac

0 Kudos
Message 19 of 36
(1,952 Views)

Oh yea here's the final attempt :

 

 

 

0 Kudos
Message 20 of 36
(1,951 Views)