We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Below is a code Snippet:
I am trying to pass pointers through a function; And I am trying to get back the results. Does not work at this time?
main() {
static UCHAR ucRcvAddress, *ucMBFrame, usLength;
eStatus = eMBRTUReceive( &ucRcvAddress, &ucMBFrame, &usLength );
}
eMBErrorCode eMBRTUReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength ) { BOOL xdata xFrameReceived = FALSE; eMBErrorCode xdata eStatus = MB_ENOERR; UCHAR test = 5;
ENTER_CRITICAL_SECTION(); assert( usRcvBufferPos < MB_SER_PDU_SIZE_MAX );
if( ( usRcvBufferPos >= MB_SER_PDU_SIZE_MIN ) && ( usMBCRC16( ( UCHAR * ) ucRTUBuf, usRcvBufferPos ) >= 0 ) ) { *pusLength = ( USHORT )( usRcvBufferPos - MB_SER_PDU_PDU_OFF - MB_SER_PDU_SIZE_CRC );
*pucFrame = ( UCHAR * ) & ucRTUBuf[MB_SER_PDU_PDU_OFF]; xFrameReceived = TRUE; } else { eStatus = MB_EIO; } EXIT_CRITICAL_SECTION( ); return eStatus; }
I am trying to pass a pointer to capture an array[] then pass it back.
Phil
if you READ the instructions above the message entry window, you would have a better chance of a reply.
Did what you enetered look OK on the preview? as it did not, why did you not fix it before posting?
Erik
ie, these instructions (click to view): www.danlhenry.com/.../keil_code.png