74HC165N, Simply chip has stalled everything.
slagment
Posts: 1
Hello,
I'm working on a GPS board, and used a 74HC165N to free some pins from the Dip switches. Dip switches are a requirement, not sure why. I can't get any data from the 74HC165N.
Anyone see any problems?
//Winavr GCC
unsigned char __DIP_in (void)
{
int dly =5;
PORTC |=(1<<4); //Latch
_delay_ms(dly);
PORTC &=~(1<<4);
_delay_ms(dly);
PORTC |=(1<<4);
for(i=0; i<8; i++)
{
PORTC |=(1<<3); //Clock
_delay_ms(dly);
PORTC &=~(1<<3);
tmp = ((PINC & 0b00000100) );
data = (data << 1 );
tmp = (tmp >>2);
data += tmp;
}
return data;
}
And the answer was:
Have to disable JTAG to use PC 2 - 5.
Thank you John Samperi.
I'm working on a GPS board, and used a 74HC165N to free some pins from the Dip switches. Dip switches are a requirement, not sure why. I can't get any data from the 74HC165N.
Anyone see any problems?
//Winavr GCC
unsigned char __DIP_in (void)
{
int dly =5;
PORTC |=(1<<4); //Latch
_delay_ms(dly);
PORTC &=~(1<<4);
_delay_ms(dly);
PORTC |=(1<<4);
for(i=0; i<8; i++)
{
PORTC |=(1<<3); //Clock
_delay_ms(dly);
PORTC &=~(1<<3);
tmp = ((PINC & 0b00000100) );
data = (data << 1 );
tmp = (tmp >>2);
data += tmp;
}
return data;
}
And the answer was:
Have to disable JTAG to use PC 2 - 5.
Thank you John Samperi.
Comments
It may be that you haven't initialized your I/O port properly and you don't show anything about the rest of your program. It may be that the subroutine you've shown works fine, but the rest of your program is what stalls things.
There are plenty of examples of the use of a 74HC165 for adding inputs to a Stamp (see the StampWorks Manual) and similar code can be used with the Propeller using the BS2 Function Library in the Object Exchange.