Hi Kyle,
I found UINT32 not work as 32bit when I was trying to read Serial Number from ABCC M40 as below:
-
In abcc_setup.c, I add code below as Tim’s idea.
static unsigned long smtcb_iSerialNum; //smtcb
//smtcb serial number read cmd
static ABCC_CmdSeqCmdStatusType SerialNumCmd( ABP_MsgType* psMsg )
{
ABCC_GetAttribute( psMsg, ABP_OBJ_NUM_ANB, 1,
ABP_ANB_IA_SERIAL_NUM, ABCC_GetNewSourceId() );
return( ABCC_SEND_COMMAND );
}
//response
static ABCC_CmdSeqRespStatusType SerialNumResp( ABP_MsgType* psMsg )
{
ABCC_ASSERT_ERR( ABCC_VerifyMessage( psMsg ) == ABCC_EC_NO_ERROR,
ABCC_SEV_WARNING, ABCC_EC_RESP_MSG_E_BIT_SET,
(UINT32)ABCC_GetErrorCode( psMsg ) );
ABCC_GetMsgData32( psMsg, &smtcb_iSerialNum, 0 );
return( ABCC_EXEC_NEXT_COMMAND );
}
unsigned long ABCC_SerialNum( void )
{
return smtcb_iSerialNum;
}
-
In appl_abcc_handler.c, I call ABCC_SerialNum() to collect serial number.
Note that if I define smtcb_iSerialNum and ABCC_SerialNum( void ) as UINT32, I only get lower 16bits data. I think my MPLAB C compiler use ANSI C to compile which has to be defined as “unsigned long” for 32bit unsigned data.
Seemingly I need to change UINT32 to what MPLAB compiler required. So please let me know where can I change the typedef for UINT32?
Best Regards,
David