#define LED_1 PCout(6) // PCout(7) // LATBbits.LATB8 /**< \brief Access to led 1 output*/
#define LED_2 PGout(8) // PCout(6) //3////LATBbits.LATB9 /**< \brief Access to led 2 output*/
#define LED_3 PGout(7)// PGout(8) // LATBbits.LATB10 /**< \brief Access to led 3 output*/
#define LED_4 PGout(6)// PGout(7) //LATBbits.LATB11 /**< \brief Access to led 4 output*/
#define LED_5 PGout(5)// PGout(6) // LATBbits.LATB12 /**< \brief Access to led 5 output*/
#define LED_6 PGout(4)// PGout(5) // LATBbits.LATB13 /**< \brief Access to led 6 output*/
#define LED_7 PGout(3)// PGout(4) //LATBbits.LATB14 /**< \brief Access to led 7 output*/
#define LED_8 PDout(13)// PGout(3)
部分源碼如
/////////////////////////////////////////////////////////////////////////////////////////
/**
\return 0(ALSTATUSCODE_NOERROR), NOERROR_INWORK
\param pInputSize pointer to save the input process data length
\param pOutputSize pointer to save the output process data length
\brief This function calculates the process data sizes from the actual SM-PDO-Assign
and PDO mapping
*////////////////////////////////////////////////////////////////////////////////////////
UINT16 APPL_GenerateMapping(UINT16* pInputSize,UINT16* pOutputSize)
{
#if COE_SUPPORTED
UINT16 result = ALSTATUSCODE_NOERROR;
UINT16 PDOAssignEntryCnt = 0;
OBJCONST TOBJECT OBJMEM * pPDO = NULL;
UINT16 PDOSubindex0 = 0;
UINT32 *pPDOEntry = NULL;
UINT16 PDOEntryCnt = 0;
UINT16 InputSize = 0;
UINT16 OutputSize = 0;
/*Scan object 0x1C12 RXPDO assign*/
for(PDOAssignEntryCnt = 0; PDOAssignEntryCnt < sRxPDOassign.u16SubIndex0; PDOAssignEntryCnt++)
{
pPDO = OBJ_GetObjectHandle(sRxPDOassign.aEntries[PDOAssignEntryCnt]);
if(pPDO != NULL)
{
PDOSubindex0 = *((UINT16 *)pPDO->pVarPtr);
for(PDOEntryCnt = 0; PDOEntryCnt < PDOSubindex0; PDOEntryCnt++)
{
// result = *(UINT8 *)pPDO->pVarPtr;
// result=(OBJ_GetEntryOffset((PDOEntryCnt+1),pPDO)>>3);
pPDOEntry = (UINT32 *)((UINT8 *)pPDO->pVarPtr + (OBJ_GetEntryOffset((PDOEntryCnt+1),pPDO)>>3)); //goto PDO entry
// we increment the expected output size depending on the mapped Entry
OutputSize += (UINT16) ((*pPDOEntry) & 0xFF);
}
}
else
{
/*assigned PDO was not found in object dictionary. return invalid mapping*/
OutputSize = 0;
result = ALSTATUSCODE_INVALIDOUTPUTMAPPING;
break;
}
}