Signal Logging with C

Signal value logging

To log signal values and times, add a real-time file scope from your C program. A file scope creates a file on the target computer that you can download to the development computer for offline analysis.

C/C++ API

expand all

xPCAddScopeCreate scope
xPCSetScopeSet properties of scope
xPCRemScopeRemove scope
xPCGetNumScopesReturn number of scopes added to real-time application
xPCGetScopeGet and copy scope data to structure
xPCGetScopeListGet and copy list of scope numbers
xPCGetScopesGet and copy list of scope numbers
xPCScAddSignalAdd signal to scope
xPCScRemSignalRemove signal from scope
xPCScGetNumSignalsGet number of signals in scope
xPCScGetSignalListCopy list of signals to array
xPCScGetSignalsCopy list of signals to array
xPCGetNumSignalsReturn number of signals
xPCGetSigIdxfromLabelReturn array of signal indices
xPCGetSigLabelWidthReturn number of elements in signal
xPCGetSignalReturn value of signal
xPCGetSignalIdxReturn index for signal
xPCGetSignalLabelCopy label of signal to character array
xPCGetSignalNameCopy name of signal to character array
xPCGetSignalsReturn vector of signal values
xPCGetSignalWidthReturn width of signal
xPCScGetTypeGet type of scope
xPCScSetAutoRestartScope autorestart status
xPCScGetAutoRestartScope autorestart status
xPCScSetDecimationSet decimation of scope
xPCScGetDecimationReturn decimation of scope
xPCScSetNumPrePostSamplesSet number of pre- or posttriggering samples before triggering scope
xPCScGetNumPrePostSamplesGet number of pre- or post-triggering samples before triggering scope
xPCScSetNumSamplesSet number of samples in one data acquisition cycle
xPCScGetNumSamplesGet number of samples in one data acquisition cycle
xPCScGetStartTimeGet start time for last data acquisition cycle
xPCGetNumOutputsReturn number of outputs
xPCGetNumStatesReturn number of states
xPCGetLogModeReturn logging mode and increment value for real-time application
xPCGetOutputLogCopy output log data to array
xPCGetStateLogCopy state log values to array
xPCGetTETLogCopy TET log to array
xPCGetTimeLogCopy time log to array
xPCMaxLogSamplesReturn maximum number of samples that can be in log buffer
xPCNumLogSamplesReturn number of samples in log buffer
xPCNumLogWrapsReturn number of times log buffer wraps
xPCSetLogModeSet logging mode and increment value of scope
xPCScSetTriggerLevelSet trigger level for scope
xPCScGetTriggerLevelGet trigger level for scope
xPCScSetTriggerModeSet trigger mode of scope
xPCScGetTriggerModeGet trigger mode for scope
xPCScSetTriggerScopeSelect scope for triggering another scope
xPCScGetTriggerScopeGet trigger scope
xPCScSetTriggerScopeSampleSet sample number for triggering scope
xPCScGetTriggerScopeSampleGet sample number for triggering scope
xPCScSetTriggerSignalSelect signal for triggering scope
xPCScGetTriggerSignalGet trigger signal for scope
xPCScSetTriggerSlopeSet slope of signal that triggers scope
xPCScGetTriggerSlopeGet trigger slope for scope
xPCScSoftwareTriggerSet software trigger of scope
xPCScStartStart data acquisition for scope
xPCScStopStop data acquisition for scope
xPCIsScFinishedReturn data acquisition status for scope
xPCScGetDataCopy scope data to array
xPCScGetStateGet state of scope
xPCFSCDChange current folder on target computer to specified path
xPCFSDirGet contents of specified folder on target computer
xPCFSDirItemsGet contents of specified folder on target computer
xPCFSGetErrorGet text description for error number on target computer file system
xPCFSGetPWDGet current folder of target computer
xPCFSMKDIRCreate folder on target computer
xPCFSRMDIRRemove folder from target computer
xPCFSDirSizeReturn size of specified folder listing on target computer
xPCFSDirStructSizeGet number of items in folder
xPCFSDiskInfoInformation about target computer file system
xPCFSOpenFileOpen file on target computer
xPCFSCloseFileClose file on target computer
xPCFSWriteFileWrite to file on target computer
xPCFSReadFileRead open file on target computer
xPCFSRemoveFileRemove file from target computer
xPCFSFileInfoReturn information for open file on target computer
xPCFSGetFileSizeReturn size of file on target computer
xPCFSScGetFilenameGet name of file for scope
xPCFSScGetWriteModeGet write mode of file for scope
xPCFSScGetWriteSizeGet block write size of data chunks
xPCFSScSetFilenameSpecify name for file to contain signal data
xPCFSScSetWriteModeSpecify when file allocation table entry is updated
xPCFSScSetWriteSizeSpecify that memory buffer collect data in multiples of write size
xPCErrorMsgReturn text description for error message
xPCGetLastErrorReturn constant of last error
xPCSetLastErrorSet last error to specific character string constant
scopedataType definition for scope data structure
lgmodeType definition for logging options structure
dirStructType definition for file system folder information structure
diskinfoType definition for file system disk information structure
fileinfoType definition for file information structure

Topics

Signal Logging

Signal Logging Basics

Acquire signal data while running a real-time application and transfer the data to the development computer for analysis.

File System Basics

Access the target computer file system with the SimulinkRealTime.fileSystem object.

C Interface

Simulink Real-Time C API

Complying with the coding requirements of the Simulink® Real-Time™ C API library.

Using the C API

Complying with the requirements for using the Simulink Real-Time C API.

C API Error Messages

Interpreting error codes produced by the C API.

Limitations

Troubleshoot Signals Not Accessible by Name

Investigate issues for some signal types prevent monitoring, tracing, or logging.

Internationalization Issues

Learn about Simulink Real-Time support for internationalization.