Maker Pro
Maker Pro

Pulse counter/freq-volt converter

R

Rick

Jan 1, 1970
0
I'm trying to design a pulse counter and frequency to voltage
converter, both use the same pulse, which is variable, to determince
when to trigger another circuit that will turn off SSR. This SSR will
be triggered by a momentary switch to turn on & needs to turn off when
either 730 pulses have been received if the pulse train is less than .
8 pulses/second or 10 seconds after the pulse train is pulsing at or
faster than .8 pulses/second (which ever comes first). I've thought of
using a synchronus counter feeding an AND gate for pulse counter The
other a freq to voltage converter that triggers a voltage comparator
that then feeds a 555 10 second timer. This circuit needs to be able
to be stopped with a seperate momentary switch.

I'd like to be able to do it with lots less components like a
microcontroller, but I've never designed & programmed one of these.
Can anyone enlighten on this & the best place to find info?

Thanks,
Rick
 
A

Anthony Fremont

Jan 1, 1970
0
Rick said:
I'm trying to design a pulse counter and frequency to voltage
converter, both use the same pulse, which is variable, to determince
when to trigger another circuit that will turn off SSR.
This SSR will
be triggered by a momentary switch to turn on & needs to turn off when
either 730 pulses have been received if the pulse train is less than .
8 pulses/second or 10 seconds after the pulse train is pulsing at or
faster than .8 pulses/second (which ever comes first). I've thought of

What if the pulse train changes rate during the analysis? Are you sure you
stated your requirement correctly? I'm reading that if the pulse train is
slow (<8 pulses/sec), then wait for 730 pulses (could take a really long
time),
but if the pulse train is fast (>=8 pulses/sec) turn off the SSR after 10
seconds. Is that correct?
using a synchronus counter feeding an AND gate for pulse counter The
other a freq to voltage converter that triggers a voltage comparator
that then feeds a 555 10 second timer. This circuit needs to be able
to be stopped with a seperate momentary switch.

I'd like to be able to do it with lots less components like a
microcontroller, but I've never designed & programmed one of these.
Can anyone enlighten on this & the best place to find info?


www.picbook.com is a good book for the 18F series of PIC micros, but it may
be a bit too terse for someone starting out. It comes with a circuit board
for a development platform and digikey sells a complete kit of parts to
flesh it out, but you will need to get the PIC flashes somewhere. After it
has been flashed, then you use an internal boot loader to reprogram it.

I don't use a dev board per se, I just tinker on solderless breadboards.
For flashing the PICs, I use an MELABS USB programmer. It works great and
will program many different parts, plus it's fast.

www.piclist.com has a great mailing list with many professional PIC
programmers willing to help newbies, just read the rules before posting.
Sounds like you don't just want this done by someone else and then handed to
you (good :) I would be willing to help you out on your code whenever I
have some spare time, but I normally do 14 bit PICs (16Fxxx series). For
someone just starting out, the 18F line may be a better choice, especially
if you want to program in C. I know a little about the 18F line, but I've
never really played with them.
 
P

petrus bitbyter

Jan 1, 1970
0
Rick said:
I'm trying to design a pulse counter and frequency to voltage
converter, both use the same pulse, which is variable, to determince
when to trigger another circuit that will turn off SSR. This SSR will
be triggered by a momentary switch to turn on & needs to turn off when
either 730 pulses have been received if the pulse train is less than .
8 pulses/second or 10 seconds after the pulse train is pulsing at or
faster than .8 pulses/second (which ever comes first). I've thought of
using a synchronus counter feeding an AND gate for pulse counter The
other a freq to voltage converter that triggers a voltage comparator
that then feeds a 555 10 second timer. This circuit needs to be able
to be stopped with a seperate momentary switch.

I'd like to be able to do it with lots less components like a
microcontroller, but I've never designed & programmed one of these.
Can anyone enlighten on this & the best place to find info?

Thanks,
Rick


You did not describe your problem good enough, at least not to me. For a
pulse rate of less then .8p/s it will take over 15 minutes to count 730
pulses. Is that really what you mean? Maybe you'd better give some
background information as well.

BTW. The "classic" frequency to voltage converter uses a no-retriggerable
monostable to produce uniform pulses and integrated them to produce the
voltage.

petrus bitbyter
 
R

Rick

Jan 1, 1970
0
"Rick" <[email protected]> schreef in bericht







You did not describe your problem good enough, at least not to me. For a
pulse rate of less then .8p/s it will take over 15 minutes to count 730
pulses. Is that really what you mean? Maybe you'd better give some
background information as well.

BTW. The "classic" frequency to voltage converter uses a no-retriggerable
monostable to produce uniform pulses and integrated them to produce the
voltage.

petrus bitbyter- Hide quoted text -

- Show quoted text -

Sorry for the confusion - Also, my info was flawed. The pulse trains
should be either < 74 or >/= 74 pulses per second. If the pulses are
below 74 pps & then gets to 74 pps, the 730 pulses would probably be
reached prior to the copmletion of the 10 second delay that is
triggered by the >74 pps. Which ever one gets there first will trigger
the reset to OFF condition.

A momentary switch triggers a 555 circuit to (toggle) open & close a
SSR at 1 cps & also enables the f/v & p/c circuits. When any of 3
conditions are met, the 555 is then reset which disables the SSR. The
third condition is a different momentary switch for a manual OFF.

Another FYI, its been 28 years since I was in school & actually did
any real design, so I may struggle a bit in designing this thing. I
have a good handle on troubleshooting & knowledge of how these things
work when already built, but designing is another story & will take a
re-learning curve.
Thanks,
Rick
 
P

petrus bitbyter

Jan 1, 1970
0
Rick said:
Sorry for the confusion - Also, my info was flawed. The pulse trains
should be either < 74 or >/= 74 pulses per second. If the pulses are
below 74 pps & then gets to 74 pps, the 730 pulses would probably be
reached prior to the copmletion of the 10 second delay that is
triggered by the >74 pps. Which ever one gets there first will trigger
the reset to OFF condition.

A momentary switch triggers a 555 circuit to (toggle) open & close a
SSR at 1 cps & also enables the f/v & p/c circuits. When any of 3
conditions are met, the 555 is then reset which disables the SSR. The
third condition is a different momentary switch for a manual OFF.

Another FYI, its been 28 years since I was in school & actually did
any real design, so I may struggle a bit in designing this thing. I
have a good handle on troubleshooting & knowledge of how these things
work when already built, but designing is another story & will take a
re-learning curve.
Thanks,
Rick

All components you need are in the schematic below. You don't even need the
555. The transistor and its related resistors are only necessary if the load
is to heavy to be driven by a PIC. A 555 can handle higher voltages and more
current then a PIC.

(View with fixed font)
--+--+--+----------+---------------------+--
| | | | | +5V
| | | | |
.-..-..-. | .-.
| || || |33k | | |
| || || | .----------------. | |
'-''-''-' | 1 | '-'
| | | | | |
| | +--|4 | +-----
| | | | ___ |/ out
+---)--+-----|5 7|---|___|--|
| | | | |>
| | | | |
| +----+---|6 PIC12F629 | |
| | | | |
pulses | | | | |
in-----)--------)---|2 | |
| | | | |
| | | | |
| | | 8 | |
| o | o '----------------' |
|=|> |=|> | |
| o | o | |
stop | |start | |
| | | |
------+--------+------------+--------------------+--
GND
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

But... That's not the whole story. You will need the datasheet of the
PIC12F629 and a software development system. Both are can be downloaded for
free from Microchip. You also need a programmer. Several types are for sale.
More designs are free downloadable. One that works for me:
http://www.oshonsoft.com/picprog.html
So far the easy part.
Then you need to write the software which is quite a challenge and has it's
learning curve. IMHO it's worth the effort only if you want to do more with
PICs in the future.
Be aware that PICs are not the only micros around. You can do the same using
a tinyAVR and it's related tools.
If I can find the time I'll write some example code tomorrow.

petrus bitbyter
 
P

petrus bitbyter

Jan 1, 1970
0
"petrus bitbyter" <[email protected]> schreef in
bericht
If I can find the time I'll write some example code tomorrow.

petrus bitbyter

Well, a full example but beware. Is has not been debugged.
Layout has been messed as the mailer replaced the tabs with one space.

#include <p12f629.inc>
list p=PIC12f629

#define pulses_in GPIO, T1CKI ; pin 2
#define startsw GPIO, GP1 ; pin 6
#define stopsw GPIO, GP2 ; pin 5
#define output GPIO, GP0 ; pin 7
#define counter1oo T1CON, 0

tmr1_on equ b'00000111'
tmr1_off equ b'00000110'
tmr0_ini equ b'00000111'
count0 equ 0x20
count1 equ 0x21
stopswcntr equ 0x22
tenscntr equ 0x23
tensecs equ .152

__CONFIG H'3FA4'
ORG 0
goto init
ORG 0004
int retfie
init
movlw 0xfe ; GP0 (pin7) is output
tris GPIO
movlw tmr1_off ; init TMR1 for use as
movwf T1CON ; an asynchronous counter
movlw tmr0_ini ; init 10s counter
bsf STATUS, RP0 ; switch to bank 1
movwf OPTION_REG
bcf STATUS, RP0 ; back to bank 0
restart
bcf output ; output = 0
bcf PIR1, TMR1IF ; reset 730 pulses counted flag
movlw (0xffff-.730)/0xff
movwf TMR1H ; re-init counter
movlw (0xffff-.730)&0xff
movlw TMR1L
clrf stopswcntr
movlw tensecs
movwf tenscntr
idle
btfsc startsw
goto idle
movlw 6 ; wait 6ms for debounce
call dx1ms
btfsc startsw
goto idle ; disturbance, ignore
bsf output ; output 1
bsf counter1oo ; start 730 counter
clrf TMR0 ; clear 10s cntr and prescaler
bcf INTCON, T0IF ; clear TMR0 roll-over flag
tensecsloop
btfsc PIR1, TMR1IF ; if 730 pulses counted
goto restart ; then start again.
btfss stopsw ; stopswitch pushed?
goto nostop ; no, continue.
decfsz stopswcntr,f ; if stop switch pushed too
goto tst10s ; short then count down
goto restart ; remaining checks else restart.
nostop
clrf stopswcntr
tst10s
btfsc INTCON, T0IF
goto tensecsloop
decfsz tenscntr,f
goto cont10cnt
goto restart
cont10cnt
bcf INTCON, T0IF
goto tensecsloop
;
; delay for w * 1ms
;
dx1ms
movwf count0
dms
call us100
decfsz count0,f
goto dms
retlw 0
us100
movlw 0x21 ; delay 100us
movwf count1
nxt6
decfsz count1,f
goto nxt6
retlw 0
END


petrus bitbyter
 
Top