Are you using a PIC that has the pin to emulate a smaller pin device? alan smith wrote: >OK...i've pulled the code over to this machine so I >can provide some more details. I didnt want to cloud >the issue, because I've found that port I/O behaves >the same pretty much over the family of parts. > >Loading the canned code on the board, appears to be >functioning ok. I suppose I could just write a routine >to exercise the button on the board as well. > >The device is a 18F8720 on the Microchip tqfp dev >board. When I asked different, meant different from >the 16F family of devices. I'm not using TMR1 in this >particular design, TMR0 and TMR2 > >For setup I have > >#define SHT_DATA_PIN LATC,1 >#define SHT_DATA_DIR TRISC,1 >#define SHT_DATAin_PIN PORTC,1 >#define SHT_CLK_PIN LATC,0 >#define SHT_CLK_DIR TRISC,0 > >#define FLAG LATH,2 >#define FLAG_DIR TRISH,2 > >Where FLAG is being used so I can see where things are >occuring via the logic analyzer. > >Here is the top part of the code. During the section >where its looking at the internal register SHT_Byte, >it branches fine. When looking for the ACK, it doesnt >appear to be reading the port. The SHT is pulling the >data line low indicating the ACK is occuring but the >code just blows right thru it as if it occurs EVEN if >it didnt really occur. Its not so much an issue on >the ACK (other than if it didnt respond I'd like to >know about it) but when I go to look for the data >being valid (data line pulled back low after 250mS) it >ignores the fact the data line is still high and >attempts to read out of the device and the data is >bogus. > >---------------------------------------------------------------- >; SHT71 interface routine >; Sends a command to the SHT71 temp/humidity sensor >and retrieves >; a two-byte response. The command is already in >SHT_Byte > >SHT_TxRx > > bsf FLAG ; flag for analyzer > ; set SHT71 data line to an output > bcf SHT_DATA_DIR > ; Send the transmission start sequence > bsf SHT_DATA_PIN > bsf SHT_CLK_PIN > bcf SHT_DATA_PIN > bcf SHT_CLK_PIN > nop > nop > nop > bsf SHT_CLK_PIN > bsf SHT_DATA_PIN > bcf FLAG > >; counter to loop through the eight bits to send > movlw 8 > movwf Byte_Count > >SHT_SendBitLoop > bcf SHT_CLK_PIN > btfss SHT_Byte,7 > bra SHT_SendZero > bsf SHT_DATA_PIN > bra SHT_SendBit >SHT_SendZero > bcf SHT_DATA_PIN >SHT_SendBit > bsf SHT_CLK_PIN > rlncf SHT_Byte,F > decfsz Byte_Count,F > bra SHT_SendBitLoop > bcf SHT_CLK_PIN > bsf SHT_DATA_DIR > > >; now look for an ack (SHT71 pulls data line >low--should >; have occured on the last rise of the SCK line). > > nop > >SHT_WaitAck > btfss SHT_DATAin_PIN,ACCESS > goto SHT_AckOK > bsf ERRORS,noACK > return > > > > > > >__________________________________ >Do you Yahoo!? >Yahoo! Small Business - Try our new resources site! >http://smallbusiness.yahoo.com/resources/ > > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist