Hello Friends!
I am working on the EVALH1 board which has some switches integrated onto Port T which I would like to utilize, but they are all hooked to ground without a power sourer running to them. I have tried playing with the playing with the data direction of the ports and supply them with power, but I am left with a very dim light due to my looping. Here is the code I am using, I have a feeling that I am simply overlooking something very small within the various of this following code:
void main(void) {
DDRH = 0xFF; // LEDs
DDRT = 0xFF; // Switches
PTT = 0xFF;
while(1)
{
DDRT = 0xFF;
PTT = 0xFF;
DDRT = 0x00;
if (PTIT_PTIT6 == 1)
PTH_PTH1 = 1;
if (PTIT_PTIT6 == 0)
PTH_PTH1=0;
}
The main question I have would be: how do I read from these switches if they are connected to ground?
Thank you so much for your time and I greatly appreciate anything you may be able to share with me!
Sincerely,
Jonathan
Enable the internal pullup resistors for PORTT via the PERT register.
Best regards,
Carl Barnes
AMPS: Adapt Modular Prototyping System for Microcontrollers
Since 1995
EVALUATE * EDUCATE * EMBED