Author
|
Matrix TSL
|
Version
|
1.0
|
Category
|
Graphical Library
|
Touch Screen (Resistive) component
Routines for reading a simple resistive touch screen directly without interface IC.
Version information
Library Version, Component Version, Date, Author, Info
9, 1.0, 26-07-24, BR, Renamed component to match other touchscreen components
Detailed description
No detailed description exists yet for this component
Examples
An example of how to calibrate and read a resistive touch display overlay using the component.
Resistive Touch Demo
Calibration is stored into EEPROM memory so as to avoid having to repeat it on every power up.
Macro reference
Calibrate
|
Calibrate
|
Performs a calibration routine which draws a circle at the top left of the screen followed by the bottom right of the screen, from these coordinates the component can work out the corresponding X,Y pixel coordinate.
|
- UINT
|
Margin
|
Margin from the edge of the display, Range 0-63
|
- UINT
|
Radius
|
Radius of the calibration touch marker, should be <= margin
|
- VOID
|
Return
|
GetCalibrationValues
|
GetCalibrationValues
|
Returns one of five calibration values used to configure the touchscreen. Populated automatically after running the calibration macro. Allows calibration data to be retrieved and stored into EEPROM by the user.
|
- BYTE
|
Index
|
Range: 0-4 Where 0=Xmin, 1=Xmax, 2=Ymin, 3=Ymax, 4=Flags
|
- UINT
|
Return
|
GetCoord
|
GetCoord
|
Gets the coordinate from the last valid touch event
|
- BYTE
|
Index
|
0=X, 1=Y
|
- UINT
|
Return
|
IsTouched
|
IsTouched
|
Check to see if display has been touched
|
- BOOL
|
Return
|
SetCalibrationValues
|
SetCalibrationValues
|
Sets the calibration values used to configure the touchscreen. Allows the touchscreen to be re-calibrated from EE memory after a power cycle without re-running the calibration macro.
|
- UINT
|
Xmin
|
Calibration value ADC representin Min X
|
- UINT
|
Xmax
|
Calibration value ADC representin Max X
|
- UINT
|
Ymin
|
Calibration value ADC representin Min Y
|
- UINT
|
Ymax
|
Calibration value ADC representin Max Y
|
- UINT
|
Flags
|
Flags variable containing margin and X/Y flip status
|
- VOID
|
Return
|
SetOrientation
|
SetOrientation
|
Sets the orientation of the touchscreen to match the orientation of the graphical display.
|
- BYTE
|
Orientation
|
Range: 0-3 default = 0
|
- VOID
|
Return
|
Property reference
|
Properties
|
|
LinkTo
|
|
|
Connections
|
|
XP Pin
|
|
|
XM Pin
|
|
|
YP Pin
|
|
|
YM Pin
|
|
|
XM Analog Pin
|
|
|
YP Analog Pin
|
|
|
Configuration
|
|
X Pixel
|
|
|
Y Pixel
|
|
|
Trigger Pressure
|
Reading between X and Y which signifies a valid touch pressure.
|
|
Acceptable Noise
|
Amount of acceptable noise on the input between samples before we allow a valid touch to be recorded.
|
|
Sense Loop Count
|
Number of times to sample and compare the touch to confirm a valid touch press.
|
|
Average ADC Count
|
Number of ADC samples used to create an averaged ADC input reading to help reduce input noise.
|
|
Sample Timing (us)
|
Microsecond delay in between each of the averaged samples.
|
|
ADC options
|
|
VRef option
|
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
|
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.
|
|
Acquisition cycles
|
Number of micro seconds to wait for the ADC input to charge before starting the analogue sample.
|
|
Simulation
|
|
Enable Interrupt
|
|
|
Interrupt Macro
|
|
Component Source Code
Please click here to download the component source project: FC_Comp_Source_TouchScreen_Resistive.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_TouchScreen_Resistive.fcfx