Re: WHILE WEND and SHIFTIN

Originally Posted by
Bill Legge
I'm using: PBPL on a PIC18F1220 and reading data from a SHT15 temperature/humidity sensor. Two issues:
1. I want the PIC to keep going in the main loop even if the SHT15 is not connected. However, the code includes:
while DataPin = 0 .... wend
.........
while DataPin = 1 .... wend
So, the loop halts if the sensor does not set/clear the DATAPIN. I guess there is a simple way to fix this - but it escapes me at the moment. Any ideas?
How about a pull-up resistor on DataPin?
2. And a speed issue. All works OK with a 20MHz xtal and 'HS' compile. But with an 8MHz xtal and 'HSPLL' the SHT15 gives bad results. All the other routines work OK at 32Mhz and I have tried DEFINE SHIFT_PAUSEUS 1000; this puts the SHIFT clock at <1KHz and the SHT15 is rated to 50KHz - but no luck. Any ideas?
Regards Bill Legge
Need to investigate on that, maybe the PAUSEUS accept up to byte value, if so...mmmm... if this PIC allow to switch to the internal OSC, do it before SHIFTIN, and go back to the external after Shiftin.
EDIT: The DEFINE should allow you a range of 0-65,535 uSec... so that's strange...
Last edited by mister_e; - 14th July 2011 at 19:31.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks