Go to the documentation of this file.
25 #define NUM_BYTE_SEND 79 //Total amount of data sent to relayboard in one message, is now passed and set as protocol-version argument in constructor
27 #define RS422_BAUDRATE 420000
28 #define RS422_RX_BUFFERSIZE 1024
29 #define RS422_TX_BUFFERSIZE 1024
31 #define RS422_TIMEOUT 0.025
33 #define NUM_BYTE_REC_MAX 120
34 #define NUM_BYTE_REC_HEADER 4 //Header bytes, which are used to identify the beginning of a new received message {0x02, 0x80, 0xD6, 0x02}
35 #define NUM_BYTE_REC_CHECKSUM 2 //checksum for message, that is built as the sum of all data bytes contained in the message
36 #define NUM_BYTE_REC 104 //Total amount of data bytes in a received message (from the relayboard)
38 #define NUM_BYTE_SEND_RELAYBOARD_14 88
39 #define NUM_BYTE_REC_RELAYBOARD_14 124
78 static int siNoMsgCnt = 0;
87 const int c_iSizeBuffer = 4096;
91 int iNrBytesInQueue, iNrBytesRead, iDataStart;
92 unsigned char cDat[c_iSizeBuffer];
93 unsigned char cTest[4] = {0x02, 0x80, 0xD6, 0x02};
99 if(iNrBytesInQueue < c_iNrBytesMin)
119 for(i = (iNrBytesRead - c_iNrBytesMin); i >= 0 ; i--)
122 if((cDat[i] == cTest[0]) && (cDat[i+1] == cTest[1]) && (cDat[i+2] == cTest[2]) && (cDat[i+3] == cTest[3]))
371 for(i = 0; i < 20; i++)
385 for(i = 0; i < 60; i++)
464 const int c_iStartCheckSum = iNumByteRec;
467 unsigned int iTxCheckSum;
468 unsigned int iCheckSum;
473 iTxCheckSum = (cMsg[c_iStartCheckSum + 1] << 8) | cMsg[c_iStartCheckSum];
476 for(i = 0; i < c_iStartCheckSum; i++)
479 iCheckSum += cMsg[i];
482 if(iCheckSum != iTxCheckSum)
507 for(i = 0; i < 4; i++)
519 m_iDigIn = (cMsg[iCnt + 1] << 8) | cMsg[iCnt];
unsigned char m_cTextDisplay[60]
#define NUM_BYTE_REC_HEADER
#define RS422_TX_BUFFERSIZE
int m_iRelBoardBattVoltage
int m_iVelCmdMotRearLeftEncS
@ CMD_RELAISBOARD_GET_DATA
#define RS422_RX_BUFFERSIZE
void setTimeout(double Timeout)
#define NUM_BYTE_SEND_RELAYBOARD_14
void setDeviceName(const char *Name)
void convDataToSendMsg(unsigned char cMsg[])
bool convRecMsgToData(unsigned char cMsg[])
int writeIO(const char *Buffer, int Length)
#define NUM_BYTE_REC_RELAYBOARD_14
SerRelayBoard(std::string ComPort, int ProtocolVersion=1)
void setBaudRate(int BaudRate)
@ TOO_LESS_BYTES_IN_QUEUE
#define NUM_BYTE_REC_CHECKSUM
int m_iRelBoardTempSensor
int getAnalogIn(int *piAnalogIn)
int m_iVelCmdMotRightEncS
int m_iUSBoardSensorActive
bool lock(unsigned int uiTimeOut=INFINITE)
int m_iVelCmdMotRearRightEncS
std::string m_sNumComPort
int setDigOut(int iChannel, bool bOn)
int m_iRelBoardAnalogIn[4]
int readBlocking(char *Buffer, int Length)
void setBufferSize(int ReadBufSize, int WriteBufSize)
cob_relayboard
Author(s): Christian Connette
autogenerated on Wed Nov 8 2023 03:47:44