0

I am trying to pull some data off of an instrument in our lab that has temperature records, and for some unexplained reason there is no way to do it all at once - you can only view the records one at a time (and there are 1500 of them). So I would like to make a bash script that simply loops the command and records all the data to a file that I can deal with as a whole.

The rs232 connection has to run at 9600 baud, odd parity, 7 data bits, and 1 stopping bit. It also has to send the entire command at once (probably not an issue but I know some text interfaces don't do this - so worth mentioning). The command I need to loop is LOGVIEW?<n> where <n> is the record number (1-1500 in my case).

So in order to actually loop I would just do a while loop such that while n is less than 1501 execute the command and then set n equal to (n+1) and repeat - but how can I actually send this command to the instrument from the script? I thought about using the screen command but I'm not even sure how to specify the data bits and parity with that command.

In case it helps I'm using a USB to serial adapter on port USB0 (which shows up in dmesg | grep tty) and a standard I/O from the instrument is:

LOGVIEW?<n>
<date>,<time>,<reading>,<status>,<source>

so it is a one-line output. I am running Ubuntu 15.10.

Eric
  • 109
  • 13

0 Answers0