Searching \ for '[PIC]: PULSIN & Unknown Number of Sensors' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=sensor
Search entire site for: 'PULSIN & Unknown Number of Sensors'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: PULSIN & Unknown Number of Sensors'
2000\09\12@122109 by dominic.berry

flavicon
face
I'm new to PICS & want to create a device with 1 or more sensors (the number
of sensors is unknown & variable ie the device could have 1 sensor or 2 or 3
or 4).  I want to use the picbasic command PULSIN to measure the pulse width
on each sensor.  The problem is I don't want to use PULSIN if a sensor does
not exist as it takes ~0.5s to time out (is this correct?).  So if I test 4
inputs with PULSIN and only 1 sensor exists, the sampling rate will be once
every ~1.5s.  Any ideas how I get around this?

The only way I can think of is to tie a pin high if a sensor is connected on
another pin, & then test for that high pin before running PULSIN.  This will
double the number of inputs required though which I am not keen on.  Any other
ideas.

Many thanks

Dominic

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use spam_OUTlistservTakeThisOuTspammitvma.mit.edu?body=SET%20PICList%20DIGEST>

2000\09\12@130934 by Bruce Cannon

picon face
Dominic:

As you're going with the Stamp-like approach you could perhaps have the
presence of each sensor add a resistive value to a ladder, maybe with the
values being an order of magnitude or somesuch apart for differentation, and
read the total with the POT command.  Then you'd only need one extra pin for
multiple sensors (I think this might work for 3 or 4).

Bruce Cannon
Style Management Systems
http://siliconcrucible.com
(510) 787-6870
1228 Ceres ST Crockett CA 94525

Remember: electronics is changing your world...for good!

{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use listservspamKILLspammitvma.mit.edu?body=SET%20PICList%20DIGEST>

2000\09\12@131956 by Ricardo Seixas

picon face
Dominic,

At pic startup you can look for the sensors, for ex:
Try to read sensor 1, if you get a timeout then there's no sensor so,
you clear a flag to indicate no sensor present (ie: sensor1_present=0)
otherwise set a flag (ie: sensor1_present=1)
Do this until you tried all possible sensors then, go to the main loop
to process all connected sensors using the flag you've set.

pseudo-code:

     if sensor1_present = 1 then read_sensor(sensor1)
     .
     .
     .
     if sensorn_present...

If the sensor is hot-plugable you can re-scan the sensors every
minute/hour/day/whatever
I don't use picbasic so, I can't help you with real code.

Hope this helps

Ricardo Seixas



{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use EraseMElistservspam_OUTspamTakeThisOuTmitvma.mit.edu?body=SET%20PICList%20DIGEST>

2000\09\12@132156 by Bob Ammerman

picon face
How about this idea:

Bring your sensor signal into the PIC via a resistor of about 1K, and also
connect all your sensor pins, each via a 30K resistor to a single PIC output
pin.

If the sensor pin tracks the output pin then no sensor is attached.

If the sensor pin doesn't track the output pin then a sensor is attached.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)


{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...