Skip to main content

API Details

This chapter explains each API provided by this product.

Legend

Each API is described using the following table format.

Format[Return type] [Function name]([arguments], ...)
Argument[Type][Name][in/out][Description]
Return value[Type][Return code][Description of return code]
Function[Explanation of what the function does]
Notes[Supplementary information]

If an argument type is a structure, refer to Structure Definitions (struct) for details on the values to set or read.

[in/out] indicates whether the argument is provided by the caller (in) or set by the API (out).

API Details

MPXGetAPIVersion

Retrieves the version information of this API.

FormatER MPXGetAPIVersion(StMPXAPIVersion * Version)
ArgumentStMPXAPIVersion *VersionoutAPI version information
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter (such as NULL pointer)
FunctionRetrieves the version information of this API.

MPXOpen

Detects MicroPeckerX units connected to the PC.

FormatER MPXOpen(StMPXDeviceInfo * Devices, unsigned char * Count)
ArgumentStMPXDeviceInfo *DevicesoutInformation about detected MicroPeckerX units
unsigned char *CountoutNumber of detected MicroPeckerX units
Return valueERE_OKCompleted successfully
E_DEVICENo device found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionDetects MicroPeckerX units connected to the PC and returns the number of units and their device information.
NotesIf multiple MicroPeckerX units are connected, up to four units can be detected simultaneously. You cannot specify which units are detected.

MPXClose

Releases all detected MicroPeckerX units.

FormatER MPXClose(void)
Return valueERE_OKCompleted successfully
FunctionReleases all currently detected MicroPeckerX units.

MPXSetLED

Controls the LEDs on a MicroPeckerX unit.

FormatER MPXSetLED(unsigned long Serial, unsigned char LEDRed, unsigned char LEDGreen, unsigned char LEDGreenBlink, unsigned char LEDYellow, unsigned char LEDYellowBlink)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charLEDRedinRed LED setting (see LED Settings)
unsigned charLEDGreeninGreen LED setting (see LED Settings)
unsigned charLEDGreenBlinkinGreen LED blink setting (see LED Settings)
unsigned charLEDYellowinYellow LED setting (see LED Settings)
unsigned charLEDYellowBlinkinYellow LED blink setting (see LED Settings)
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionControls the LEDs on the MicroPeckerX unit specified by Serial. Setting LEDRed to MPX_LED_ON turns on the red LED; MPX_LED_OFF turns it off. LEDGreen controls the green LED in the same way, while LEDGreenBlink causes the green LED to blink regardless of the LEDGreen value. LEDYellow controls the yellow LED, and LEDYellowBlink causes it to blink regardless of LEDYellow.

MPXGetStatus

Retrieves the status of each channel on a MicroPeckerX unit.

FormatER MPCANGetStatus(unsigned long Serial, unsigned short * StatusCh1, unsigned short * StatusCh2)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned short *StatusCh1outStatus of CH1 (see MicroPeckerX Status)
unsigned short *StatusCh2outStatus of CH2 (see MicroPeckerX Status)
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionRetrieves the status of each channel on the MicroPeckerX unit specified by Serial.

MPXMonitorStart

Starts monitoring.

FormatER MPXMonitorStart(unsigned long Serial, unsigned char SyncMode)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charSyncModeinSync mode (see Sync Modes)
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionStarts monitoring on the MicroPeckerX unit specified by Serial. MPX_SYNC_MASTER starts master mode; MPX_SYNC_SLAVE starts slave mode. If slots are configured with MPXSetSlot, frames with MPX_CAN_FRAME_TYPE_PERIODIC or MPX_CAN_FRAME_TYPE_EVENTPERIODIC start transmitting when monitoring begins.
NotesCall MPXSetCANParam to configure communication parameters before starting monitoring. When using multiple units, start monitoring on all slave units first, then start the master unit.

MPXMonitorStop

Stops monitoring.

FormatER MPXMonitorStop(unsigned long Serial, unsigned long * mSec, unsigned short * uSec)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned long *mSecoutTimestamp (milliseconds)
unsigned short *uSecoutTimestamp (microseconds)
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionStops monitoring on the MicroPeckerX unit specified by Serial and returns the timestamp at the moment monitoring stopped. The returned timestamp guarantees the log content up to that point.
NotesWhen operating multiple units, stop the master unit first, then stop each slave unit in order.

MPXGetTimeStamp

Retrieves the current timestamp.

FormatER MPXGetTimeStamp(unsigned long Serial, unsigned long * mSec, unsigned short * uSec)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned long *mSecoutTimestamp (milliseconds)
unsigned short *uSecoutTimestamp (microseconds)
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionRetrieves the timestamp of the MicroPeckerX unit specified by Serial.
NotesThis API can be called only while monitoring, simulation, or log replay is running.

MPXSetGetLogMode

Configures how log information is acquired.

FormatER MPXSetGetLogMode(unsigned long Serial, unsigned char InnerCh, unsigned char Mode)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charInnerChinChannel (1 or 2)
unsigned charModeinLog acquisition mode (see Log Acquisition Modes)
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionConfigures how log information is acquired for the specified channel on the MicroPeckerX unit specified by Serial.

MPXSetLogCallBack

Registers the callback function used to receive log information.

FormatER MPXSetLogCallBack(unsigned long Serial, unsigned char InnerCh, void * Context, unsigned char ** Log1, unsigned char ** Log2, void (*LogCallBack)(unsigned long Serial, unsigned char InnerCh, void * Context, unsigned char BufferNo, unsigned short Count))
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charInnerChinChannel (1 or 2)
void *ContextinUser-defined context pointer passed to the callback
unsigned char **Log1inPointer to the first log buffer
unsigned char **Log2inPointer to the second log buffer
void (*)(unsigned long, unsigned char, void *, unsigned char, unsigned short)LogCallBackinCallback function pointer
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
FunctionRegisters the callback function used to acquire log information for the channel specified by Serial and InnerCh. Log1 and Log2 point to the buffers in which log data is stored.
NotesThis API is effective only when log acquisition mode is set to callback mode. The callback receives the following arguments:
• Argument 1 (unsigned long): Serial number of the MicroPeckerX unit
• Argument 2 (unsigned char): Channel number (1 or 2)
• Argument 3 (void *): Context pointer specified in this API
• Argument 4 (unsigned char): Log buffer index (1 for Log1, 2 for Log2)
• Argument 5 (unsigned short): Number of valid log entries

MPXGetLog

Retrieves log information by returning a pointer to the DLL-managed buffer.

FormatER MPXGetLog(unsigned long Serial, unsigned char InnerCh, StMPXCANLog ** Log, unsigned short * Count, unsigned char * BufferOver)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charInnerChinChannel (1 or 2)
StMPXCANLog **LogoutPointer to the log buffer
unsigned short *CountoutNumber of log entries retrieved
unsigned char *BufferOveroutBuffer overrun flag (see Buffer Overrun Flag)
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
FunctionRetrieves log information for the specified channel. The pointer returned in Log refers to the buffer inside the DLL. Count holds the number of log entries. If a buffer overrun occurs, BufferOver is set to MPX_LOG_BUFOVER_TRUE.
NotesAvailable only when log acquisition mode is set to API mode. The caller does not need to allocate an array to store the retrieved log data.

MPXGetLogEx

Retrieves log information and stores it in an array prepared by the caller.

FormatER MPXGetLogEx(unsigned long Serial, unsigned char InnerCh, StMPXCANLog * Log, unsigned short Num, unsigned short * Count, unsigned char * BufferOver)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charInnerChinChannel (1 or 2)
StMPXCANLog *Login/outArray to receive the log information
unsigned shortNuminNumber of elements in the array
unsigned short *CountoutNumber of log entries stored
unsigned char *BufferOveroutBuffer overrun flag (see Buffer Overrun Flag)
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
FunctionRetrieves log information for the specified channel and stores it in the array provided by the caller. Specify the array and its number of elements in Log and Num. The number of stored entries is returned in Count. If Count exceeds Num, BufferOver is set to MPX_LOG_BUFOVER_TRUE.
NotesAvailable only when log acquisition mode is set to API mode. Prepare the array to store log information before calling this API.

MPXSetCANParam

Configures communication parameters for a channel.

FormatER MPXSetCANParam(unsigned long Serial, unsigned char InnerCh, StMPXCANParam * Param)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charInnerChinChannel (1 or 2)
StMPXCANParam *ParaminCommunication parameters
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionConfigures the communication parameters for the specified channel of the MicroPeckerX unit specified by Serial.

MPXSetSlot

Configures slot information before monitoring starts.

FormatER MPXSetSlot(unsigned long Serial, unsigned char InnerCh, StMPXCANSlot * Slots, unsigned char SlotCount)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charInnerChinChannel (1 or 2)
StMPXCANSlot *SlotsinSlot information
unsigned charSlotCountinNumber of slots to configure
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionConfigures CAN or CAN FD slot information for the channel specified by Serial and InnerCh before monitoring starts.
Prepare an array of slot information structures in Slots for the number of slots you want to configure, and specify the array length in SlotCount.
NotesUse this API to configure slot information before monitoring starts. To change slot information while monitoring is running, call MPXChangeSlot.

MPXChangeSlot

Updates slot information while monitoring is running.

FormatER MPCANChangeSlotData(unsigned long Serial, unsigned char InnerCh, unsigned char SlotNo, unsigned char SlotEnabled, unsigned char ReqInfo, StMPXCANFrame * Frame)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charInnerChinChannel (1 or 2)
unsigned charSlotNoinSlot number (1–28)
unsigned charSlotEnabledinSlot enable/disable flag (see Slot Enable)
unsigned charReqInfoinRequest information for slot change (see Slot Change Request)
StMPXCANFrame *FrameinFrame information
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_TRG_BUSYTrigger configuration failed
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionUpdates the slot specified by SlotNo on the designated channel.
NotesUse this API to change slot settings during monitoring. To configure slots before monitoring starts, use MPXSetSlot.

MPXSendSlot

Requests transmission from a slot.

FormatER MPXSendSlot(unsigned long Serial, unsigned char InnerCh, unsigned char SlotNo)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charInnerChinChannel (1 or 2)
unsigned charSlotNoinSlot number (1–28)
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_TIMEOUTCommunication timeout
FunctionTriggers transmission of the specified slot on the MicroPeckerX unit specified by Serial.
NotesAvailable when slot transmission is enabled for the specified slot.

MPXDirectSend

Transmits a frame immediately.

FormatER MPXDirectSend(unsigned long Serial, unsigned char InnerCh, StMPXCANDirect * Direct)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charInnerChinChannel (1 or 2)
StMPXCANDirect *DirectinFrame to transmit
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_TIMEOUTCommunication timeout
FunctionTransmits the specified frame immediately.
NotesAvailable when communication parameters configured by MPXSetCANParam are set to an operating mode that supports transmission (e.g., monitoring with ACK, simulation, or log replay).

MPXSetLogRequestCallBack

Registers the callback function that supplies log replay data when requested.

FormatER MPXSetLogRequestCallBack(unsigned long Serial, unsigned char InnerCh, void * Context, void (*RequestCallBack)(unsigned long Serial, unsigned char InnerCh, void * Context, unsigned char ShortageFlag, unsigned short AcceptSize))
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charInnerChinChannel (1 or 2)
void *ContextinUser-defined context pointer passed to the callback
void (*)(unsigned long, unsigned char, void *, unsigned char, unsigned short)RequestCallBackinCallback function pointer
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionRegisters the callback function that is called when additional log replay data is requested while operating in log replay mode or burst transfer mode (log replay).
NotesThe callback receives the following arguments:
• Argument 1 (unsigned long): Serial number
• Argument 2 (unsigned char): Channel (1 or 2)
• Argument 3 (void *): Context pointer specified in this API
• Argument 4 (unsigned char): Log depletion flag (1 when a shortage occurred)
• Argument 5 (unsigned short): Acceptable log size in bytes
Effective only when communication parameters configured by MPXSetCANParam specify MPX_MODE_CAN_LOGREPLAY or MPX_MODE_CAN_BURST_LOG.

MPXSetLogReplayData

Supplies log replay data.

FormatER MPXSetLogReplayData(unsigned long Serial, unsigned char InnerCh, unsigned char * Data, unsigned long Size)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charInnerChinChannel (1 or 2)
unsigned char *DatainLog replay data
unsigned longSizeinData size (bytes)
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_LOG_OVERLog replay data overflow
E_TIMEOUTCommunication timeout
FunctionProvides log replay data to the specified channel.
NotesLog replay data consists of consecutive frame information structures. See StMPXCANReplayLog; data bytes (D1–D64) are variable length. If a frame has an odd number of data bytes, append one byte of padding after the data (value is arbitrary). The maximum size per call is 16,384 bytes. Effective only when communication parameters configured by MPXSetCANParam specify MPX_MODE_CAN_LOGREPLAY or MPX_MODE_CAN_BURST_LOG.

MPXSetBurstLog

Configures frame information for burst mode (single frame).

FormatER MPXSetBurstLog(unsigned long Serial, unsigned char InnerCh, StMPXCANSlot * Frame)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charInnerChinChannel (1 or 2)
StMPXCANSlot *FrameinFrame information
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionConfigures the frame used for burst transfer mode (single frame).
NotesEffective only when communication parameters configured by MPXSetCANParam specify MPX_MODE_CAN_BURST_FRM.

MPXSetLogReplayTrigger

Configures the trigger for starting log replay.

FormatER MPXSetLogReplayTrigger(unsigned long Serial, unsigned char InnerCh, unsigned char TriggerType, StMPXCANID TriggerID)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charInnerChinChannel (1 or 2)
unsigned charTriggerTypeinTrigger type (see Trigger Type)
StMPXCANIDTriggerIDinTrigger ID
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionConfigures the trigger condition that starts log replay for the specified channel.
NotesEffective only when communication parameters configured by MPXSetCANParam specify MPX_MODE_CAN_LOGREPLAY or MPX_MODE_CAN_BURST_LOG. Do not call this API when the operating mode is MPX_MODE_CAN_BURST_FRM.

MPXLogReplayStart

Starts log replay or burst transfer.

FormatER MPXLogReplayStart(unsigned long Serial, unsigned char InnerCh)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charInnerChinChannel (1 or 2)
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_TRG_BUSYTrigger configuration failed
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionStarts log replay mode or burst transfer mode on the specified channel.
NotesIf transmission must begin immediately after monitoring starts, call this API before starting monitoring. Effective only when communication parameters configured by MPXSetCANParam specify MPX_MODE_CAN_LOGREPLAY, MPX_MODE_CAN_BURST_FRM, or MPX_MODE_CAN_BURST_LOG.

MPXLogReplayStop

Stops log replay or burst transfer.

FormatER MPXLogReplayStop(unsigned long Serial, unsigned char InnerCh)
Argumentunsigned longSerialinSerial number of the target MicroPeckerX unit
unsigned charInnerChinChannel (1 or 2)
Return valueERE_OKCompleted successfully
E_PARAMInvalid parameter
E_DEVICEDevice not found
E_COMMCommunication error
E_TIMEOUTCommunication timeout
FunctionStops log replay mode or burst transfer mode on the specified channel.
NotesEffective only when communication parameters configured by MPXSetCANParam specify MPX_MODE_CAN_LOGREPLAY, MPX_MODE_CAN_BURST_FRM, or MPX_MODE_CAN_BURST_LOG.