LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simple VISA write and read not working

Okay, may be we can give this one more try. I've found a manual that gives the command of the Digital Output, and this should make clearer what I'm supposed to enter in the write field. I was unclear earlier when I said that if I input 'K', the program reads 'K', since that was in loop-back mode. What I actually read in normal mode is 0 bytes, with and without the cable unplugged. I also get a '1073676294' warning.

 

Any advice would be appreciated. Regars,

 

L

0 Kudos
Message 11 of 17
(1,103 Views)

First, the mention in section 4.11 of 5V makes no sense. RS-232 is not 5V logic. It's +/- 3-15. If the meter does not follow that standard, you would need an adapter.

 

The manual also does not mention a termination character but I assume you've tried sending just the K.

 

Sorry but I don't know what else to try. Think your best bet is to contact the vendor.

Message 12 of 17
(1,101 Views)

Dear Sir.

 

 I am quite new to labview,I am also having simillar kind of problem I am working with a EEPROM by interfacing labview through microcontroller,when i need to write a data in EEPROM i have to send a command WL 0x0043 (Location) then DATA,by using this Basic serial read and write i tried to send command like WL\s0x0043\sABCD\r\n at this times it works fine now i want to change DATA every time,so i did one string controller to user fileld and WL 0x0043 as constant after r n by making concatinate of these 3 string  and given to string write of the write visa at this time automatic the \s will coming for all in between,become like WL\s0x0043\sABCD\sr\sn,if i put the \between r and n then it wil taking \\r\\n,so how to do this,i am not getting error getting warning and even i am my data will not writing in eeprom location,so how to write user filed data in the location of eeprom,like this i need write 10 different data filed by in different location of eeprom.

 

Raikar A G

Download All
0 Kudos
Message 13 of 17
(931 Views)

Enter \r\n when the string constant is set to show \codes!  Right click on the constant or control to change the setting.

 

Your description overall is rather confusing because you say you've gotten it to work with \r\n, yet your VI shows, ,r,n  (commas) and your message says space r space n.

0 Kudos
Message 14 of 17
(907 Views)

@Dennis_Knutson wrote:

Normally you do have to send a termination character and it is sent in the basic example by typing either \r, \n, or both. You cannot set a termination character for a write with the VISA Configure Serial Port.

 

Try different combinations and if you can attach the manual, do that.


 

Just to clarify this a bit, terminating character is device dependent and Dennis is correct in the the VISA Configure does NOT set the send terminating character.  It only sets the read terminating character which is very confusing at first.  To set the send character, use a property node after the VISA configure which will allow you to not only set the send terminating character, but also set whether or not to automatically append it to messages.

 

The attatched image illustrates what I'm talking about (the multiple reads are because our device returns multiple responses for a single query).

 

Alternatively, you can manually append string constants to each message before it is sent.  Another question is whether or not the read/write terminating characters are the same (some devices have different terminating characters for the two).  If they are different, your code must be set up to use one for read and the other for write.

 

 

0 Kudos
Message 15 of 17
(896 Views)

Just looking at the K command, the return value of "303<CR>" gives a clue. Manual says that it returns ASCII 13 (CR).  I use similar meters, and they usually require a terminator of <CR> when u send commands.

 

The problem with hyperterminal is you cannot be sure your sending a K AND a <CR>.  I use RealTerm (Google it, its free).  In ASCII mode it shows you all the ASCII chars sent/received, e.g. it would show you 303<CR> on the screen.  Set up and open the port, then put a K (uppercase) in the send, and check the "add CR, and send.  On the WRITE in LV, try build a string using a concatinate "K" and a <CR> (the constant in the Strings palette), then wire that to the VISA Write. 

 

I don't know what ur code looks like but after a write I delay 100ms, then use a property node to get the number of bytes in the buffer and wire that to the VISA Read.

 

Also often times these meters are very simplistic, meaning if you send it wrong data or extra bytes, those extra bytes sit in the buffer and it can't figure anyting else out - so cycle power oftten when you get no response, before trying something else.

 

Steve

0 Kudos
Message 16 of 17
(892 Views)

Hello Sir.

 

 

Thanks for your valuable suggestion I will update it,and present my read and write terminals are same only now.

 

 

Raikar A G

0 Kudos
Message 17 of 17
(878 Views)