Migrating from API-GPIB (98/PC)


Fundamentally, there is no compatibility in functions of API-GPIB(98/PC) and new function.

It is necessary to migrate program by referring to following correspondence tables and examples for conversion.

API-GPIB(98/PC)

 

New Function

Initialization/Termination Functions

GpIni

Example

GpibInit

GpExit

Example

GpibExit

GpIfc

Example

GpibSendIFC

GpRen

GpResetren

Example

GpibChangeREN

Transmitting/Receiving Functions

GpTalk

GpTalkEx

Example

GpibSendData

GpTalkBinary

GpTalkExBinary

None

GpibSendData (Substitution)

GpTalkAsync

None

Not implemented

GpTalkAsyncBinary

None

Not implemented

GpListen

GpListenEx

Example

GpibRecData

GpListenBinary

GpListenExBinary

None

GpibRecData (Substitution)

GpListenAsync

GpListenAsyncVB

GpListenAsyncBinary

None

Not implemented

GpCheckAsync

None

Not implemented

GpStopAsync

None

Not implemented

GpDelim

Example

GpibSetDelim

GpTimeout

Example

GpibSetTimeOut

GpDma

None

Not implemented

GpSlowMode

Example

GpibSetSlowMode

Serial Poll Functions

GpPoll

GpPollEx

Example

GpibSPollAll

Parallel Poll Functions

GpStppoll

None

Not implemented

GpExppoll

None

Not implemented

GpPpollmode

None

Not implemented

SRQ Transmitting Functions

GpSrqEx

Example

GpibSendSRQ

GpChkstb

Example

GpibCheckSPoll

Event Functions

GpSetEvent

None

Not implemented

GpEnableNextEvent

None

Not implemented

GpSetEventSrq

GpSetEventDet

GpSetEventDec

GpSetEventIfc

None

Not implemented

Status Functions

GpDevFind

GpDevFindEx

Example

GpibFindListener

GpBoardsts

Example

GpibGetStatus

GpBoardstsEx

Example

GpibSetStatus

GpibGetStatus

GpReadbus

Example

GpibReadLines

GpUpperCode

None

Not supported

GpTaLaBit

None

Not supported

Control Functions

GpComand

Example

GpibSendCommands

GpComandAsync

None

Not implemented

GpSdc

GpDcl

Example

GpibSendDeviceClear

GpGet

Example

GpibSendTrigger

GpGtl

Example

GpibChangeLocal

GpLlo

Example

GpibSendLocalLockout

GpTct

None

Not implemented

Wait Functions

GpStwait

None

Not implemented

GpWaittime

None

Not implemented

String Operating Functions

None

Not implemented

IEEE488.2 Functions

None

Not implemented



 

GpIni -> GpibInit

API-GPIB(98/PC)

Program Contents

New Function

DWORD Ret;

 

 

        Ret =GpIni ();

Declares variable of return value

Specifies Device Name

Declares variable of Device ID

Initializes device

long Ret;

char DeviceName[50] = "Gpib000";

short DevId;

        Ret = GpibInit ( DeviceName, &DevId );

TOP



 

GpExit -> GpibExit

API-GPIB(98/PC)

Program Contents

New Function

        Ret =GpExit ();

Terminates device

        Ret = GpibExit ( DevId );

TOP



 

GpIfc -> GpibSendIFC

API-GPIB(98/PC)

Program Contents

New Function

DWORD IfcTime =1;

        Ret =GpIfc ();

Sets IFCTime

Changes IFC line

short IfcTime = 1;

        Ret = GpibSendIFC ( DevId );

TOP



 

GpRen, GpResetren -> GpibChangeREN

API-GPIB(98/PC)

Program Contents

New Function

 

        Ret =GpRen ();

Sets Enable to enabled

Sets REN to enabled

short Enable = 1;

        Ret = GpibChangeREN ( DevId, Enable );

 

        Ret =GpResetren ();

Sets Enable to disabled

Sets REN to disabled

short Enable = 0;

        Ret = GpibChangeREN ( DevId, Enable );

TOP



 

GpTalk, GpTalkEx -> GpibSendData

API-GPIB(98/PC)

Program Contents

New Function

Master mode

DWORD Srlen;

DWORD Cmd[31];

BYTE Srbuf[10];

        Cmd[0]=2;

        Cmd[1]=0;

        Cmd[2]=1;

 

 

 

        lstrcpy ( ( char * ) Srbuf, "*IDN?" );

        Srlen = lstrlen ( ( char * ) Srbuf );

        Ret = GpTalk ( Cmd,

                Srlen, Srbuf );

Declares variable of number of data

Declares variable of array of address

Declares variable of data

 

Specifies address of talker

Specifies address of listener

 

Sets address

 

Sets data

Sets number of data

Transmits data to specified address

long SendLen;

short Talker, ListenerArray[15];

char SendBuf[256];

 

        Talker = 0;

        ListenerArray[0] = 1;

        ListenerArray[1] = -1;

        Ret = GpibSetAddrInfo ( DevId,

                Talker, ListenerArray );

        strcpy ( SendBuf, "*IDN?" );        

        SendLen = strlen ( SendBuf );

        Ret = GpibSendData ( DevId,

                &SendLen, SendBuf );

DWORD Srlen;

DWORD Cmd[31];

BYTE Srbuf[10];

        Cmd[0]=2;

        Cmd[1]=0;

        Cmd[2]=1;

 

 

 

        lstrcpy ( ( char * ) Srbuf, "*IDN?" );

        Srlen = lstrlen ( ( char * ) Srbuf );

        Ret = GpTalkEx ( Cmd,

                &Srlen, Srbuf );

        if ( Ret == 0 )

                Printf ( "%ld\n", Srlen );

Declares variable of number of data

Declares variable of array of address

Declares variable of data

 

Specifies address of talker

Specifies address of listener

 

Sets address

 

Sets data

Sets number of data

Transmits data to specified address

 

Displays number of transmitted bytes on normal completion

long SendLen;

short Talker, ListenerArray[15];

char SendBuf[256];

 

        Talker = 0;

        ListenerArray[0] = 1;

        ListenerArray[1] = -1;

        Ret = GpibSetAddrInfo ( DevId,

                Talker, ListenerArray );

        strcpy ( SendBuf, "*IDN?" );        

        SendLen = strlen ( SendBuf );

        Ret = GpibSendData ( DevId,

                &SendLen, SendBuf );

        if ( Ret == 0 )

                Printf ( "%ld\n", SendLen );

Slave mode (only for GpTalkEx)

DWORD Srlen;

DWORD Cmd[31];

BYTE Srbuf[10];

        Cmd[0]=0;

        lstrcpy ( ( char * ) Srbuf, "*IDN?" );

        Srlen = lstrlen ( ( char * ) Srbuf );

        Ret = GpTalkEx ( Cmd,

                &Srlen, Srbuf );

        if ( Ret == 0 )

                Printf ( "%ld\n", Srlen );

Declares variable of number of data

Declares variable of array of address

Declares variable of data

Sets address for slave

Sets data

Sets number of data

Transmits data

 

Displays number of transmitted bytes on normal completion

long SendLen;

 

char SendBuf[256];

 

        strcpy ( SendBuf, "*IDN?" );        

        SendLen = strlen ( SendBuf );

        Ret = GpibSendData ( DevId,

                &SendLen, SendBuf );

        if ( Ret == 0 )

                Printf ( "%ld\n", SendLen );

TOP



 

GpListen, GpListenEx -> GpibRecData

API-GPIB(98/PC)

Program Contents

New Function

Master mode

DWORD Srlen;

DWORD Cmd[31];

BYTE Srbuf[256];

        Cmd[0]=2;

        Cmd[1]=1;

        Cmd[2]=0;

 

 

 

        Srlen  =256;

        Ret = GpListen ( Cmd,

                &Srlen, Srbuf );

        if ( Ret < 3 ) {

                Printf ( "%ld\n", Srlen );

                Printf ( "%s\n", Srbuf );

        }

Declares variable of number of data

Declares variable of array of address

Declares variable of data

 

Specifies address of talker

Specifies address of listener

 

Sets address

 

Sets maximum number of data to receive

Receives data from specified address

 

If it is normally completed

Displays number of received data

Displays received data

* Pay attention to that the return value is different

long RecLen;

short Talker, ListenerArray[15];

char RecBuf[256];

 

        Talker = 1;

        ListenerArray[0] = 0;

        ListenerArray[1] = -1;

        Ret = GpibSetAddrInfo ( DevId,

                Talker, ListenerArray );

        RecLen = 256;

        Ret = GpibRecData ( DevId,

                &RecLen, RecBuf );

        if ( Ret == 0 ) {

                Printf ( "%ld\n", RecLen );

                Printf ( "%s\n", RecBuf );

        }

DWORD Srlen;

DWORD Cmd[31];

BYTE Srbuf[256];

        Cmd[0]=2;

        Cmd[1]=1;

        Cmd[2]=0;

 

 

 

        Srlen  =256;

        Ret = GpListenEx ( Cmd,

                &Srlen, Srbuf );

        if ( Ret < 3 ) {

                Printf ( "%ld\n", Srlen );

                Printf ( "%s\n", Srbuf );

        }

Declares variable of number of data

Declares variable of array of address

Declares variable of data

 

Specifies address of talker

Specifies address of listener

 

Sets address

 

Sets maximum number of data to receive

Receives data from specified address

 

If it is normally completed

Displays number of received data

Displays received data

* Pay attention to that the return value is different

long RecLen;

short Talker, ListenerArray[15];

char RecBuf[256];

 

        Talker = 1;

        ListenerArray[0] = 0;

        ListenerArray[1] = -1;

        Ret = GpibSetAddrInfo ( DevId,

                Talker, ListenerArray );

        RecLen = 256;

        Ret = GpibRecData ( DevId,

                &RecLen, RecBuf );

        if ( Ret == 0 ) {

                Printf ( "%ld\n", RecLen );

                Printf ( "%s\n", RecBuf );

        }

Slave mode (only for GpListenEx)

DWORD Srlen;

DWORD Cmd[31];

BYTE Srbuf[256];

        Cmd[0]=0;

        Srlen  =256;

        Ret = GpListenEx ( Cmd,

                &Srlen, Srbuf );

        if ( Ret < 3 ) {

                Printf ( "%ld\n", Srlen );

                Printf ( "%s\n", Srbuf );

        }

Declares variable of number of data

Declares variable of array of address

Declares variable of data

Sets address for slave

Sets maximum number of data to receive

Receives data

 

If it is normally completed

Displays number of received data

Displays received data

* Pay attention to that the return value is different

long RecLen;

 

char RecBuf[256];

 

        RecLen = 256;

        Ret = GpibRecData ( DevId,

                &RecLen, RecBuf );

        if ( Ret == 0 ) {

                Printf ( "%ld\n", RecLen );

                Printf ( "%s\n", RecBuf );

        }

TOP



 

GpDelim -> GpibSetDelim

API-GPIB(98/PC)

Program Contents

New Function

DWORD Delim, Eoi;

        Delim = 1;

        Eoi   = 1;

 

        Ret = GpDelim ( Delim, Eoi );

Declares variable

Sets Delim

Sets Eoi

Sets Eos (fixed 0)

Sets delimiter and EOI

short Delim, Eoi, Eos;

        Delim = 1;

        Eoi = 1;

        Eos = 0;

        Ret = GpibSetDelim ( DevId, Delim, Eoi, Eos );

TOP



 

GpTimeout -> GpibSetTimeOut

API-GPIB(98/PC)

Program Contents

New Function

DWORD Timeout;

        Timeout =1000;

        Ret = GpTimeout ( Timeout );

Declares variable

Sets TimeOut

Sets value of timeout

long TimeOut;

        TimeOut = 1000;

        Ret = GpibSetTimeOut ( DevId, TimeOut );

TOP



 

GpSlowMode -> GpibSetSlowMode

API-GPIB(98/PC)

Program Contents

New Function

DWORD SlowTime;

        SlowTime =1;

        Ret = GpSlowMode ( SlowTime );

Declares variable

Sets SlowTime

Sets slow mode

short SlowTime;

        SlowTime= 1;

        Ret = GpibSetSlowMode ( DevId, SlowTime );

TOP



 

GpPoll, GpPollEx -> GpibPollAll

API-GPIB(98/PC)

Program Contents

New Function

GpPoll

DWORD Cmd[31];

DWORD Pstb[31];

 

short i;

        Cmd[0]=2;

        Cmd[1]=1;

        Cmd[2]=2;

 

        Ret =GpPoll ( Cmd, Pstb );

 

        if ( Ret < 2 ) {

               i = Pstb[0];

 

 

 

 

                Printf ( "%ld\n", Cmd[i] );

                Printf ( "%ld\n", Pstb[i] );

        } else if ( Ret == 128 ) {

                Printf ( "No SRQ\n" );

        }

Declares variable of address

Declares variable of status byte

Declares variable of SRQ

Declares variable for index of the device sent SRQ in address array

 

Sets address to 1

Sets address to 2

 

Performs serial poll

 

If it is normally completed

Asserts address of device transmitted SRQ

 

 

 

 

Displays addresses transmitted SRQ

Displays status bytes

 

No device transmitted SRQ

* Since the return value and array structure are different, it is adjusted so that it may become equivalent in example

short AddrArray[15];

short StbArray[15];

short SrqArray[15];

short i;

        i = 0;

        AddrArray[0] = 1;

        AddrArray[1] = 2;

        AddrArray[2] = -1;

        Ret = GpibSPollAll ( DevId,

            AddrArray, StbArray, SrqArray );

        if ( Ret == 0 ) {

            while ( AddrArray[i] != -1 ) {

                if ( SrqArray [i] != 0 ) break;

                i++;

            }

            if ( SrqArray [i] != 0 ){

                Printf ( "%ld\n", AddrArray[i] );

                Printf ( "%ld\n", StbArray[i] );

            } else {

                Printf ( "No SRQ\n" );

            }

        }

GpPollEx

DWORD Cmd[31];

DWORD Pstb[31];

DWORD Psrq[31];

short i , k;

        i = 0;

        Cmd[0]=2;

        Cmd[1]=1;

        Cmd[2]=2;

        Ret = GpPollEx ( Cmd,

            Pstb, Psrq );

        if ( Ret == 0 ) {

               k = Psrq[0];

            while ( j != 0 ) {

                if ( Psrq[i] != 0) {

                    Printf ( "%ld\n", Cmd[i] );

                    Printf ( "%ld\n", Pstb[i] );

                    k--;

                }

                i++;

            }

        } else if ( Ret == 128 ) {

 

                Printf ( "No SRQ\n" );

        }

 

Declares variable of address

Declares variable of status byte

Declares variable of SRQ

 

 

 

Sets address to 1

Sets address to 2

 

Performs serial poll

 

If it is normally completed

 

 

 

Displays addresses transmitted SRQ

Displays status bytes

 

 

 

 

 

No device transmitted SRQ

* Since the return value and array structure are different, it is adjusted so that it may become equivalent in example

short AddrArray[15];

short StbArray[15];

short SrqArray[15];

short i, k;

        i = 0;

        k = 0;

        AddrArray[0] = 1;

        AddrArray[1] = 2;

        AddrArray[2] = -1;

        Ret = GpibSPollAll ( DevId,

            AddrArray, StbArray, SrqArray );

        if ( Ret == 0 ) {

 

            while ( AddrArray[i] != -1 ) {

                if ( SrqArray [i] != 0 ) {

                    Printf ( "%ld\n", AddrArray[i] );

                    Printf ( "%ld\n", StbArray[i] );

                    k++;

                }

                i++;

            }

            if ( k == 0)

                Printf ( "No SRQ\n" );

            }

        }

TOP



 

GpSrqEx -> GpibSendSRQ

API-GPIB(98/PC)

Program Contents

New Function

DWORD Stb, SrqFlag, EoiFlag;

        SrqFlag = 1;

        Stb = 10;

        EoiFlag = 1;

        Ret = GpSrqEx ( Stb,

                SrqFlag, EoiFlag );

Declares variable

Sets to transmit SRQ

Sets status byte

 

Sets SRQ and Stb

* EOI can be set by 36H with GpibSetStatus

 short SrqSend, Stb;

        SrqSend = 1;

        Stb = 10;

 

        Ret = GpibSendSRQ ( DevId,

                SrqSend, Stb );

TOP



 

GpChkstb -> GpibCheckSPoll

API-GPIB(98/PC)

Program Contents

New Function

DWORD Stb, Eoi;

        Ret = GpChkstb ( &Stb, &Eoi );

 

        if ( Ret == 0) {

            if ( ( Stb & 0x20 ) != 0 ) {

                Printf ( "No Serial Polling\n" );

                Printf ( "%ld\n", Stb );

            } else {

                Printf ( "Serial Polling\n" );

                Printf ( "%ld\n", Stb );

            }      

        }

Declares variable

Performs check

 

If it is normally completed

Whether serial poll is done

Serial poll is not done

Displays Stb

 

Serial poll is done

Display Stb

* EOI can be seen by 36H with GpibGetStatus

short SPoll, Stb;

        Ret = GpibCheckSPoll ( DevId,

                &SPoll, &Stb );

        if ( Ret == 0) {

            if ( SPoll == 0 ) {

                Printf ( "No Serial Polling\n" );

                Printf ( "%ld\n", Stb );

            } else {

                Printf ( "Serial Polling\n" );

                Printf ( "%ld\n", Stb );

            }

        }

TOP



 

GpDevFind, GpDevFindEx -> GpibFindListener

API-GPIB(98/PC)

Program Contents

New Function

DWORD  Fstb[32];

DWORD  i =0;

 

 

 

        Ret = GpDevFind ( Fstb );

 

         if ( Ret == 0) {

            while(Fstb[i] != 255){

                Printf ("%ld\n", Fstb[i]);

                i++;

            }

        }

Declares variable

 

 

 

 

A partner apparatus address is acquired.

 

If it is normally completed

 

Outputs acquired data

short PrmAddr, ScdAddr, ArraySize, AddrArray[30];

short i;

        PrmAddr = -1;

        ScdAddr = 0;

        ArraySize = 30;

        Ret = GpibFindListener ( Id, PrmAddr,

                 ScdAddr, &ArraySize, AddrArray );

        if ( Ret == 0){

            for ( i = 0; i < ArraySize; i++ ){

                Printf ("%ld\n", AddrArray[i]);

            }

         }

DWORD  Pad, Sad, Lstn;

        Pad = 1;

        Sad = 0;

 

        Ret = GpDevFindEx ( Pad, Sad, &Lstn );

  

        if ( Ret == 0)

            Printf ("%ld\n", Lstn);

Declares variable

 

 

 

Partner apparatus is searched.

If it is normally completed

Outputs acquired data

short PrmAddr, ScdAddr, ArraySize, AddrArray[1];

        PrmAddr = 1;

        ScdAddr = 0;

        ArraySize = 1;

        Ret = GpibFindListener ( Id, PrmAddr,

                 ScdAddr, &ArraySize, AddrArray );

        if ( Ret == 0)

            Printf ("%ld\n", ArraySize);

TOP



 

GpBoardsts -> GpibGetStatus

API-GPIB(98/PC)

Program Contents

New Function

DWORD  Reg;

DWORD  Preg;

        Reg = 0x08;

        Ret = GpBoardsts ( Reg, &Preg );

 

        if ( Ret == 0)

            Printf ("%ld\n", Preg);

Declares variable of status

Declares variable for acquiring

Sets status

Acquires data

 

If it is normally completed

Outputs acquired data

* Status number does not have change

short Select;

long Data;

        Select = 0x08;

        Ret = GpibGetStatus ( DevId,

                Select, &Data );

        if ( Ret == 0)

            Printf ("%ld\n", Data);

TOP



 

GpBoardstsEx -> GpibSetStatus, GpibGetStatus

API-GPIB(98/PC)

Program Contents

New Function

Acquest

DWORD  Reg;

DWORD  Preg;

        Reg = 0x08;

        Ret = GpBoardstsEx ( Reg,

               &Preg );

        if ( Ret == 0)

            Printf ("%ld\n", Preg);

Declares variable of status

Declares variable for acquiring

Sets status

Acquires data

 

If it is normally completed

Outputs acquired data

* Status number does not have change

short Select;

long Data;

        Select = 0x08;

        Ret = GpibGetStatus ( DevId,

                Select, &Data );

        if ( Ret == 0)

            Printf ("%ld\n", Data);

Setting

DWORD  Reg;

DWORD  Preg;

        Reg = 0x08;

        Preg = 1;

        Ret = GpBoardstsEx ( Reg,

                &Preg );

Declares variable of status

Declares variable for setting

Sets status

Sets value of setting

Setting

* Status number does not have change

short Select;

long Data;

        Select = 0x08;

        Data = 1;

        Ret = GpibSetStatus ( DevId,

                Select, Data );

TOP



 

GpReadbus -> GpibReadLines

API-GPIB(98/PC)

Program Contents

New Function

DWORD Bussta;

 

        Ret = GpReadbus ( &Bussta );

 

 

 

 

 

 

        if ( Ret = 0 )

 

 

               Printf ("%x\n", Bussta);

Declares variable

 

Acquires control line

 

 

Extracts line information only

Shifts control to upper

Gets data line

 

If it normally completed

Extracts line information only

Composes data and control

Outputs line data

* Data and control can not be acquired in one time with GpibReadLines

short Bussta;

short LineStatus;

        Ret = GpibReadLines ( DevId,

               0, LineStatus );

        if ( Ret == 0 ) {

            LineStatus = LineStatus & 0xff;

            Bussta = LineStatus << 8;

            Ret = GpibReadLines ( DevId,

                   1, LineStatus );

            if ( Ret = 0 ) {

                LineStatus = LineStatus & 0xff;

                Bussta = Bussta | LineStatus;

                Printf ("%x\n", Bussta);

            }

        }

TOP



 

GpComand -> GpibSetCommands

API-GPIB(98/PC)

Program Contents

New Function

DWORD Cmd[31];

        Cmd[0]=2;

        Cmd[1]=0x5f;

        Cmd[2]=0x3f;

 

        Ret = GpComand ( Cmd );

Declares variable of command

 

Sets UNT

Sets UNL

 

Transmits command

short CmdArray[255];

 

        CmdArray[0] = 0x5f;

        CmdArray[1] = 0x3f;

        CmdArray[2] = -1;

        Ret = GpibSendCommands ( DevId,

                CmdArray );

TOP



 

GpSdc, GpDcl -> GpibSendDeviceClear

API-GPIB(98/PC)

Program Contents

New Function

GpSdc

DWORD Adr;

 

        Adr =3;

 

 

 

        Ret = GpSdc ( Adr );

Declares variable

 

Sets address to 3

 

Registers address

 

Transmits SDC

 short Talker, ListenerArray[15];

        Talker = -1;

        ListenerArray[0] = 3;

        ListenerArray[1] = -1;

        Ret = GpibSetAddrInfo ( DevId,

            Talker, ListenerArray );

        Ret = GpibSendDeviceClear ( DevId );

GpDcl

 

 

 

 

 

        Ret = GpDcl ( );

Declares variable

 

 

Registers address

 

Transmits DCL

short Talker, ListenerArray[15];

        Talker = -1;

        ListenerArray[0] = -1;

        Ret = GpibSetAddrInfo ( DevId,

            Talker, ListenerArray );

        Ret = GpibSendDeviceClear ( DevId );

TOP



 

GpGet -> GpibSendTrigger

API-GPIB(98/PC)

Program Contents

New Function

DWORD Adr;

 

        Adr =3;

 

 

 

        Ret = GpGet ( Adr );

Declares variable

 

Sets address to 3

 

Registers address

 

Transmits GET

 short Talker, ListenerArray[15];

        Talker = -1;

        ListenerArray[0] = 3;

        ListenerArray[1] = -1;

        Ret = GpibSetAddrInfo ( DevId,

            Talker, ListenerArray );

        Ret = GpibSendTrigger ( DevId );

TOP



 

GpGtl -> GpibChangeLocal

API-GPIB(98/PC)

Program Contents

New Function

DWORD Adr;

 

        Adr =3;

 

 

 

        Ret = GpGtl ( Adr );

Declares variable

 

Sets address to 3

 

Registers address

 

Transmits GTL

 short Talker, ListenerArray[15];

        Talker = -1;

        ListenerArray[0] = 3;

        ListenerArray[1] = -1;

        Ret = GpibSetAddrInfo ( DevId,

            Talker, ListenerArray );

        Ret = GpibChangeLocal ( DevId );

TOP



 

GpLlo -> GpibSendLocalLockout

API-GPIB(98/PC)

Program Contents

New Function

 

 

 

 

 

        Ret = GpLlo ( );

Declares variable

 

 

Registers address

 

Transmits LLO

 short Talker, ListenerArray[15];

        Talker = -1;

        ListenerArray[0] = -1;

        Ret = GpibSetAddrInfo ( DevId,

            Talker, ListenerArray );

        Ret = GpibSendLocalLockout ( DevId );

TOP