![North Atlantic 8810A Programmer'S Reference Manual Download Page 35](http://html.mh-extra.com/html/north-atlantic/8810a/8810a_programmers-reference-manual_1707615035.webp)
Soft Panel Program
4 API-8810A USB Protocol
The 8810A USB interface supports only the API-8810A Language. Sending commands via the
USB interface require the following protocol:
Number of Bytes to be sent
(2 bytes)
Command ID (8810 (i.e. 0x226A)
(2 bytes)
Data
The following is code snippets from the API8810ADll (USBComm.cpp) that makes calls to the
Cypress CyAPI.lib file to sending commands to the 8810A:
bool USB_WriteMsg(char* szMsg, bool bExpectReply, char*pszReply)
{
bool bSuccess = false;
unsigned short usTotalBytes = (unsigned short)strlen(szMsg) + 4; // Length of Message
// + 2 bytes for Bytes sent
// + 2 bytes for Command
unsigned short usCommand = 0x226A; // 8810 (0x226A) Command
char szData[256];
LONG nDataCnt = 0;
LONG BytesToRead = 0;
byte loByte, hiByte;
//********************************************
// Format data to be sent
// Protocol:
// (16 bits) Number of bytes to be sent
// (16 bits) Command ID (0x226A) for 8810
// szMsg - data message
//********************************************
// Low byte of Total Bytes to send
loByte = (byte)(usTotalBytes & 0x00FF);
// High byte of Total Bytes to send
hiByte = (byte)(usTotalBytes >> 8);
szData[n+] = loByte;
szData[n+] = hiByte;
// Low byte of Command
loByte = (byte)(usCommand & 0x00FF);
// High byte of Command
hiByte = (byte)(usCommand >> 8);
szData[n+] = loByte;
szData[n+] = hiByte;
// Message Data
for (int i = 0; i < (int)strlen(szMsg); i++)
szData[n+] = szMsg[i];
if(glb_pUSBDevice)
{
if(glb_pUSBDevice->IsOpen())
{
short numOfTries = 0;
do
{
// Write Data Message
if (glb_pUSBDevice->BulkOutEndPt)
{
8810A Programmer’s
if (!glb_pUSBDevice->BulkOutEndPt->XferData((PUCHAR)&szData, nDataCnt))
North Atlantic Industries, Inc.
631.567.1100/631.567.1823 (fax) Revision 2.0.0.2
Reference Guide
110 Wilbur Place, Bohemia, NY 11716
www.naii.com
/ e-mail:[email protected]
Page 35 of 50