running Touch in background while doing other tasks on 40x2

James Ward

New Member
I am building an led cube, and am using the picaxe 40x2 to both receive touch inputs from a single touch input while pulsing the leds at the same time. does anyone know how I would do this. I am open to suggestions such as using a second small 08m2 to handle the touch simultaneously.
 

hippy

Ex-Staff (retired)
Welcome to the PICAXE forum.

There is no ability to run TOUCH in the background on an X2. Using a PICAXE 08M2 could be the best option. That can set an output high when touched and the 40X2 can check that as an input signal.
 

James Ward

New Member
Thanks so much hippy how much of a delay would an if command take to run just to check pin input high or low if i added a resonator to take it up to 64mhz? rough numbers don't matter. also toying with the idea of using an 08m2 as the "brains" and then using a slave 40x2 as an interface to the led matrix. possible?
 

westaust55

Moderator
An IF...THEN command will take of the order of 40 microsec to perform with an X2 part operating at 64MHz (16MHz resonator).
 

inglewoodpete

Senior Member
Contrary to what hippy says, it is possible to use Touch in the background on a 40X2.

I created a "Noughts and Crosses" (Tic Tac Toe) game on a 28X2, whose silicon is almost the same as the 40X2.

I used a 100mS timer interrupt to read 9 Touchpads. A "touch" event was only validated after its "release" event was detected. The foreground task did regular averaging of the readings as well as actioning the inputs: driving 9 outputs connected to LEDs.

It was not a particularly easy thing to do. The touch inputs' sensitivities are affected by the number of outputs being driven, so the touch event had to be compared with a dynamic threshold. This threshold was calculated from the averaging of each Touch pad's idle condition. For more details of the problems with Touch, refer to this post from last year.
 
Top