Pins - Version: 574

During normal operation, the TouchShield needs:
+5V
GND

During TouchShield programing of the TouchShield uses pins:
Arduino +5V
Arduino GND
Arduino Reset
Arduino 0
Arduino 1


When the touchShield is talking to the Arduino, the TouchShield uses:
Arduino +5V
Arduino GND
Arduino Reset
Arduino 2
Arduino 3


Note: Slide pins 12 and 13 can be used for any general purpose, but typically they aren’t used.

DDRH |= 0b00001000; //PH3 = OUTPUT (PIN12)
DDRL &= 0b11110111; //PL3 = INPUT (PIN13)

Thanks Dan for modifying the code to use macros to make setting a little easier…

#define SET_PIN12(z) ((z)>0)? PORTH |= (1 << 3) : PORTH &= (0 << 3)
#define READ_PIN13(z) ((PINL & 0×08) > 0) ? (z) = 1 : (z) = 0

*Notice that the “x” above should be a letter “x”, but is for some reason improperly formatted. Correct this before compiling (thanks Dick)!

Then usage would simply be like the following:
SET_PIN12(1); //writes a 1 to PIN12
SET_PIN12(0); //writes a 0 to PIN12

and

READ_PIN13(temp); //reads 1 or 0 into temp depending on PIN13’s state

Note: temp should be a variable that can handle a 1 or a 0… which is basically everything.




Edit History