Difference between revisions of "Component: Rotary Angle Sensor (101020017) (Grove)"
(XML import) |
|||
Line 16: | Line 16: | ||
==[[File:Component Icon 27104eb6_255f_486e_ad25_b8512b2cc2d4.png|Image]] Rotary Angle Sensor (101020017) component== | ==[[File:Component Icon 27104eb6_255f_486e_ad25_b8512b2cc2d4.png|Image]] Rotary Angle Sensor (101020017) component== | ||
− | The Rotary Angle sensor is based on a simple analogue potentiometer. | + | The Rotary Angle sensor is based on a simple analogue potentiometer. It has an angular range of 300 degrees with a linear change in value, and the resistance is 10kohms. |
+ | |||
+ | There are multiple different macros in order to read the angle as a byte, an integer, a string or as a direct voltage. As well as this, there are options to take the average reading as a byte or an integer. Make sure that simulation is set as ‘no’ and also ensure that you know which channel is connected. | ||
==Examples== | ==Examples== |
Latest revision as of 14:14, 7 September 2018
Author | Matrix Ltd |
Version | 1.0 (Release) |
Category | Grove |
Contents
Rotary Angle Sensor (101020017) component
The Rotary Angle sensor is based on a simple analogue potentiometer. It has an angular range of 300 degrees with a linear change in value, and the resistance is 10kohms.
There are multiple different macros in order to read the angle as a byte, an integer, a string or as a direct voltage. As well as this, there are options to take the average reading as a byte or an integer. Make sure that simulation is set as ‘no’ and also ensure that you know which channel is connected.
Examples
No additional examples
Downloadable macro reference
GetString
Reads the ADC as a direct voltage and returns as as tring
Parameters
- This macro has no parameters
Return value
GetAverageByte
Function call to read the ADC as a byte average sample over time
Parameters
- BYTE NumSamples
- BYTE DelayUs
- Number of micro seconds in between taking each sample
Return value
GetAverageInt
Function call to read the ADC as a full width average sample over time
Parameters
- BYTE NumSamples
- BYTE DelayUs
- Number of micro seconds in between taking each sample
Return value
GetVoltage
Reads the ADC as a direct voltage
Parameters
- This macro has no parameters
Return value
GetInt
Blocking call to read the ADC at full bit depth
Parameters
- This macro has no parameters
Return value
GetByte
Blocking call to read the ADC as a byte
Parameters
- This macro has no parameters
Return value
Simulation macro reference
This component does not contain any simulation macros
Property reference
Tang Color
This property is of type Color picker and can be referenced with the variable name tang_col.
Colour of the moving part of the slider.
Marker Color
This property is of type Color picker and can be referenced with the variable name mark_col.
Colour of the marker line across the slider tang.
Scope Traces
This property is of type True or false and can be referenced with the variable name ScopeTraces.
Selects if the scope traces are automatically generated or not
Channel
This property is of type Single analog pin and can be referenced with the variable name channel.
Analogue input channel - which pin is the analogue input conected to?
VRef voltage
This property is of type Signed integer and can be referenced with the variable name vrefvol.
Used by the GetVoltage or GetString component macros to take an ADC reading and convert it into a Voltage.
+VRef voltage x 10mV
Default 500 = 5.0V
VRef option
This property is of type Fixed list of ints and can be referenced with the variable name vrefop.
Defines what is used as the ADC maximum reference. ADC Range = GND to VRef Voltage.
VDD - Defines the microcontrollers power supply pin as the max reference,
VREF+ Pin - Dedicated pin on the microcontroller to allow for a variable reference voltage.
Conversion speed
This property is of type Fixed list of ints and can be referenced with the variable name convspd.
Clock setting to select how fast the ADC peripheral will perform an ADC conversion.
The FRC setting is based on a RC time base and so will vary with temperature and pressure.
Other settings are generally based on divisions of the master clock.
Aquisition cycles
This property is of type Signed integer and can be referenced with the variable name actime.
Number of micro seconds to wait for the ACD input to charge before starting the analogue sample.
Bit Depth
This property is of type Signed integer and can be referenced with the variable name bits.
Maximum number of digital bits the ADC can sample.
8 bit = ADC range 0 - 255
10 bit = ADC range 0 - 1023
12 bit = ADC range 0 - 4095