|
Replies:
8
-
Pages:
1
-
Last Post:
Apr 13, 2011 12:34 PM
Last Post By: hognala
|
|
|
Posts:
1
Registered:
04/07/11
|
|
|
|
How to convert a string to 488.2 Binary Block
Posted:
Apr 7, 2011 2:00 PM
|
|
|
Hello,
I've scoured the internet for hours trying to figure this out, and I keep seem to find an answer. According the SCPI reference manual, you can specify a file name via MMEM:DOWN:FNAM, and then write to that file using the command MMEM:DOWN:DATA <binary_block>. The example given in the manual is #15Hello. My question is, how is the number 15 calculated? How about some other examples, such as the following:
Data Type:"short"
Thanks.
|
|
|
Posts:
434
Registered:
01/15/10
|
|
|
|
Re: How to convert a string to 488.2 Binary Block
Posted:
Apr 7, 2011 2:22 PM
in response to: jswegman
|
|
My co-worker actually answered this very question under a different post. Check it out and let me know if you have questions: view
|
|
|
Posts:
11
Registered:
03/11/11
|
|
|
|
Re: How to convert a string to 488.2 Binary Block
Posted:
Apr 7, 2011 3:09 PM
in response to: jswegman
|
|
|
Thanks, that clears up that particular question about the formatting.
Let's say that I have a text file with multiple lines. How do I indicate a carriage return to the instrument, and what are my limits to this transmission method? For instance, I've got an ARB file that looks like this:
Sample Rate:50000000.000000 High Level:0.300000 Low Level:-0.300000 Data Type:"short" Data: 32767 32330 31893 etc.
I can read this off of the USB drive and it does what I want it to. However, I need to be able to do this over the LAN from telnet.
Thanks.
|
|
|
Posts:
126
Registered:
04/09/07
|
|
|
|
Re: How to convert a string to 488.2 Binary Block
Posted:
Apr 7, 2011 3:56 PM
in response to: jswegman
|
|
|
--> However, I need to be able to do this over the LAN from telnet.
Are you trying to interactively do this with a telnet client, or are you writing an app to send the data? If you are writing an app, don't use the telnet port 5024, use the Raw SCPI Socket port of 5025 or use VXI-11. I'm not sure this approach would work correctly with an interactive telnet client (line endings might cause problems, and it seems like it would be really tedious to manually type in an arb file).
I'm not sure what the line ending are in this case, but they are usually \n (0x0a), \r (0x0d), or \r\n (0x0d0a). You could open one of the default arb files in a hex editor and see what the line endings are?
|
|
|
Posts:
11
Registered:
03/11/11
|
|
|
|
Re: How to convert a string to 488.2 Binary Block
Posted:
Apr 12, 2011 2:18 PM
in response to: jswegman
|
|
|
I unfortunately don't know VXI-11, VISA, etc, only ol' fashioned 'X' stuff (telnet, nc, etc.). Can a format other than Ascii be used, i.e. can I send raw hex? Here's my confusion:
#16Hello\n ...returns an error #17Hello\n ...does not, but the '\n' is not recognized as a line ending
whereas if I could feed hex, I could easily convert the file and be on my way.
And BTW, I am using port 5025.
Thanks.
|
|
|
Posts:
126
Registered:
04/09/07
|
|
|
|
Re: How to convert a string to 488.2 Binary Block
Posted:
Apr 12, 2011 5:41 PM
in response to: jswegman
|
|
jwegman, to send/receive arb files from the a shell (I did this using BASH on Ubuntu 10.10), you can do something like: To download an arb file from an instrument to a PC echo "MMEM:UPL? \"INT:BuiltIn\\SINC.arb\"" | nc -q 5 156.140.113.95 5025 > purple.arb
This will save the builtin waveform SINC.arb on my PC as purlpe.arb. Notice option -q on the netcat (nc) command. If you don't specify a timeout, netcat closes the connection immediately and you will never receive the file. Since this isn't a proper .arb file (it has the binary block header prepended to it still, you can send it back to the instrument using something like: echo "MMEM:DOWN:FNAM \"INT:\\purlpe.arb\"" | nc 156.140.113.95 5025 (echo -n 'MMEM:DOWN:DATA '; cat purple.arb) | nc 156.140.113.95 5025 Where this first line names the arb file, and the second line dumps the arb file to the instrument. jwegman, is this what you were looking for, or am I missing something?
|
|
|
Posts:
11
Registered:
03/11/11
|
|
|
|
Re: How to convert a string to 488.2 Binary Block
Posted:
Apr 13, 2011 8:48 AM
in response to: jswegman
|
|
|
Ok, I think the key point in all this that I was missing is what needs to be in the file that gets sent to the instrument. The binary block header needs to be in there, as I had ascertained, but the line endings are DOS-flavored (\r\n, in Unix parlance, ^M) and the line:
Data Type:"short"
comes from the instrument as:
#Data Type:\"short\"\r\n (again, in Unix parlance, ~Tshort~T^M)
IOW, it's the ANSI ", not the ASCII ". I think that's what's been causing this errors. I'll go back and make sure that's the case.
Thanks, Jake
|
|
|
Posts:
11
Registered:
03/11/11
|
|
|
|
Re: How to convert a string to 488.2 Binary Block
Posted:
Apr 13, 2011 11:45 AM
in response to: jswegman
|
|
" IOW, it's the ANSI ", not the ASCII ". I think that's what's been causing this errors. I'll go back and make sure that's the case. " Yup, that was it.
|
|
|
Posts:
126
Registered:
04/09/07
|
|
|
|
Re: How to convert a string to 488.2 Binary Block
Posted:
Apr 13, 2011 12:34 PM
in response to: jswegman
|
|
good deal  so are you putting together scripts to manage your waveforms? Or are you most interested in creating the .arb files with your own tools? Alan Agilent I/O Support
|
|
|
|