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

    Default Switch sensor vs. switch PIC pin

    I made one thermometer with LED display for my car. I intend to use two DS18B20 sensors. Which method it's better : 1.using a switch for sensor-and a single pin of 16F628A (picture 1); 2.switching between sensor from one port of PIC (figure 2).
    The distance from PIC to switch are about 40 cm and from PIC to sensors are about meters. Thanks in advance for reply !
    Attached Images Attached Images   

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: Switch sensor vs. switch PIC pin

    Hi Fratello,

    Why not just put them on the same bus with no switch?

    According to the data sheet, you can talk to them both separately:
    Each DS18B20 has a unique 64-bit serial code, which allows multiple DS18B20s to function on the same 1-Wire bus. Thus, it is simple to use one microprocessor to control many DS18B20s distributed over a large area.
    It looks like you have enough digits in your display to represent A or B for each temp, so you can tell them apart.
    Last edited by ScaleRobotics; - 5th April 2011 at 15:52.

  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

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

  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

    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.

  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 the second variant it's better ?!

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

Members who have read this thread : 1

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