Jonathan Abbatiello

How to read from Grounded switch

Discussion created by Jonathan Abbatiello on May 30, 2011
Latest reply on Jun 29, 2011 by Carl Barnes

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
 

Outcomes