Shop OBEX P1 Docs P2 Docs Learn Events
74HC165N, Simply chip has stalled everything. — Parallax Forums

74HC165N, Simply chip has stalled everything.

slagmentslagment Posts: 1
edited 2010-10-25 13:21 in General Discussion
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.
1881 x 1060 - 49K

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-10-25 13:21
    I don't see anything obviously wrong with your code, but do keep in mind that this has nothing to do with Parallax products and your subroutine is in C for a non-Parallax processor. We really can't be of much help for your situation.

    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.
Sign In or Register to comment.