Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

visa bulk read problems

Im trying to connect my PSoC 5 to labview via VISA USB, I have the drivers and everthing working fine. I started with the bulk.vi example and am able to transmit data and then mirror that same data back. my problem comes when I try and generate my own data. Im trying to write string data as uint8, I can tell that the VISA Read is seeing something when I send my data and then click the Bulk In button becuase if I dont send my data and press bulk in the program errors. Its almost like the read function is reading null.

 

any help would be great, im not super proficient with software in general but ill try and give you any more info you need.

Thanks

0 Kudos
Message 1 of 3
(3,396 Views)

Hello Pathare!

 

I have a few quick questions that might help shed some light on the situation. Just to verify, you are using the USB RAW - Bulk.vi example, and when you run it as is (by connecting to your PSoC 5) it works fine by writing and reading the default *IDN? command? And when you modify the "Bulk Write Data" control to a uint8 type instead of a string control the data doesn't show on the "Bulk Read Response" ?

 

How many digits of data are you trying to write to the device? Can you cast the uint8 value to a string value and see if that helps? Does the PSoC 5 take integer commands or string commands?

 

  

Regards,

John H.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 3
(3,373 Views)

Thanks for the reply JustJohn!

 

So I am using the USB Raw bulk vi, but I dont use the default text in the box. I typically send something like "AA" or some short string of characters. Through further testing ive found a string of 3 is the most reliable to read on the PSOC side using a strcmp function. Ive also somehow voodooed in to being able to read data back in labview, my assumption so far is that I have to write data before I can read data in labview.

 

the test I was using for basic writing and reading was using bools LEDs and switches, I would use the bulk out function to send "AA" and strcmp in an if statement on the PSOC and if it was correct turn on an LED on the PSOC. then I started using a pushbutton on the PSOC to try the other way, write some two to three letter string and press the pushbutton then use bulk in on labview.

 

at this point if I bulk out any string I can press a button and bulk in. I have some framing issues with reading on labview that I havent figured out yet. If I place an indicator on the output of the VISA read function I can see that the string comes through but if I send say "BO\n" it will read "B\nO" or some variant of the three.

 

On the PSOC side the variable are all uint8 that are being typecasted while its string comparing I think. I dont know how to change the VISA functions to accept anything other than strings though.

 

Thanks for your help, I have been able to work around my problems for the most point. I can now control servo motors by clicking buttons on labview. I'd really like to know why the transfer seems to be limited to about three characters and what I can do about the framing on reads in labview.

 

on the PSOC side I created the USB buffer to be 64 bytes I think so I dont think thats my character limit problem but its possible I dont understand something.

0 Kudos
Message 3 of 3
(3,358 Views)