i recently complete making PCB board which read humidity and temperature from SHT75 sensor,the board contain DS1307,(PIC16f877@4MHz).
- SHT75 connecting directly to the board through cable sheild 3m long
- the environment is very noisy and the board locate in the panel which contain a power supply and contacter's , some contacter jop is to turn the heater (3-ph,6KW) on and off .
First problem :
i run the system for many hours all things is ok,then the ds1307 start to locking up i solve this problem by code so if the timing is not changed for some time then the cod make a reset for the pic .
Second problem :
all the program is locked up,i add a filter on the input supply 220vac , 100nF, no pin's floating , all things as i think is ok
in the last i found the problem is in the sht75 code , exactly in this code :-
'''''''''''''''''''''''''''''''''''
readsensor:
GoSub tstart
GoSub WaitSensor
ShiftOut dta,clk,1,[cmd\8] ' send command
Input dta ' wait acknowledge
Low clk
While dta=1
Wend
PulsOut clk,10 ' send ack
While dta=0
Wend
While dta=1 ' wait for conversion to complete
Wend
Low clk
ShiftIn dta,clk,0,[result.highbyte\8] ' get first byte
Low dta
PulsOut clk,10 ' send ack
ShiftIn dta,clk,0,[result.lowbyte\8] ' get second byte
Low dta
PulsOut clk,10 ' send ack
ShiftIn dta,clk,0,[chksum\8] ' get third byte (checksum)
High dta
PulsOut clk,10 ' send ack
Input dta ' End of Transmission
Input clk
Return
'''''''''''''''''''''''''''''''''''''''''''''
any one have the same problem .......
Bookmarks