Close

No more FP23, use sed !

A project log for ReTest-yg

YG's own version of Mateng's ReTest, but with different features and a palindromic project number!

yann-guidon-ygdesYann Guidon / YGDES 11/03/2019 at 15:420 Comments

In the past, I have coded and uploaded FP23.c to convert the numbers and strings to a fixed point format that is recognised and written by the KA lab PSU series.

I think I'll use bash anyway so any way to avoid C code is welcome :-) And I have decided to stick to a fixed 4-digits format, that is easily converted to the 5-digits&dot format used by the PSU. A couple of bash functions do the trick !

function convertAmperes () {
  echo -n $1  | sed 's/^\([0-9]\)\([0-9]\)\([0-9]\)\([0-9]\)/\1.\2\3\4/'
}

function convertVolts () {
  echo -n $1  | sed 's/^\([0-9]\)\([0-9]\)\([0-9]\)\([0-9]\)/\1\2.\3\4/'
}

From there, it is easy to create simple loops and high resolution ramps :

for V in $( seq -w 0 6000 ); do
  echo -n "VSET1:"$( convertVolts "$V" ) > $TTY
  sleep .1
done

I'll try to characterise a batch of RES64 and the quantity is smaller than the RES15 so I don't think I need a crazy AN3 labelling format.


Discussions