Skip to main content

API Details

This section describes details of each API available in this product.

Legend

This page describes each API in the format below.

Format[Function type] [Function name]([Arguments], ...)
Arguments[Argument type][Argument name][in/out][Argument description]
Return Value[Return type][Return value (error code)][Return value (error code) description]
Function[Function description]
Notes[Notes]

If [Argument type] is a structure, see Structure Definitions (struct) for values to set or values returned.

For [in/out], use in for values set by the caller and out for values set by function processing.

API Details

MPXGetAPIVersion

Gets version information of this API.

FormatER MPXGetAPIVersion(StMPCANVersion * Version)
ArgumentsStMPXAPIVersion *VersionoutAPI version information
Return ValueERE_OKNormal completion
E_PARAMParameter error (such as NULL pointer)
FunctionGets version information of this API.

MPXOpen

Recognizes MicroPeckerX units.

FormatER MPXOpen(StMPXDeviceInfo * Devices, unsigned char * Count)
ArgumentsStMPXDeviceInfo *DevicesoutDevice information of recognized MicroPeckerX units
unsigned char *CountoutNumber of recognized MicroPeckerX units
Return ValueERE_OKNormal completion
E_DEVICEDevice not found
E_COMMCommunication error
E_TIMEOUTCommunication timeout
FunctionRecognizes MicroPeckerX units connected to the PC, and obtains the number of recognized units and their device information.
NotesWhen multiple MicroPeckerX units are connected to the PC, up to four can be recognized simultaneously. However, you cannot arbitrarily specify which units are recognized.

MPXClose

Releases recognition of MicroPeckerX units.

FormatER MPXClose(void)
Return ValueERE_OKNormal completion
FunctionReleases recognition of all currently recognized MicroPeckerX units.

MPXSetLED

Controls LEDs on MicroPeckerX.

FormatER MPXSetLED(unsigned long Serial, unsigned char LEDRed, unsigned char LEDGreen, unsigned char LEDGreenBlink, unsigned char LEDYellow, unsigned char LEDYellowBlink)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charLEDRedinRed LED on
(For allowed values, see "LED Settings")
unsigned charLEDGreeninGreen LED on
(For allowed values, see "LED Settings")
unsigned charLEDGreenBlinkinGreen LED blinking
(For allowed values, see "LED Settings")
unsigned charLEDYellowinYellow LED on
(For allowed values, see "LED Settings")
unsigned charLEDYellowBlinkinYellow LED blinking
(For allowed values, see "LED Settings")
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_TIMEOUTCommunication timeout
FunctionControls LEDs on the MicroPeckerX unit specified by Serial.
For the red LED, setting MPX_LED_ON in LEDRed turns it on, and MPX_LED_OFF turns it off.
For the green LED, setting MPX_LED_ON in LEDGreen turns it on, and MPX_LED_OFF turns it off. If MPX_LED_ON is set in LEDGreenBlink, it blinks regardless of LEDGreen.
For the yellow LED, setting MPX_LED_ON in LEDYellow turns it on, and MPX_LED_OFF turns it off. If MPX_LED_ON is set in LEDYellowBlink, it blinks regardless of LEDYellow.

MPXGetStatus

Gets status of the MicroPeckerX unit.

FormatER MPCANGetStatus(unsigned long Serial, unsigned short * StatusCh1, unsigned short * StatusCh2)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned short *StatusCh1outStatus of CH1
(For set values, see "MicroPeckerX Status")
unsigned short *StatusCh2outStatus of CH2
(For set values, see "MicroPeckerX Status")
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_TIMEOUTCommunication timeout
FunctionGets status of each channel on the MicroPeckerX unit specified by Serial.

MPXMonitorStart

Starts monitoring.

FormatER MPXMonitorStart(unsigned long Serial, unsigned char SyncMode)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charSyncModeinSynchronization mode
(For allowed values, see "[Synchronization mode](/S810-MX-ADL1N/Definition/define#Synchronization mode)")
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionStarts monitoring on the MicroPeckerX unit specified by Serial.
If MPX_SYNC_MASTER is specified for SyncMode, it operates in master mode; if MPX_SYNC_SLAVE is specified, it operates in slave mode.
If slot information has been set with MPXSetSlot, frame transmission also starts for slots whose frame type is MPX_CAN_FRAME_TYPE_PERIODIC or MPX_CAN_FRAME_TYPE_EVENTPERIODIC.
NotesBefore starting monitoring with this API, call MPXSetCANParam to configure communication parameters.
When operating multiple MicroPeckerX units, start monitoring on all units running in slave mode first, then start monitoring on the unit running in master mode.

MPXMonitorStop

Stops monitoring.

FormatER MPXMonitorStop(unsigned long Serial, unsigned long * mSec, unsigned short * uSec)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned long *mSecoutTimestamp (milliseconds)
unsigned short *uSecoutTimestamp (microseconds)
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionStops monitoring on the MicroPeckerX unit specified by Serial and obtains the timestamp at that point.
The timestamp set in mSec and uSec indicates that received logs up to that point are guaranteed.
NotesWhen operating multiple MicroPeckerX units, stop monitoring on the master-mode unit first, then sequentially stop monitoring on slave-mode units.

MPXGetTimeStamp

Gets timestamp.

FormatER MPXGetTimeStamp(unsigned long Serial, unsigned long * mSec, unsigned short * uSec)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned long *mSecoutTimestamp (milliseconds)
unsigned short *uSecoutTimestamp (microseconds)
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionGets the current timestamp of the MicroPeckerX unit specified by Serial.
The acquired timestamp is stored in mSec and uSec.
NotesNote that the timestamp values stored in mSec and uSec may have a time lag from the exact API call timing.

MPXSetGetLogMode

Sets the method for acquiring log information (transmit/receive data) during monitoring.

FormatER MPXSetGetLogMode(unsigned long Serial, unsigned char InnerCh, unsigned char Mode)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charInnerChinTarget channel number (1 or 2)
unsigned charModeinLog acquisition mode
(For allowed values, see "Log Acquisition Mode")
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
FunctionSets how log information sent from the channel specified by Serial and InnerCh is received.
If MPX_GETLOG_CALLBACK is specified in Mode, callback function mode is used. If MPX_GETLOG_GETLOGAPI is specified, log acquisition API mode is used.
NotesIf callback function mode is set, call MPXSetLogCallBack to set the callback function used to acquire log information.
If log acquisition API mode is set, call MPXGetLog or MPXGetLogEx periodically to acquire log information.

MPXSetLogCallBack

Sets a callback function for acquiring log information (transmit/receive data) during monitoring.

FormatER MPXSetLogCallBack(unsigned long Serial, unsigned char InnerCh, void * Self, unsigned char ** Log1, unsigned char ** Log2, void (* CallBack) (unsigned long, unsigned char, void *, unsigned char, unsigned short))
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charInnerChinTarget channel number (1 or 2)
void *SelfinCaller class pointer
unsigned char **Log1inPointer to array storing log information
unsigned char **Log2inPointer to array storing log information
Function pointerCallBackinPointer to callback function
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
FunctionSets a callback function for acquiring log information sent from the channel specified by Serial and InnerCh.
The callback function arguments specified by CallBack are as follows.
[Argument 1: unsigned long] Serial number of the target MicroPeckerX
[Argument 2: unsigned char] Target channel number (1 or 2)
[Argument 3: void *] Caller class pointer
[Argument 4: unsigned char] Log destination (1 for Log1, 2 for Log2)
[Argument 5: unsigned short] Number of valid logs (not size)
NotesThis API is valid only when acquiring logs in callback function mode.

MPXGetLog

Acquires log information (transmit/receive data) during monitoring from the log-structure buffer allocated in the DLL.

FormatER MPXGetLog(unsigned long Serial, unsigned char InnerCh, StMPXCANLog ** Log, unsigned short * Count, unsigned char * BufferOver)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charInnerChinTarget channel number (1 or 2)
StMPXCANLog **LogoutPointer to log information structure array
unsigned short *CountoutNumber of acquired log entries
unsigned char *BufferOveroutBuffer overrun
(For set values, see "Buffer Overrun Flag")
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
FunctionAcquires log information sent from the channel specified by Serial and InnerCh.
For acquired logs, the head pointer of the log-structure buffer allocated in the DLL is set to Log, and the number of logs is set to Count.
If a buffer overrun occurs, MPX_LOG_BUFOVER_TRUE is set to BufferOver.
NotesThis API is valid only when acquiring logs in log acquisition API mode.
With this API, the caller does not need to prepare a structure array for storing acquired logs.

MPXGetLogEx

Acquires log information (transmit/receive data) during monitoring into a log-structure array prepared by the caller.

FormatER MPXGetLog(unsigned long Serial, unsigned char InnerCh, StMPXCANLog * Log, unsigned short Num, unsigned short * Count, unsigned char * BufferOver)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charInnerChinTarget channel number (1 or 2)
StMPXCANLog *Login/outLog information structure array
unsigned shortNuminNumber of elements in the log information structure array
unsigned short *CountoutNumber of acquired log entries
unsigned char *BufferOveroutBuffer overrun
(For set values, see "Buffer Overrun Flag")
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
FunctionAcquires log information sent from the channel specified by Serial and InnerCh.
Specify in Log a structure array for storing acquired logs, and in Num the number of elements in that array.
The number of acquired logs is set to Count.
If Count is greater than Num, a buffer overrun occurs and MPX_LOG_BUFOVER_TRUE is set to BufferOver.
NotesThis API is valid only when acquiring logs in log acquisition API mode.
With this API, the caller must prepare a structure array to store acquired logs.

MPXSetCANParam

Sets CAN or CAN FD communication parameters from predefined options.

FormatER MPXSetCANParam(unsigned long Serial, unsigned char InnerCh, StMPXCANParam * Param)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charInnerChinTarget channel number (1 or 2)
StMPXCANParam *ParaminPointer to parameter configuration structure
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, sets CAN or CAN FD communication parameters to the values specified in Param.
NotesCalling this API changes MicroPeckerX status to MPX_STATUS_PARAM (waiting for parameter configuration).

MPXSetSlot

Sets CAN or CAN FD slot information before monitoring starts.

FormatER MPXSetSlot(unsigned long Serial, unsigned char InnerCh, StMPXCANSlot * Slots, unsigned char SlotCount)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charInnerChinTarget channel number (1 or 2)
StMPXCANSlot *SlotsinSlot information
unsigned charSlotCountinNumber of configured slots
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, sets CAN or CAN FD slot information.
Set in Slots a slot-information structure array for the number of slots to configure, and set in SlotCount the number of elements in that array.
NotesThis API is for setting slot information before monitoring starts.
To set slot information during monitoring, call MPXChangeSlot.

MPXChangeSlot

Sets CAN or CAN FD slot information during monitoring.

FormatER MPCANChangeSlotData(unsigned long Serial, unsigned char InnerCh, unsigned char SlotNo, unsigned char SlotEnabled, unsigned char ReqInfo, StMPXCANFrame * Frame)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charInnerChinTarget channel number (1 or 2)
unsigned charSlotNoinTarget slot number (1 to 28)
unsigned charSlotEnabledinSlot enable/disable
(For allowed values, see "Slot Enable/Disable")
unsigned charReqInfoinSlot change request information
(For allowed values, see "[Slot change request information](/S810-MX-ADL1N/Definition/define#Slot change request information)")
StMPXCANFrame *FrameinPointer to frame-attribute structure
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_TRG_BUSYTrigger setting failed
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, sets CAN or CAN FD slot information specified by SlotNo during monitoring.
NotesThis API is for changing slot enable/disable and CAN/CAN FD frame information settings during monitoring.
To set slot information before monitoring starts, call MPXSetSlot.

MPXSendSlot

Requests transmission using a CAN or CAN FD slot.

FormatER MPXSendSlot(unsigned long Serial, unsigned char Inner_Ch, unsigned char SlotNo)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charInnerChinTarget channel number (1 or 2)
unsigned charSlotNoinTarget slot number (1 to 28)
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_TRG_BUSYTrigger setting failed
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, requests transmission using the CAN or CAN FD slot specified by SlotNo.
NotesThis API is valid only when, in slot information set by MPXSetSlot, the frame type of the slot specified by SlotNo is MPX_CAN_FRAME_TYPE_PERIODIC or MPX_CAN_FRAME_TYPE_EVENTPERIODIC.

MPXDirectSend

Directly transmits a CAN or CAN FD frame without using a slot.

FormatER MPXDirectSend(unsigned long Serial, unsigned char InnerCh, StMPXCANDirect Frame)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charInnerChinTarget channel number (1 or 2)
StMPXCANDirectFrameinTransmission frame
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_DCT_FULLNo free space in direct transmission buffer
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, requests transmission of the frame specified in Frame without using a slot.

MPXSetLogRequestCallBack

Sets a callback function used when the MicroPeckerX unit requests log replay data during operation in log replay mode or burst transfer mode (log replay).

FormatER MPXSetLogRequestCallBack(unsigned long Serial, unsigned char InnerCh, void * Self, void (* CallBack ) (unsigned long, unsigned char, void *, unsigned char, unsigned short))
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charInnerChinTarget channel number (1 or 2)
void *SelfinCaller class pointer
Function pointerCallBackinPointer to callback function
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
FunctionSets a callback function invoked when transmission of log replay data is requested by the channel specified by Serial and InnerCh on a MicroPeckerX unit.
Callback function arguments are as follows.
[Argument 1: unsigned long] Serial number of the target MicroPeckerX
[Argument 2: unsigned char] Target channel number (1 or 2)
[Argument 3: void *] Caller class pointer
[Argument 4: unsigned char] Log depletion flag
[Argument 5: unsigned short] Acceptable log size (bytes)
NotesThis API is valid only when operation mode is MPX_MODE_CAN_LOGREPLAY or MPX_MODE_CAN_BURST_LOG in communication parameters configured by MPXSetCANParam.

MPXSetLogReplayData

Sends log replay data used in log replay mode or burst transfer mode (log replay) to the MicroPeckerX unit.

FormatER MPXSetLogReplayData (unsigned long Serial, unsigned char InnerCh, unsigned char * Log, unsigned long LogCount)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charInnerChinTarget channel number (1 or 2)
unsigned char *LoginLog replay data
unsigned longLogCountinSize of log replay data (bytes)
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_LOG_OVERLog replay data count exceeded
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, sends log replay data.
Set in Log the start address of the log replay data array to send, and set in LogCount the array size.
NotesLog replay data is an array consisting of consecutive frame information entries.For the frame-information structure, see StMPXCANReplayLog. Data (D1 to D64) is variable length.
For each frame information entry, if data length is odd, 1 byte of padding is required after the final data byte (padding value may be arbitrary).
The maximum size of log replay data that can be sent at once is 16,384 bytes.
This API is valid only when operation mode is MPX_MODE_CAN_LOGREPLAY or MPX_MODE_CAN_BURST_LOG in communication parameters configured by MPXSetCANParam.

MPXSetBurstLog

Sets frame information used in burst transfer mode (single frame).

FormatER MPXSetBurstLog(unsigned long Serial, unsigned char InnerCh, StMPXCANSlot * Frame)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charInnerChinTarget channel number (1 or 2)
StMPXCANSlot *FrameinFrame information
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, sets burst transfer mode (single frame) frame information specified by Frame.
NotesThis API is valid only when operation mode is MPX_MODE_CAN_BURST_FRM in communication parameters configured by MPXSetCANParam.

MPXSetLogReplayTrigger

Sets trigger conditions for starting log replay data transmission in log replay mode or burst transfer mode (log replay).

FormatER MPXSetLogReplayTrigger(unsigned long Serial, unsigned char InnerCh, unsigned char TriggerType, StMPXCANId TriggerID)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charInnerChinTarget channel number (1 or 2)
unsigned charTriggerTypeinTrigger type
(For allowed values, see "[Trigger type](/S810-MX-ADL1N/Definition/define#Trigger type)")
StMPXCANIdTriggerIDinTrigger ID
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, sets trigger conditions for starting transmission of log replay data.
NotesThis API is valid only when operation mode is MPX_MODE_CAN_LOGREPLAY or MPX_MODE_CAN_BURST_LOG in communication parameters configured by MPXSetCANParam.
Do not call this API when operation mode is MPX_MODE_CAN_BURST_FRM.

MPXLogReplayStart

Starts transmission in log replay mode or burst transfer mode.

FormatER MPXLogReplayStart(unsigned long Serial, unsigned char InnerCh)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charInnerChinTarget channel number (1 or 2)
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_TRG_BUSYTrigger setting failed
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, starts transmission of log replay data or burst-transfer-mode frames.
NotesIf you want transmission to start immediately after monitoring starts, call this API first and then start monitoring.
This API is valid only when operation mode is one of MPX_MODE_CAN_LOGREPLAY, MPX_MODE_CAN_BURST_FRM, or MPX_MODE_CAN_BURST_LOG in communication parameters configured by MPXSetCANParam.

MPXLogReplayStop

Stops transmission in log replay mode or burst transfer mode.

FormatER MPXLogReplayStop(unsigned long Serial, unsigned char InnerCh)
Argumentsunsigned longSerialinSerial number of target MicroPeckerX unit
unsigned charInnerChinTarget channel number (1 or 2)
Return ValueERE_OKNormal completion
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionFor the channel specified by Serial and InnerCh, stops transmission of log replay data or burst-transfer-mode frames.
NotesThis API is valid only when operation mode is one of MPX_MODE_CAN_LOGREPLAY, MPX_MODE_CAN_BURST_FRM, or MPX_MODE_CAN_BURST_LOG in communication parameters configured by MPXSetCANParam.