Hi,
I try to build a program using DOS script to interface a PC to a measuring equipment via GPIB port.
Here is the example script :
:gpib_abort
:buffer_488 SDB;AA;B01;CW;D0000;E2710;Z
:send_488 to rgs
Dxxxx,
D represents the start byte for TIME SETTING
xxxx represents the value of TIME SETTING
xxxx may contains hexadecimal number from 0000 to FFFF
I need a simple way to express these scenario :
:buffer_488 SDB;AA;B01;CW;D0000;E2710;F0000;G03E8;J10;V50;I0078;Z
:buffer_488 SDB;AA;B01;CW;D0001;E2710;F0000;G03E8;J10;V50;I0078;Z
:buffer_488 SDB;AA;B01;CW;D0002;E2710;F0000;G03E8;J10;V50;I0078;Z
----------------------------------up to-------------------------------------------
:buffer_488 SDB;AA;B01;CW;D9999;E2710;F0000;G03E8;J10;V50;I0078;Z
Anyone can help ?
How to make a looping statement like this ?
Moderator: DosItHelp
Re: How to make a looping statement like this ?
HI GMFAvionics,
what you need?
You need a function that can convert a decimal value to it's hex representation.
Found at Dostips.com - Arithmetic
And then you need to build your line
what you need?
You need a function that can convert a decimal value to it's hex representation.
Found at Dostips.com - Arithmetic
And then you need to build your line
Code: Select all
@echo off
setlocal EnableDelayedExpansion
call :toHex 100 hex
set "hex=!hex:~-4!"
set "lineHead=:buffer_488 SDB;AA;B01;CW;D"
set "lineTail=;E2710;Z"
set "line=!lineHead!!hex!!lineTail!"
echo !line!
exit /b
-
- Posts: 2
- Joined: 19 Mar 2015 04:13
Re: How to make a looping statement like this ?
Is it work for variable or string?
// can I use the new string in this function ??
:buffer_488 line // Is it correct ??
// can I use the new string in this function ??
:buffer_488 line // Is it correct ??