Sign in

username:

password:



Not a member?

Search 68hc12



Search tips

Subscribe to 68hc12



68hc12 by Keywords

68HC1 | 812A4 | 9S12DP256 | Bootloader | CodeWarrior | D60A | Debugger | DP256 | ECT | EEPROM | EVB | Flash | HC1 | HCS12 | I2C | IAR | ICC1 | Interrupts | LCD | M68KIT912DP256 | MC9S12DP256 | MC9S12DP256B | Metrowerks | Motor | MSCAN | Multilink | PLL | Quadrature | SDI | SPI | Transceiver | XFC

Ads

Discussion Groups

Discussion Groups | 68HC12 | How to count pulses using Modulus Down counter

Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).

How to count pulses using Modulus Down counter - nrmlguru - Jun 25 11:53:00 2005

Hello,
I am Gurumurthy. I am using 68hc12 for controlling the DC
motor.
I have an encoder which gives the feedback interms of pulses (100
pulses per revolution).

I want to read these pulses and thereby i got to decide the
speed of the motor.

I tried it with configuring onr of the timer into Input
capture
mode and based on interrupt mode I am counting the pulses. But
getting
the pulses at timer i/p and then executing an ISR is taking too much
time. Inbetween this time I am loosing some of the counts(pulse
count).

How can it be overcome?? Is Modulus down counter going to help
me in this regard??

Please help me in this regard. If u provide an excample code
it
will be great.

Thank you

Regards
Gurumurthy




(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )


Re: How to count pulses using Modulus Down counter - Dean Manion - Jun 25 15:44:00 2005

Instead of counting pulses use the number of timer ticks beween pulses to calculate the speed. Don't know what processor speed you are running or what your prescaler is set to so I can't give you the exact calculation.

Dean

----- Original Message -----
From: nrmlguru
To: 68HC12@68HC...
Sent: Saturday, June 25, 2005 10:53 AM
Subject: [68HC12] How to count pulses using Modulus Down counter Hello,
I am Gurumurthy. I am using 68hc12 for controlling the DC
motor.
I have an encoder which gives the feedback interms of pulses (100
pulses per revolution).

I want to read these pulses and thereby i got to decide the
speed of the motor.

I tried it with configuring onr of the timer into Input
capture
mode and based on interrupt mode I am counting the pulses. But
getting
the pulses at timer i/p and then executing an ISR is taking too much
time. Inbetween this time I am loosing some of the counts(pulse
count).

How can it be overcome?? Is Modulus down counter going to help
me in this regard??

Please help me in this regard. If u provide an excample code
it
will be great.

Thank you

Regards
Gurumurthy
------------------------------------------------------------------------------
Yahoo! Groups Links

a.. To
[Non-text portions of this message have been removed]




(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: How to count pulses using Modulus Down counter - BobG...@... - Jun 25 18:54:00 2005


In a message dated 6/25/05 3:25:22 P.M. Eastern Daylight Time,
dean@dean... writes:

I have an encoder which gives the feedback interms of pulses (100
pulses per revolution).

=======================
I think some HC12s have encoder inputs. My memory isnt so hot sometimes.
There are examples of using edge sensitive interrupts to read the encoders. If
you have a timer iterrupt that gives you time, and the encoder count, you can
compute speed very accurately. [Non-text portions of this message have been removed]




(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: How to count pulses using Modulus Down counter - nrmlguru - Jun 27 6:51:00 2005

Hey dean

I am using a processor mc98s12dg256 with 8MHz clock.
If I use a timer in IC mode then how to keep track of two consecutive
pulses? --- In 68HC12@68HC..., "Dean Manion" <dean@m...> wrote:
> Instead of counting pulses use the number of timer ticks beween
pulses to calculate the speed. Don't know what processor speed you
are running or what your prescaler is set to so I can't give you the
exact calculation.
>
> Dean
>
> ----- Original Message -----
> From: nrmlguru
> To: 68HC12@68HC...
> Sent: Saturday, June 25, 2005 10:53 AM
> Subject: [68HC12] How to count pulses using Modulus Down counter > Hello,
> I am Gurumurthy. I am using 68hc12 for controlling the DC
> motor.
> I have an encoder which gives the feedback interms of pulses (100
> pulses per revolution).
>
> I want to read these pulses and thereby i got to decide
the
> speed of the motor.
>
> I tried it with configuring onr of the timer into Input
> capture
> mode and based on interrupt mode I am counting the pulses. But
> getting
> the pulses at timer i/p and then executing an ISR is taking too
much
> time. Inbetween this time I am loosing some of the counts(pulse
> count).
>
> How can it be overcome?? Is Modulus down counter going to
help
> me in this regard??
>
> Please help me in this regard. If u provide an excample
code
> it
> will be great.
>
> Thank you
>
> Regards
> Gurumurthy >
> --------------------------------------------------------------------
----------
> Yahoo! Groups Links
>
> a.. To >
> [Non-text portions of this message have been removed]




(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: How to count pulses using Modulus Down counter - nrmlguru - Jun 27 6:52:00 2005

Hey dean

I am using a processor mc98s12dg256 with 8MHz clock.
If I use a timer in IC mode then how to keep track of two consecutive
pulses? --- In 68HC12@68HC..., "Dean Manion" <dean@m...> wrote:
> Instead of counting pulses use the number of timer ticks beween
pulses to calculate the speed. Don't know what processor speed you
are running or what your prescaler is set to so I can't give you the
exact calculation.
>
> Dean
>
> ----- Original Message -----
> From: nrmlguru
> To: 68HC12@68HC...
> Sent: Saturday, June 25, 2005 10:53 AM
> Subject: [68HC12] How to count pulses using Modulus Down counter > Hello,
> I am Gurumurthy. I am using 68hc12 for controlling the DC
> motor.
> I have an encoder which gives the feedback interms of pulses (100
> pulses per revolution).
>
> I want to read these pulses and thereby i got to decide
the
> speed of the motor.
>
> I tried it with configuring onr of the timer into Input
> capture
> mode and based on interrupt mode I am counting the pulses. But
> getting
> the pulses at timer i/p and then executing an ISR is taking too
much
> time. Inbetween this time I am loosing some of the counts(pulse
> count).
>
> How can it be overcome?? Is Modulus down counter going to
help
> me in this regard??
>
> Please help me in this regard. If u provide an excample
code
> it
> will be great.
>
> Thank you
>
> Regards
> Gurumurthy >
> --------------------------------------------------------------------
----------
> Yahoo! Groups Links
>
> a.. To >
> [Non-text portions of this message have been removed]




(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: How to count pulses using Modulus Down counter - Jason Liszewski - Jun 27 9:30:00 2005

You should use the pulse accumulator instead of
triggering an interrupt each time you receive a pulse.
By using the pulse accumulator in conjunction with a
periodic interrupt based off of the mod down counter
you could determine the speed of your motor.

If you have the mod down counter interrupt every 10ms
you can calculate the difference in the pulse
accumulator now, and 10ms ago. That difference will
give you the number of pulses in the last 10ms, using
that you can easily figure out the speed of the motor. Hope this helps.

Jason M. Liszewski
Embedded Systems Engineer
Syn-Tech Systems, Inc.
--- nrmlguru <nrmlguru@nrml...> wrote:

> Hello,
> I am Gurumurthy. I am using 68hc12 for
> controlling the DC
> motor.
> I have an encoder which gives the feedback interms
> of pulses (100
> pulses per revolution).
>
> I want to read these pulses and thereby i
> got to decide the
> speed of the motor.
>
> I tried it with configuring onr of the timer
> into Input
> capture
> mode and based on interrupt mode I am counting the
> pulses. But
> getting
> the pulses at timer i/p and then executing an ISR is
> taking too much
> time. Inbetween this time I am loosing some of the
> counts(pulse
> count).
>
> How can it be overcome?? Is Modulus down
> counter going to help
> me in this regard??
>
> Please help me in this regard. If u provide
> an excample code
> it
> will be great.
>
> Thank you
>
> Regards
> Gurumurthy
____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports.yahoo.com





(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: Re: How to count pulses using Modulus Down counter - Stephen Trier - Jul 8 13:07:00 2005

On Mon, Jun 27, 2005 at 10:52:20AM +0000, nrmlguru wrote:
> If I use a timer in IC mode then how to keep track of two consecutive
> pulses?

Each time the input capture fires, it triggers an interrupt.
The interrupt handler should read the timer channel register for the
capture to get the time (in TCNT ticks) at which the capture happened.
Successive calls to the interrupt handler can look at the increment of
the captured times to see how long it was between the previous event
and the current one.

Stephen

--
Stephen Trier
Technical Development Lab
Cleveland FES Center
sct@sct@...





(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )