Digole
Digital Solutions
iDigole Buyer ProtectioniDigole Buyer
Protection
My shopping cart
0 Items:
Secure Checkout
Top Rated Plus
Visit Our Live Auctions
99.9% Customer's Satisfaction
Search store:
 
Forum : Digole Serial Display : Color LCD Modules :

 Search Forum.. 
 Creat New Topic   Reply 

penirq + RPNXYI --> endless loop?

Polling RPNXYI at regular intervals to check for touches on the screen can be made to work, but it lacks reliability. Therefore, upon your advice in other such topics I connected the penirq now. This correctly detects clicks, but it also is pulled down when calling either of the RPNXYx-functions. So, when reading the data in response to the penirq interrupt, causes a new interrupt, and another one, etc.

How should I read the touchscreen click without causing an endless loop?

RE:penirq + RPNXYI --> endless loop?

 Disable the "PenIRQ" interrupt before issueing "RPNXYx", then enable the interrupt after reading the data

RE:penirq + RPNXYI --> endless loop?

Is there any code example available where it actually works?

RE:penirq + RPNXYI --> endless loop?

It's depends on your circuit and your controller.

RE:penirq + RPNXYI --> endless loop?

I use i2c.

RE:penirq + RPNXYI --> endless loop?

It's not regarding I2C.

The PENIRQ only pull low when touched on the screen or processing "RPNXYx" commands, you can disable the PENIRQ interupt during your controller processing "RPNXYx" command, then enable it again, this is upon your circuit and your controller hardware. usually like this:

1) enable PENIRQ pull low interupt

2) in PENIRQ pull low interupt routing, disable PENIRQ interupt, send "RPNXYx" command, read out data, enable PENIRQ pull low interupt 

 

RE:penirq + RPNXYI --> endless loop?

I know the general principle, but this is no code and so it can easily do away with things such as timing. Without a working demonstration I will remain convinced that it cannot be done.

RE:penirq + RPNXYI --> endless loop?

If you know how to disable/enable interupt, then it will be easy, for me, only 2 lines of extra code:

GIE=0;

//send RPNXYx to display

//waiting and read data from display

GIE=1;

The GIE is global interupt control bit in all PIC controller.

For Arduino, use noInterrupts() and Interrupts(), different MCU use different code, you need to refer your MCU manual.

RE:penirq + RPNXYI --> endless loop?

The interrupts pose no problem at all. But what is this:

//waiting and read data from display

I either get no response (device not ready) or a timeout.

Or, in case of RPNXYI, nonsense coordinates (&xffff or 40800 or something).

 

RE:penirq + RPNXYI --> endless loop?

You even don't need PENIRQ, just use "RPNXYI", if the first byte of data is 0xFF, then means no touch on the screen. you can put this check in a timer interrupt.

Copyright Digole Digital Solutions, 2008-2021. All rights reserved.
Powered by Victor Sun