AN3301 Software
Doc ID 18161 Rev 1 25/35
B: Interrupt handling (normal interrupt mode)
Data acquisition timed by internal timer
void IRQHandler (void) {
if (GetITStatus (INTERRUPT_LINE)! = RESET)
{
/*Clearing the Interrupt pending bit from the Micro-controller*/
ClearITPendingBit (INTERRUPT_LINE);
/*Reading the Interrupt status register*/
STMPE812A_GetInterruptStatus (&Touch_Data [0]);
/*Reading the 4 bytes of x, y & z data from the register address of 0x44 to 0x47*/
I2C_Read_Data (STMPE812A_SLAVE_ADDR, STMPE812A_TSC_DATA, 4, &Touch_Data [1]);
/*Checking the bit 6(release bit) value from Interrupt status register goes low*/
if ((Touch_Data [0] & 0x40) == 0x00)
{
/*Sets the global variable (Is_Pen_Down) to handle the global variables (Touch_Data
[1] to Touch_Data [4] i.e. 4 bytes of x, y & z data coordinates) in the main while
loop*/
Is_Pen_Down = TRUE;
}
/*Handling Coordinates codes should be here */
}
/*Checking the bit 6(release bit) value from Interrupt status register goes
high*/
if ((Touch_Data [0] & 0x40) == 0x40)
{
/*Resets the global variable (Is_Pen_Down) to clear the point (x, y & z data
coordinates) in the main while loop*/
Is_Pen_Down = FALSE;
}
}}
Data acquisition triggered by a write to “ACQ” bit
void IRQHandler (void) {
if (GetITStatus (INTERRUPT_LINE)! = RESET)
{
/*Clearing the Interrupt pending bit from the Micro-controller*/
ClearITPendingBit (INTERRUPT_LINE);
/*Reading the Interrupt status register*/
STMPE812A_GetInterruptStatus (&Touch_Data [0]);
/*Checking either the bit 0 or 1(touch bit or data bit) value from Interrupt status
register goes high*/
Software AN3301
26/35 Doc ID 18161 Rev 1
if (((Touch_Data [0] & 0x01) == 0x01) || ((Touch_Data [0] & 0x02) == 0x02))
{
/*Reading the 4 bytes of x, y & z data from the register address of 0x44 to 0x47*/
I2C_Read_Data (STMPE812A_SLAVE_ADDR, STMPE812A_TSC_DATA, 4, &Touch_Data [1]);
/* Sets the ACQ [4] in the TSC Control Register (0x40) */
STMPE812A_InitiateAcquisition ();
/* Waiting until the ACQ [4] in the TSC Control Register (0x40) goes low */
while (!STMPE812A_IsAcquisitionComplete ())
{}
}
/*Checking the bit 1(data bit) value from Interrupt status register goes high*/
if ((Touch_Data [0] & 0x02) == 0x02)
{
/*Sets the global variable (Is_Pen_Down) to handle the global variables (Touch_Data
[1] to Touch_Data [4] i.e. 4 bytes of x, y & z data coordinates) */
Is_Pen_Down = TRUE;
/*Handling Coordinates codes should be here */
}
/*Checking the bit 6 (release bit) value from Interrupt status register goes high*/
if (((Touch_Data [0] & 0x40) == 0x40))
{
/*Resets the global variable (Is_Pen_Down) to clear the point (x, y & z data
coordinates) in the main while loop*/
Is_Pen_Down = FALSE;
}
}}
Data acquisition using host-controlled sampling rate control
void IRQHandler (void) {
if (GetITStatus (INTERRUPT_LINE)! = RESET)
{
/*Clearing the Interrupt pending bit from the Micro-controller*/
ClearITPendingBit (INTERRUPT_LINE);
AN3301 Software
Doc ID 18161 Rev 1 27/35
/*Reading the Interrupt status register*/
STMPE812A_GetInterruptStatus (&Touch_Data [0]);
/*Checking either the bit 0 or 1(touch bit or data bit) value from Interrupt status
register goes high*/
if (((Touch_Data [0] & 0x01) == 0x01) || ((Touch_Data [0] & 0x02) == 0x02))
{
/*Reading the 4 bytes of x, y & z data from the register address of 0x44 to 0x47*/
I2C_Read_Data (STMPE812A_SLAVE_ADDR, STMPE812A_TSC_DATA, 4, &Touch_Data [1]);
}
/*Checking the bit 1(data bit) value from Interrupt status register goes high*/
if ((Touch_Data [0] & 0x02) == 0x02)
{
/*Sets the global variable (Is_Pen_Down) to handle the global variables (Touch_Data
[1] to Touch_Data [4] i.e. 4 bytes of x, y & z data coordinates) in the main while
loop*/
Is_Pen_Down = TRUE;
/*Handling Coordinates codes should be here */
}
/*Checking the bit 6 (release bit) value from Interrupt status register goes high*/
if (((Touch_Data [0] & 0x40) == 0x40))
{
/*Resets the global variable (Is_Pen_Down) to clear the point (x, y & z data
coordinates) in the main while loop*/
Is_Pen_Down = FALSE;
}
}}

STMPE812ABJR

Mfr. #:
Manufacturer:
STMicroelectronics
Description:
Touch Screen Controllers Touchscreen cntrlr S-Touch
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet