Searching \ for '[PIC] Input Counter' 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/time.htm?key=count
Search entire site for: 'Input Counter'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Input Counter'
2007\08\03@120914 by Paul & Lynn Tyrer

flavicon
face
Hi.

I have been playing around with a circuit that gives me 1.5v High reading
using a Hall effect switch.
What I would like to do is monitor and keep a record of how many times this
switch opens/closes and be able to pull the information from a 16f84(its
what I have kicking around) IS this possible and if so how easy. Is there
any code available that already does this.?

Any help would be greatly appreciated.

Thanks in advance

Paul

2007\08\03@124143 by Matt Bauman

flavicon
face
Instead of using an analog input on your PIC, I'd be inclined to use  
a simple comparator to push the output to discreet logic levels.  
Just tie one comparator input to the sensor output, and the other to  
the wiper of a pot.  That allows for simple adjustment of your sensor  
sensitivity (in case there is drift over time) without needing to  
reprogram your chip.

At that point, it should be trivial to count the number of state  
switches.  You can do it in a PIC, but it might be simpler to just  
use some basic hardware counter.  Just be careful about bounces.

Matt




On Aug 3, 2007, at 7:01 AM, Paul & Lynn Tyrer wrote:

{Quote hidden}

> --

2007\08\03@132653 by Hector Garcia

picon face
Hi Paul

Maybe ths can help you:
Connect the hall switch output to RB0, add a 1k (or 680 ohms) pull up
resistor  to that pin.
Enable RB0 interrupt, and increment a pulse counter each time interrup ocurres.

I'm using a AN1101 switch with these configuration on a 16f88 pic,
working fine for me.
good luck

--
Hector
--
El Pic no pudo Iniciar correctamente.
Inserte el disco de arranque y presione cualquier pin para continuar...


2007/8/3, Paul & Lynn Tyrer <spam_OUTpaulTakeThisOuTspampaultyrer.com>:
{Quote hidden}

> -

2007\08\03@140013 by alan smith

picon face
Just tie the output of the hall sensor (using a PUP) to the timer/counter input, configure it for a counter to clock on the falling edge (since the hall sensor is going to go low when the magnetic field is near), then search around for bit bang serial for the good ol F84 and your done.
 
 Or....get some samples of a device with a UART and its even easier.  Just because you have a F84 "kicking" around, doesnt mean its the best or easiest solution.  But, it will work great.  I designd a speed sensor on an F84 using a hall sensor way back some 8 or 9 years ago. Or longer. Back in the day of C55 designs at least.

Hector Garcia <.....hectorogarciaKILLspamspam@spam@gmail.com> wrote:
 Hi Paul

Maybe ths can help you:
Connect the hall switch output to RB0, add a 1k (or 680 ohms) pull up
resistor to that pin.
Enable RB0 interrupt, and increment a pulse counter each time interrup ocurres.

I'm using a AN1101 switch with these configuration on a 16f88 pic,
working fine for me.
good luck

--
Hector
--
El Pic no pudo Iniciar correctamente.
Inserte el disco de arranque y presione cualquier pin para continuar...


2007/8/3, Paul & Lynn Tyrer
:
{Quote hidden}

> -

2007\08\03@175342 by Jinx

face picon face
> and be able to pull the information from a 16f84

Paul, where is the information going ? PC ? LCD ?

2007\08\03@183131 by Jinx

face picon face
> a circuit that gives me 1.5v High reading using a Hall effect switch

You could add a transistor to that to make 5V (NPN would invert
1.5V to an active-low output)

> 16f84 (its what I have kicking around)

The F84 has neither analogue inputs nor a UART (is that how you
wanted to extract the information ?). I'd suggest you sample something
more recent, like a 16F88 or successor. Even a 10F or 12F would
do for such a simple job. The F84 will do what you want but why not
get up-to-date. Depends what programmer you have I guess

Better still, or as well, go for 18F. Microchip are good samplers
and you'd have them in a few days (they say two weeks but it's
always quicker than that IME)

http://sample.microchip.com/

2007\08\03@183752 by Paul & Lynn Tyrer

flavicon
face
Hi, Thanks for all the replies to date, and for anymore !
The project is for water meter, I have put a hall effect sensor / switch
(Both from Allegro Micro) where the magnetic pickup was for the rotary
display. I have built a circuit that with the help from a BC547B transistor
switches a led on every time the magnetic field passes, in theory 50 passes
will equal 1 gallon, and I can then work out the water consumption.
This project initially used a 1-wire network and a ds2423 counter and a 5
volt relay. Its at this point I have to tell you all I am not electronically
minded however I am fascinated by it all and that spurs me to learn.
I would love to have the result or count on a lcd but do not know where to
start.
I have been a lurker of the piclist for many years now and until recently
not felt confident to play with this circuit without blowing up things, 5
Volts only I set the limit.
I have now a microlab pic kit #1 and wondered how I might improve the led
and the well monitor using this and at last do something useful with the
outcome.

I appreciate your help and patience and understand from previous many people
have asked the earth and I don't mean to be one of them.
I hope this provides a bit of background to the whole hobby/interest thing I
have started.

Regards

Paul


-----Original Message-----
From: piclist-bouncesspamKILLspammit.edu [.....piclist-bouncesKILLspamspam.....mit.edu]On Behalf
Of Jinx
Sent: 03 August 2007 22:53
To: Microcontroller discussion list - Public.
Subject: Re: [PIC] Input Counter


> and be able to pull the information from a 16f84

Paul, where is the information going ? PC ? LCD ?

2007\08\03@190458 by Jinx

face picon face
> 5 Volts only I set the limit

Let's see, how many things have I blown up with 5V ?   ;-))

> I have now a microlab pic kit #1 and wondered how I might
> improve the led and the well monitor using this and at last do
> something useful with the outcome

PICKit1 is good, so you have a range of PICs available to use
(I don't believe it does 18F though)

Code for what you want to do would be fairly straight-forward.
LCD is probably (perceived as) the only tricky bit, but it's not
that difficult. Ten I/O for the display (8-bit mode data, RS, En),
one for the sensor, leaving two for buttons/switches. LCD data
lines can be used as well when the LCD isn't being addressed,
perhaps to log usage or transmit data to a remote (have you
considered a radio link ?)

That said though, what type of LCD do you plan to use ? 16x1,
16x2 etc alphanumeric or discrete numerals (eg glass panel)

Speed isn't a big issue, you could go crystal or RC. Here's a
plot of RC values, something close to 4MHz would do

http://home.clear.net.nz/pages/joecolquitt/0f84rc.html

Crystal would be more convenient and much less fuss though if
you don't have access to a frequency meter

2007\08\03@200133 by Paul & Lynn Tyrer

flavicon
face
Right now if my circuit is correct I have the output of the hall effect
sensor connected to the transistor and this switches the 5volt from the rail
to the led via a resistor. What I originally had in mind for this was to
switch the 5 volt relay and that was going to be a continuity switch from
ground rail and kind of mimic the button being pressed on the pickit.
I was hoping this would then make the led on the kit jump just like when I
press the button. This would then tell me it works. -So far I am happy with
the led lighting up !!!!!!.
To receive the data at first I was planning on manually reading the
registers(?) using the read chip command. Again taking it slow. I was hoping
the registers would contain a numerical figure +1 increment every time the
switch made contact via the sensor. Am I way off ???????? Similar to a
Visual Basic variable.

I am looking to sample some newer Pic's as recommended and will read the
data sheet of course. I will get to that tonight and hopefully order a
few.(Child sleep time depending)

I am looking at a lcd display but cannot find a Hitachi one as recommended
on some Pic sites. I was hoping My local Shack would carry them but they do
not, so Digikey or Farnell I guess, but this may be down the line as the
only thing I get quickly is confused.

Again I value your help and support.

Paul

{Original Message removed}

2007\08\03@204117 by Jinx

face picon face
> ground rail and kind of mimic the button being pressed on
> the pickit

I'm not familiar with how the PICKit is used. Presumably it
interfaces with MPLAB ?

> I was hoping this would then make the led on the kit jump just
> like when I press the button. This would then tell me it works.
> -So far I am happy with the led lighting up !!!!!!

Can't argue with happy. Do you have a breadboard ? Good idea
to get one if not. A small one will do. Radio Shack have a few that
look right (I've never bought from them, check suitability)

www.radioshack.com/search/index.jsp?kwCatId=&kw=breadboard&origkw=bre
adboard&sr=1

Catalog #: 276-169
Catalog #: 276-175
Catalog #: 276-174

What's your power supply ?

> I am looking at a lcd display but cannot find a Hitachi one as
> recommended on some Pic sites. I was hoping My local Shack
> would carry them but they do not, so Digikey or Farnell I guess,
> but this may be down the line as the only thing I get quickly is
> confused

Ideally, and there's no reason why it shouldn't be, the code would
be "simple" enough to programme straight into a circuit. When/if the
LCD code is working then that can be your monitor as to what's
going on inside the PIC. Most LCDs are Hitachi compatible, so
getting an actual Hitachi brand isn't necessary. Whatever you find,
just check into it on the web, but I'd have thought anything out of
Mouser or Digikey would be OK

Looks like your Radio Shack has gone the way of my Dick Smith
Electronics. DSE stopped selling LCDs a few months back, much
to my annoyance

DSE's catch-phrase is "That's Where You Go". Well, not anymore
it isn't. Radio Shack's "Do Stuff" should be "Oh, Just Buy Stuff"

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