Difference between revisions of "Component: Digital Temperature (EBM004) (EBM Modules)"

From Flowcode Help
Jump to navigationJump to search
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color:gray;" | Author
 
| Matrix TSL
 
| Matrix TSL
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color:gray;" | Version
| 2.0 (Release)
+
| 2.0
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color:gray;" | Category
 
| EBM Modules
 
| EBM Modules
 
|}
 
|}
  
  
 +
==Digital Temperature component==
 +
A digital temperature sensor based around the LM75B chip.
  
==[[File:Component Icon e3fdcca6_1408_4389_8e2d_e741b06b3463.png|Image]] Digital Temperature (EBM004) component==
+
==Detailed description==
A digital temperature sensor based around the LM75B chip.
+
 
 +
''No detailed description exists yet for this component''
  
 
==Examples==
 
==Examples==
 +
 +
  
 
This example simply reads the value from the digital temperature sensor and outputs the value to an LCD as a temperature in degrees C.
 
This example simply reads the value from the digital temperature sensor and outputs the value to an LCD as a temperature in degrees C.
Line 27: Line 30:
 
==Downloadable macro reference==
 
==Downloadable macro reference==
  
===<span style="font-weight: normal;"><u><tt>ReadInt</tt></u></span>===
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
Read double byte data from register at address
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadInt'''
 +
|-
 +
| colspan="2" | Read double byte data from register at address&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | address
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] -
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''address''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadFloat'''
 +
|-
 +
| colspan="2" | Reads the temperature value as a float&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] -
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
'''Return value'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteByte'''
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | address
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | data
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:[[Variable Types|INT]]
 
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteInt'''
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | address
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | data
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
===<span style="font-weight: normal;"><u><tt>ReadFloat</tt></u></span>===
 
Reads the temperature value as a float
 
  
'''Parameters'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadByte'''
 +
|-
 +
| colspan="2" | Read a single byte at a specific address  from the chip's internal memory.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | address
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:''This macro has no parameters''
 
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Uninit'''
 +
|-
 +
| colspan="2" | Uninitialise and release resources&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Return value'''
 
  
:[[Variable Types|FLOAT]]
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 +
|-
 +
| colspan="2" | Initialise to default of 11 bit resolution&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
===<span style="font-weight: normal;"><u><tt>WriteByte</tt></u></span>===
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
''<span style="color:red;">No additional information</span>''
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 +
|-
 +
| colspan="2" | Initialise the sensor configuration as set by the component properties&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 +
|-
 +
| colspan="2" | Stes up the I2C bus and initialises the termperature sensor ready for use.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''address''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SimSetGyro'''
 +
|-
 +
| colspan="2" | Allows the XYZ slider values to be set via the simulation&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:]] -
 +
| width="90%" | X
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:]] -
 +
| width="90%" | Y
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:]] -
 +
| width="90%" | Z
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:[[Variable Types|BYTE]] ''data''
 
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''UpdateAccelerometerData'''
 +
|-
 +
| colspan="2" | Reads from the accelerometer and updates the local XYZ variables. Returns 1 for new data and 0 for no new data&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Return value'''
 
  
:[[Variable Types|BYTE]]
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SimSetCompass'''
 +
|-
 +
| colspan="2" | Allows the XYZ slider values to be set via the simulation&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:]] -
 +
| width="90%" | X
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:]] -
 +
| width="90%" | Y
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:]] -
 +
| width="90%" | Z
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
===<span style="font-weight: normal;"><u><tt>WriteInt</tt></u></span>===
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
''<span style="color:red;">No additional information</span>''
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Read_Bearing'''
 +
|-
 +
| colspan="2" | Reads the current sensor compass bearing based on degrees CW from magnetic north. Returns 0-359 where 0 = North, 90 = East, 180 = South, 270 = West Requires the ArcTan floating point function to be available to work correctly. Supported on AVR, 16-bit &nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | NumSamples
 +
|-
 +
| colspan="2" | The number of readings to base the bearing on&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 +
|-
 +
| colspan="2" | Sets up up the communication bus and initialises the accelerometer module.  Returns 0 for success and > 0 for fail.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''address''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''IOSetOutputPin'''
 +
|-
 +
| colspan="2" | Sets the selected digital pin to an output and assigns the output state.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Pin
 +
|-
 +
| colspan="2" | Range: 0-29&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:]] -
 +
| width="90%" | State
 +
|-
 +
| colspan="2" | Range: 0-1&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:[[Variable Types|UINT]] ''data''
 
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''UARTReceive'''
 +
|-
 +
| colspan="2" | Receives a data byte from the UART. Recommend calling the UARTCheckRx function first to ensure data is available.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | Channel Index: Range 0 - UART Bus Count - 1&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Return value'''
 
  
:[[Variable Types|BYTE]]
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ADCSampleAverage10'''
 +
|-
 +
| colspan="2" | Reads the voltage present on an Analog pin as an 10-bit value range 0-1023. Performs the selected number of samples with the selected time in microseconds in between samples&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | ADCChannel
 +
|-
 +
| colspan="2" | Range: 0, 3-7&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | SampleCount
 +
|-
 +
| colspan="2" | Range: 1- 100&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | SampleDelay
 +
|-
 +
| colspan="2" | Delay in us between each sample&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
===<span style="font-weight: normal;"><u><tt>ReadByte</tt></u></span>===
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
Read a single byte at a specific address  from the chip's internal memory.
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''OneWireScanBus'''
 +
|-
 +
| colspan="2" | Scans the one wire bus to detect all connected devices. Returns the number of one wire devices found.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''address''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SPIInitialise'''
 +
|-
 +
| colspan="2" | Initialsie the SPI module ready for communications&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | Channel Index: Range 0 - SPI Bus Count - 1&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
'''Return value'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''OneWireReceiveByte'''
 +
|-
 +
| colspan="2" | Receives a byte from the one wire bus a bit at a time&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:[[Variable Types|BYTE]]
 
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''I2CSend'''
 +
|-
 +
| colspan="2" | Transmit a byte using the I2C bus&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | DataOut
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] -
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
===<span style="font-weight: normal;"><u><tt>Uninit</tt></u></span>===
 
Uninitialise and release resources
 
  
'''Parameters'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''UARTSend'''
 +
|-
 +
| colspan="2" | Send a byte via the UART module&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | Channel Index: Range 0 - UART Bus Count - 1&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Data
 +
|-
 +
| colspan="2" | Data Byte to send. Range: 0-255&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:''This macro has no parameters''
 
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''OneWireGetDeviceCount'''
 +
|-
 +
| colspan="2" | Returns the number of devices found by the last ScanBus operation.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | Channel Index: Range 0 - I2C Bus Count - 1&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Return value'''
 
  
:''This call does not return a value''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PWMSetPrescaler'''
 +
|-
 +
| colspan="2" | Sets the prescaler for the PWM output&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | Range: 0 - 11&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Prescaler
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Period
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
Initialise to default of 11 bit resolution
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PWMEnable'''
 +
|-
 +
| colspan="2" | Enable a PWM output&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | Range: 0-11&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Parameters'''
 
  
:''This macro has no parameters''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ADCSampleArray10'''
 +
|-
 +
| colspan="2" | Reads the voltage present on an Analog pin as an 10-bit value range 0-1023 Performs the selected number of samples with the selected time in microseconds in between samples and returns each sample in a single packet&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | ADCChannel
 +
|-
 +
| colspan="2" | Range: 0, 3-7&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | SampleCount
 +
|-
 +
| colspan="2" | Range: 1- 32&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | SampleDelay
 +
|-
 +
| colspan="2" | Delay in us between each sample&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Samples
 +
|-
 +
| colspan="2" | 10-bit samples returned from the function&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
'''Return value'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ADCSampleAverage8'''
 +
|-
 +
| colspan="2" | Reads the voltage present on an Analog pin as an 8-bit value range 0-255 Performs the selected number of samples with the selected time in microseconds in between samples&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | ADCChannel
 +
|-
 +
| colspan="2" | Range: 0, 3-7&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | SampleCount
 +
|-
 +
| colspan="2" | Range: 1- 100&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | SampleDelay
 +
|-
 +
| colspan="2" | Delay in us between each sample&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:[[Variable Types|BYTE]]
 
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 +
|-
 +
| colspan="2" | Initialise the comms to the Arduino board ready for commands to be sent.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
==Simulation macro reference==
 
 
''This component does not contain any simulation macros''
 
  
  
 
==Property reference==
 
==Property reference==
<span style="font-weight: normal;"><u>Channel</u></span>
 
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_i2c1::CHANNEL''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
Channel selection
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
<span style="font-weight: normal;"><u>SDA</u></span>
+
|-
 
+
|-
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_i2c1::SDA''.
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Channel
Pin used for SDA (data signal)
+
|-
 
+
| colspan="2" | Channel selection&nbsp;
<span style="font-weight: normal;"><u>SCL</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_i2c1::SCL''.
+
| width="90%" | SDA
 
+
|-
Pin used for SCL (clock signal)
+
| colspan="2" | Pin used for SDA (data signal)&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Baud Select</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | SCL
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_i2c1::BAUD_LIST''.
+
|-
 
+
| colspan="2" | Pin used for SCL (clock signal)&nbsp;
Baud rate option selector
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
<span style="font-weight: normal;"><u>Baud Rate</u></span>
+
| width="90%" | Baud Select
 
+
|-
This property is of type ''Signed integer'' and can be referenced with the variable name ''cal_i2c1::BAUD''.
+
| colspan="2" | Baud rate option selector&nbsp;
 
+
|-
Baud rate to be used
+
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
+
| width="90%" | Baud Rate
<span style="font-weight: normal;"><u>Stop Delay</u></span>
+
|-
 
+
| colspan="2" | Baud rate to be used&nbsp;
This property is of type ''True or false'' and can be referenced with the variable name ''cal_i2c1::StopDel''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not  
+
| width="90%" | Stop Delay
 
+
|-
a 10ms delay between an I2C stop event and the next I2C start event.
+
| colspan="2" | On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications. &nbsp;
 
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
+
| width="90%" | Min. Temp.
Most modern microcontrollers will not have a problem so this property can be disabled to speed up the  
+
|-
 
+
| colspan="2" | Minimum termperature that can be set or displayed on the thermometer slider.&nbsp;
I2C communications.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
<span style="font-weight: normal;"><u>Simulation Type</u></span>
+
| width="90%" | Max. Temp.
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''SimType''.
+
| colspan="2" | Maximum termperature that can be set or displayed on the thermometer slider.&nbsp;
 
+
|-
''<span style="color:red;">No additional information</span>''
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Scale divisions
 
+
|-
 
+
| colspan="2" | Number of numbered divisions shown on the thermometer scale.&nbsp;
<span style="font-weight: normal;"><u>Label</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
This property is of type ''Line of text'' and can be referenced with the variable name ''label''.
+
| width="90%" | I2C Data
 
+
|-
A text label to help you identify the component on the panel.
+
| colspan="2" | Set whether the I2C data is displayed as decimal or hexadecimal numbers.&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Min. Temp.</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
+
| width="90%" | Scope Traces
This property is of type ''Floating point'' and can be referenced with the variable name ''min_temp''.
+
|-
 
+
| colspan="2" | Selects if the component pin connections are automatically generated on the data recorder window or not. Yes: Automatically add the component pins to a group on the data recorder which will reflect the sim data during simultion. No: Do not show the pin signals on the data recorder window.&nbsp;
Minimum termperature that can be set or displayed on the thermometer slider.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
<span style="font-weight: normal;"><u>Max. Temp.</u></span>
+
| width="90%" | Console Data
 
+
|-
This property is of type ''Floating point'' and can be referenced with the variable name ''max_temp''.
+
| colspan="2" | Selects if the console data is automatically generated or not&nbsp;
 
+
|-
Maximum termperature that can be set or displayed on the thermometer slider.
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | API
<span style="font-weight: normal;"><u>Scale divisions</u></span>
+
|-
 
+
| colspan="2" | &nbsp;
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''scale_divisions''.
+
|-
 
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
Number of numbered divisions shown on the thermometer scale.
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections'''  
 
+
|-
<span style="font-weight: normal;"><u>I2C Data</u></span>
+
|-
 
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''number_base''.
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations'''  
 
+
|-
Set whether the I2C data is displayed as decimal or hexadecimal numbers.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
<span style="font-weight: normal;"><u>Scope Traces</u></span>
+
| width="90%" | Simulation Comms
 
+
|-
This property is of type ''True or false'' and can be referenced with the variable name ''cal_i2c1::ScopeTraces''.
+
| colspan="2" | &nbsp;
 
+
|}
Selects if the component pin connections are automatically generated on the data recorder window or not.
 
 
 
Yes: Automatically add the component pins to a group on the data recorder which will reflect the sim data during simultion.
 
 
 
No: Do not show the pin signals on the data recorder window.
 
 
 
<span style="font-weight: normal;"><u>Console Data</u></span>
 
 
 
This property is of type ''True or false'' and can be referenced with the variable name ''cal_i2c1::ConsoleData''.
 
 
 
Selects if the console data is automatically generated or not
 
 
 
<span style="font-weight: normal;"><u>Injector</u></span>
 
 
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_i2c1::Injector''.
 
 
 
''<span style="color:red;">No additional information</span>''
 

Revision as of 20:45, 16 November 2021

Author Matrix TSL
Version 2.0
Category EBM Modules


Digital Temperature component

A digital temperature sensor based around the LM75B chip.

Detailed description

No detailed description exists yet for this component

Examples

This example simply reads the value from the digital temperature sensor and outputs the value to an LCD as a temperature in degrees C.

FC6 Icon.png EBM004 Example


Downloadable macro reference

Fc9-comp-macro.png ReadInt
Read double byte data from register at address 
Fc9-u8-icon.png - BYTE address
 
[[File:]] - Return


Fc9-comp-macro.png ReadFloat
Reads the temperature value as a float 
[[File:]] - Return


Fc9-comp-macro.png WriteByte
 
Fc9-u8-icon.png - BYTE address
 
Fc9-u8-icon.png - BYTE data
 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png WriteInt
 
Fc9-u8-icon.png - BYTE address
 
Fc9-u16-icon.png - UINT data
 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png ReadByte
Read a single byte at a specific address from the chip's internal memory. 
Fc9-u8-icon.png - BYTE address
 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png Uninit
Uninitialise and release resources 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Initialise
Initialise to default of 11 bit resolution 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png Initialise
Initialise the sensor configuration as set by the component properties 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Initialise
Stes up the I2C bus and initialises the termperature sensor ready for use. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SimSetGyro
Allows the XYZ slider values to be set via the simulation 
[[File:]] - X
 
[[File:]] - Y
 
[[File:]] - Z
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png UpdateAccelerometerData
Reads from the accelerometer and updates the local XYZ variables. Returns 1 for new data and 0 for no new data 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png SimSetCompass
Allows the XYZ slider values to be set via the simulation 
[[File:]] - X
 
[[File:]] - Y
 
[[File:]] - Z
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Read_Bearing
Reads the current sensor compass bearing based on degrees CW from magnetic north. Returns 0-359 where 0 = North, 90 = East, 180 = South, 270 = West Requires the ArcTan floating point function to be available to work correctly. Supported on AVR, 16-bit  
Fc9-u8-icon.png - BYTE NumSamples
The number of readings to base the bearing on 
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png Initialise
Sets up up the communication bus and initialises the accelerometer module. Returns 0 for success and > 0 for fail. 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png IOSetOutputPin
Sets the selected digital pin to an output and assigns the output state. 
Fc9-u8-icon.png - BYTE Pin
Range: 0-29 
[[File:]] - State
Range: 0-1 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png UARTReceive
Receives a data byte from the UART. Recommend calling the UARTCheckRx function first to ensure data is available. 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - UART Bus Count - 1 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png ADCSampleAverage10
Reads the voltage present on an Analog pin as an 10-bit value range 0-1023. Performs the selected number of samples with the selected time in microseconds in between samples 
Fc9-u8-icon.png - BYTE ADCChannel
Range: 0, 3-7 
Fc9-u8-icon.png - BYTE SampleCount
Range: 1- 100 
Fc9-u8-icon.png - BYTE SampleDelay
Delay in us between each sample 
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png OneWireScanBus
Scans the one wire bus to detect all connected devices. Returns the number of one wire devices found. 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png SPIInitialise
Initialsie the SPI module ready for communications 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - SPI Bus Count - 1 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png OneWireReceiveByte
Receives a byte from the one wire bus a bit at a time 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png I2CSend
Transmit a byte using the I2C bus 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
Fc9-u8-icon.png - BYTE DataOut
 
[[File:]] - Return


Fc9-comp-macro.png UARTSend
Send a byte via the UART module 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - UART Bus Count - 1 
Fc9-u8-icon.png - BYTE Data
Data Byte to send. Range: 0-255 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png OneWireGetDeviceCount
Returns the number of devices found by the last ScanBus operation. 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png PWMSetPrescaler
Sets the prescaler for the PWM output 
Fc9-u8-icon.png - BYTE Channel
Range: 0 - 11 
Fc9-u8-icon.png - BYTE Prescaler
 
Fc9-u8-icon.png - BYTE Period
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png PWMEnable
Enable a PWM output 
Fc9-u8-icon.png - BYTE Channel
Range: 0-11 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ADCSampleArray10
Reads the voltage present on an Analog pin as an 10-bit value range 0-1023 Performs the selected number of samples with the selected time in microseconds in between samples and returns each sample in a single packet 
Fc9-u8-icon.png - BYTE ADCChannel
Range: 0, 3-7 
Fc9-u8-icon.png - BYTE SampleCount
Range: 1- 32 
Fc9-u16-icon.png - UINT SampleDelay
Delay in us between each sample 
Fc9-u16-icon.png - UINT Samples
10-bit samples returned from the function 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ADCSampleAverage8
Reads the voltage present on an Analog pin as an 8-bit value range 0-255 Performs the selected number of samples with the selected time in microseconds in between samples 
Fc9-u8-icon.png - BYTE ADCChannel
Range: 0, 3-7 
Fc9-u8-icon.png - BYTE SampleCount
Range: 1- 100 
Fc9-u8-icon.png - BYTE SampleDelay
Delay in us between each sample 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png Initialise
Initialise the comms to the Arduino board ready for commands to be sent. 
Fc9-void-icon.png - VOID Return



Property reference

Fc9-prop-icon.png Properties
Fc9-type-16-icon.png Channel
Channel selection 
Fc9-type-5-icon.png SDA
Pin used for SDA (data signal) 
Fc9-type-5-icon.png SCL
Pin used for SCL (clock signal) 
Fc9-type-16-icon.png Baud Select
Baud rate option selector 
Fc9-type-14-icon.png Baud Rate
Baud rate to be used 
Fc9-type-7-icon.png Stop Delay
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications.  
Fc9-type-15-icon.png Min. Temp.
Minimum termperature that can be set or displayed on the thermometer slider. 
Fc9-type-15-icon.png Max. Temp.
Maximum termperature that can be set or displayed on the thermometer slider. 
Fc9-type-21-icon.png Scale divisions
Number of numbered divisions shown on the thermometer scale. 
Fc9-type-16-icon.png I2C Data
Set whether the I2C data is displayed as decimal or hexadecimal numbers. 
Fc9-type-7-icon.png Scope Traces
Selects if the component pin connections are automatically generated on the data recorder window or not. Yes: Automatically add the component pins to a group on the data recorder which will reflect the sim data during simultion. No: Do not show the pin signals on the data recorder window. 
Fc9-type-7-icon.png Console Data
Selects if the console data is automatically generated or not 
Fc9-type-16-icon.png API
 
Fc9-conn-icon.png Connections
Fc9-conn-icon.png Simulations
Fc9-type-7-icon.png Simulation Comms