Searching \ for 'Needed: freq meas and gen in 12C508' 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/index.htm?key=freq+meas+gen+12c508
Search entire site for: 'Needed: freq meas and gen in 12C508'.

Truncated match.
PICList Thread
'Needed: freq meas and gen in 12C508'
1999\11\23@131530 by Craig Lee

flavicon
face
I mostly program in C with the benefit of interrupts,
but this application calls for small size and price,
so I thought I'd ask the piclist.

I need to be able to read an incoming square wave, and
generate an outgoing square wave based on the first.
The frequency is from 10Hz to 1Khz.

This is probably very easy for the hardcore micro
guys, I guess I've become a bit lazy with my GUIs and
high end languages.

I've done it in a 16F84, although a bit glitchy (can't
trigger well with a scope), but going to the 12C508,
I'm a bit lost.

Any direction?

Craig

1999\11\23@231139 by Ravi Pailoor

flavicon
face
part 0 1249 bytes content-type:text/x-vcard; charset=us-ascii; (decoded 7bit)

       btfss gpio,0    ; bit 0 is input
       bcf gpio,1      ; bit 1 is output
       btfsc gpio,0
       bsf gpio,1

Regards

Pailoor

Craig Lee wrote:
{Quote hidden}

--
WE DESIGN THE FUTURE
Website : http://www.chiptechnologies.com
Website : http://business.vsnl.com/chiptech
Content-Type: text/x-vcard; charset=us-ascii;
name="chiptech.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Ravi Pailoor
Content-Disposition: attachment;
filename="chiptech.vcf"

Attachment converted: wonderland:chiptech.vcf (TEXT/CSOm) (0000FFD5)

1999\11\24@100824 by Craig Lee

flavicon
face
It's not, this is the problem..  Based on the frequency of the
input, I then generate the output.

> {Original Message removed}

1999\11\24@104222 by James Paul

flavicon
face
Pailoor,

I recently had ocassion to need a frequency measurement too.
What I did was to watch the incoming signal for an edge. Which
edge you use doesn't matter.  When an edge is found, I clear the
RTCC and let it count up.  I then watch for the next similar
going edge, and then transfer the count in the RTCC into a
holding register.  Then using the floating point math divide
routines in the Microchip handbook vol 2, I take the reciprocal
of the number in the holding register, an viola', my frequency.
I was measuring frequency from about 1Khz to about 5Khz.  The
method I used got me to within a few cycles of the actual
frequency, which for my application was good enough. You could
increase the resolution by using a faster clock if needed.  I
don't know how precise you need to be, but this method worked
for me. Maybe it will help you directly or at least give you an
idea of how to do it.  Sorry, I can't send you the actual source
I wrote as it is copyrighted by my employer, but I don't see why
you can't use the same idea.  Hope it helps.

                                           Regards,

                                             Jim




On Wed, 24 November 1999, Craig Lee wrote:

>
> It's not, this is the problem..  Based on the frequency of the
> input, I then generate the output.
>
> > {Original Message removed}

1999\11\24@105019 by Wagner Lipnharski
flavicon
face
James Paul wrote:
[snip]
>  I was measuring frequency from about 1Khz to about 5Khz.
[snip]

ahaaaaammmm!
what was that?
:)

1999\11\24@114852 by Craig Lee

flavicon
face
What I am doing is using the INT interrupt on a 16F84 to
capture my period, using a 1us resolution.  I do this by counting
the overflows with the TMR0 interrupt, shifting by 8 and adding
the current TMRO value.  Then I shift right once to get 1/2 a
period.  Then using that number, I do a calculation to
determine the 1/2 period of my generated signal.  Then I toggle
the output and wait the half period.  When the timeout expires,
I redo the calculation with the current period value, and toggle
my output appropriately.  Keeping everything in the time domain,
limits the math to integer, and mostly binary shifts.

My problem is that I need to use the 12C508 or something of that
form factor.  Without the benefit of interrupts, I can't depend
on the background processing of the edge detection and the timing.

So more specifically, I need to be able to code 3 independent
tasks using polling techniques instead of interrupts.

These tasks are input detection, timing, and output control.

Craig


> {Original Message removed}

1999\11\24@122323 by Bobby R. Bramlett

flavicon
face
Craig,

 Have you looked at the PIC12C671 and PIC12C672.  They are 8 pin packages
like the 12C508.  They have three interrupts sources. 1) TMR0 Overflow 2)
INT pin 3) Change on I/O Pin.  I looked at digikey and the 100 piece pricing
is 1.68 for 4MHz and 1.80 for 10MHz versions.  They have A/D capability
which you can ignore.

B.

{Original Message removed}

1999\11\24@123337 by Craig Lee

flavicon
face
Thanks.

Does the I/O change work well, or is it tricky like the 'F84?

Craig

{Quote hidden}

1999\11\24@131749 by Ravi Pailoor

flavicon
face
James,

I use the same method to measure frequency from 40 to 60 with 0.1 Hz
resolution and it works like a dream. Only I use look up table (200
locations) rather than FP math for time to freq conversion.

Regards

Pailoor


James Paul wrote:

{Quote hidden}

> > > {Original Message removed}

1999\11\25@063739 by paulb

flavicon
face
Craig Lee wrote:

> Does the I/O change work well, or is it tricky like the 'F84?

 If you just use the proper pin (RB0 on the 16F84) it should work fine.

 I'd guess that polling should be pretty practical to within about ten
cycles, if that accuracy suffices.  It may do, using the "Scenix"
approach (use a real fast clock).  But I don't quite understand your
application, so I'm not sticking my nose out.
--
 Cheers,
       Paul B.

1999\11\25@120920 by Dwayne Reid

flavicon
face
How about the 12c671?  same 8 pin form factor, but has interrupts.  Think of
it as a small 16c71, with way more RAM (128 bytes).  Downside - costa about
double the '508.

dwayne


>What I am doing is using the INT interrupt on a 16F84 to
>capture my period, using a 1us resolution.  I do this by counting

snip

>My problem is that I need to use the 12C508 or something of that
>form factor.  Without the benefit of interrupts, I can't depend
>on the background processing of the edge detection and the timing.


Dwayne Reid   <spamBeGonedwaynerspamBeGonespamplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 15 years of Engineering Innovation (1984 - 1999)

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Do NOT send unsolicited commercial email to this email address.
My posting messages to Usenet neither grants consent to receive
unsolicited commercial email nor is intended to solicit commercial
email.

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