Switch sensor vs. switch PIC pin


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Switch sensor vs. switch PIC pin

    Thank for reply !
    The reading of temperature is ...chaotic ! Sometimes I want to see the temperature of outside, sometimes -the temperature of inside ! Without any rule !
    So, I need one switch... OK, the ideea to use both sensor on the same bus it's good, but...i need to read the serial number of each sensor and keep this serials in eeprom ?! It is one simply way to do this with PBP commands ? I made once one termometer using 1-wire commands and I remember it's not so easy ...

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: Switch sensor vs. switch PIC pin

    You could have your Main loop check the status of a switch, not in your sensor loop, if closed it jumps to a sub routine to check one and if open it goes to a different sub routine. the DS18B20 temp sensors never get switched, they are always on, so no noise problem.
    In the sub routines use your owout / owin and jumps to display refresh routine with pertinent data.
    You could even have the main loop read both sensors every loop and have your subs just display the variables your data is stored in.
    Last edited by Archangel; - 6th April 2011 at 06:04.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Switch sensor vs. switch PIC pin

    So the second variant it's better ?!

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: Switch sensor vs. switch PIC pin

    Hi Fratello,
    Well your complaint was noise interfered with data when you switch the device in /out. If you leave it "in circuit" all the time it eliminates that possibility. By using a separate input to detect a switch the noise is confined there. You might also consider using a pin that has an interrupt available, so it changes in "real time", instead of waiting for a loop to get around to it.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Switch sensor vs. switch PIC pin

    So...This is correct ?
    Code:
    ...
    If portA.7= 1 then
    valoare=temperature
    semn=sign
    else
    valoare=temperature2
    semn=sign2
    Endif
    
    Gosub Selectie
    Gosub Display				' B for Common CATOD;without B for Common ANOD
    
    Goto Main
    
    '======================================================================================       
    Selectie :
    
    IF semn ="-" then					
        DIGIT_3="-"
        else
        DIGIT_3=" "
    ENDIF
     
    IF valoare DIG 2 = 0 THEN
        DIGIT_2 = " "
        ELSE
        DIGIT_2 = valoare dig 2
    ENDIF
    
        DIGIT_1 = valoare dig 1
        DIGIT_0 = valoare dig 0
    
    RETURN
    '======================================================================================       
    Display:					' For Common ANOD
    for i=0 to 4
        TEMP = DIGIT_3 : gosub segments
        COMMON_3 = 1 : PAUSE 1 : COMMON_3 = 0
    
         
        TEMP = DIGIT_2 : GOSUB segments
        COMMON_2 = 1 : PAUSE 1 : COMMON_2 = 0
       
        TEMP = DIGIT_1 : GOSUB segments
        COMMON_1 = 1 : DP = 0 : PAUSE 1 : COMMON_1 = 0 : DP = 1
      
        TEMP = DIGIT_0 : GOSUB segments
        COMMON_0 = 1 : PAUSE 1 : COMMON_0 = 0
    next i
    RETURN
    Thanks for support !Name:  ttt.jpg
Views: 2137
Size:  165.5 KB

  6. #6
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: Switch sensor vs. switch PIC pin

    One of my DS18B20 it's about 4 meters from PIC. What is the smaller value of resistor used for this sensor ? Can I try with 1k ? Thanks !

  7. #7
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Switch sensor vs. switch PIC pin

    I have used 15m cable and pull up resistor 680 ohms. Resistor value depends greatly on the capacity of cable. And the capacity of the cable depends on the length.

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