Navigation: Interfaces > Main Interface > Menu Options > Devices >

ADC-10-F103C

 

 

 

 

ADC-10-F103C Modules

Currently the only device added is the ADC-10-F103C Modules which are 12-bit, 10 channel ADC's which send data at 115200 in the format of:

 

CH1:2247          1.782V

CH2:2439          1.914V

CH3:2270          1.792V

CH4:2177          1.658V

...

 

Which defines the channel, the raw data value and the voltage.

 

By selecting this device, the following code is added the Main Interface's Event Code to parse the data message string and plot it using the plotChan instruction.
!plot.plotChan channel, value

 

<message>!makeVar varChan  // create variables

<message>!makeVar varValue

<message>!varChan={:: [messageString] ::2::1::subString }  // parse out channel and value

<message>!varValue={:: [messageString] ::9::5::subString }

<message>!plot.plotChan [varChan], [varValue]

 

This code parses the channel (substring starting at 2 for 1 character) and the voltage (substring starting at 9 for 5 characters).

 

Multi-Plot Example

For sending data to multiple plots, or choosing which channel to plot, the following example can be used by adding it to the Main's Event Code and modifying as needed.

 

<message>!makeVar varChan  // create variables

<message>!makeVar varValue

<message>!varChan={:: [messageString] ::2::1::subString }  // parse out channel and value

<message>!varValue={:: [messageString] ::9::5::subString }

<message>!if [varChan]==0 !then !plot0.plotChan 0,[varValue]            // based on channel, plot on a named plot

<message>!if [varChan]==1 !then !plot1.plotChan 0,[varValue]

<message>!if [varChan]==2 !then !plot2.plotChan 0,[varValue]

<message>!if [varChan]==3 !then !plot3.plotChan 0,[varValue]

 

The plotChan instruction's syntax is:
!plotName.plotChan channel (0-9), value

 

Once plotted, other controls or code can access the value with [plotName.ch0] to [plotName.ch9]

 

Scaling the Plotted Data

Data may be scaled using the plot's Settings menu through the pop-up and adding a formula for the channel. For example, to scale channel 0, which is plotting [ain0], for a range of 0 to 300 based on voltage range of 0 to 3.3:

 

[ain0] * 300 / 3.3

 

 

 

 

 

 

Copyright © 2024 SelmaWare Solutions, LLC