sht75 code locked up


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    microkam's Avatar
    microkam Guest

    Unhappy sht75 code locked up

    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 .......

  2. #2
    microkam's Avatar
    microkam Guest


    Did you find this post helpful? Yes | No

    Post SHIFTIN locked up

    can i make a maximum time to wait the data in SHIFTIN,if the data is not received in this time jump to the error label .

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    There's no TimeOut facility with Shiftin. I have some doubt on your hardware at first but, if you could use the same setup in a 'normal' environement (let's say on your own bench) and confirm that the problem is still the same, we can probably dig deeper in your stuff.

    I see some strange stuff so far... seems to have some missing PAUSE or something, some pins a set Low/High twice, those While/Wend are obscure... If you coulld post your schematic, it could help. Datasheet link, for lazy user like me, could be handy.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    microkam's Avatar
    microkam Guest


    Did you find this post helpful? Yes | No

    Default

    thanx mister to try to solve my problem..
    i run the board in my lap without heater load and it's run for three days and all things is ok , but the problem start when i connected the heater load , maybe the spark in contacter cause error in the command through sensor cabel sheild , that why the program locked up in the last code i attached .

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Possibles causes:
    unsufficient ground plane on your PCB
    unsufficient power supply filtering
    usused input/output left floating
    Ground loop/ground bouncing
    unsufficient incoming data filtering/buffering ( can we say buffering ??? ;D )
    ...
    ...
    ...
    Is your stuff share a power supply or it have it's own?

    You can still additional hardware to Enable and Disable your Contactor on the Zero Crossing of the AC line. It could be done in software too. By using one or the other method, you'll have to adjust the timing to compensate the Contactor latency.

    This should solve a part of your problem.
    Last edited by mister_e; - 1st June 2006 at 16:05.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    microkam's Avatar
    microkam Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    Possibles causes:
    unsufficient ground plane on your PCB
    unsufficient power supply filtering
    usused input/output left floating
    Ground loop/ground bouncing
    .
    the power supply is clean as can be , i put the filter ,the ground plane on my PCB i think is good.

    Quote Originally Posted by mister_e
    unsufficient incoming data filtering/buffering ( can we say buffering ??? ;D )
    .
    how can i make filtering for the data incoming from sensor , or how can i solve this problem by code to reset the program if any locked up happend in the sht code.

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Re-Writing IF-THEN-AND-ENDIF code?
    By jessey in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th August 2006, 17:23

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts