beautypg.com

Send_cmd, Read_com_status – Measurement Computing CB-NAP-7000P User Manual

Page 13

background image

9

4.3 Send_Cmd

z Description:

This DLL will create a thread to send a command to CB-7 000 and receive the response -result from CB-7000. If the

wCheckSum=1, this DLL will au tomatically add the two checksum bytes to the input string. This DLL will add the

[0x0D]

to the end of the input string, szCmd. The Send_Cmd is a multi-task, multi-thread DLL.

z Syntax:

WORD Send_Cmd(char cPort, char szCmd[], WORD wTimeOut, WORD wCheckSum)

z Input Parameter:

cPort: 1=COM1, 2=COM2, 3=COM3, 4=COM4, others = invalidate
szCmd: the starting address of the original command string (terminated with 0)
wTimeOut: constant for time-out control, unit = 1ms
wCheckSum: 0=DISABLE, 1=ENABLE

z Return Value:

NoError : OK

others = Error code, refer to I7000.H

4.4 Read_Com_Status

z Description:

The Send_Cmd(…) will create a threa d to send a command to CB-7000 and receive the response-result from CB-

7000. The Read_Com_Status will return the status of this send/receive thread. If the thread is working, the status value will
be smaller than 0x100. If the thread is finished, the status value will be larger than 0x100. The return value will be equal

to 0x105 if the send/receive operation is OK.

If the wCheckSum in Send_Cmd is 1, the Recom_Com_Status will check the two checksum bytes of result string. If

the checksum is incorrect, the D13 of return value will be set to 1.

z Syntax:

WORD Read_Com_Status(char cPort, char szResult[], WORD *wT)

z Input Parameter:

cPort : 1=COM1, 2=COM2, 3=COM3, 4=COM4, others = invalidate
szResult: the starting address of the result string (terminated with 0)
wT: time of send/receive interval, unit = 1 ms

z Return Value:

D0-D7=thread status code, thread start=1 and stop=5

D8=0 : send/receive not finished, if 1: send/receive done

D9=1:send/receive timeout
D10=reserved
D11=1:Com handle error
D12=1:send/receive overflow
D13=1 :checksum error