Searching \ for '[PIC]:Frequency Generator?' 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/devices.htm?key=pic
Search entire site for: 'Frequency Generator?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:Frequency Generator?'
2001\07\22@102323 by Christopher Tyler

flavicon
face
Hi, I am still an amateur PIC programmer and am having problem writing
a program. What I am trying to do is write a frequency generator to
generate pulses between 20 and 400Hz. I am using a 16C57 for the
program. I am using the RTCC to get the frequency. I tried using a
lookup table to change frequencies, but it was to big to fit into the
1st 256bytes of the page(the simulator gave all sorts of wierd problems)
and I had to use 2 tables...one for the RTCC and another to change the
Prescaler.....This was not very effiecient......Can anyone give me any
ideas on other ways  of doing this?

Christopher Tyler

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\07\22@103406 by Roman Black

flavicon
face
Christopher Tyler wrote:
>
> Hi, I am still an amateur PIC programmer and am having problem writing
> a program. What I am trying to do is write a frequency generator to
> generate pulses between 20 and 400Hz. I am using a 16C57 for the
> program. I am using the RTCC to get the frequency. I tried using a
> lookup table to change frequencies, but it was to big to fit into the
> 1st 256bytes of the page(the simulator gave all sorts of wierd problems)
> and I had to use 2 tables...one for the RTCC and another to change the
> Prescaler.....This was not very effiecient......Can anyone give me any
> ideas on other ways  of doing this?


Hi Christopher, how many different frequencies
do you need, and how accurate does each one have
to be? 20Hz t 400Hz is not a very big range.
-Roman

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\07\22@161354 by Christopher Tyler

flavicon
face
Roman Black wrote:

> Christopher Tyler wrote:
> >
> > Hi, I am still an amateur PIC programmer and am having problem writing
> > a program. What I am trying to do is write a frequency generator to
> > generate pulses between 20 and 400Hz. I am using a 16C57 for the
> > program. I am using the RTCC to get the frequency. I tried using a
> > lookup table to change frequencies, but it was to big to fit into the
> > 1st 256bytes of the page(the simulator gave all sorts of wierd problems)
> > and I had to use 2 tables...one for the RTCC and another to change the
> > Prescaler.....This was not very effiecient......Can anyone give me any
> > ideas on other ways  of doing this?
>
> Hi Christopher, how many different frequencies
> do you need, and how accurate does each one have
> to be? 20Hz t 400Hz is not a very big range.
> -Roman
>

Preferably all 380, but in the program I cut it down to 20Hz  to 255Hz. with
one value for each frequency. This was so that all the registers were kept as
8bit . Also about 5% accuracy is alright.....I worked out a table
for each of the values.....just implementing it into the program is a
problem.. :)  I hope that helps.
-Chris


>
> --
> http://www.piclist.com hint: The list server can filter out subtopics
> (like ads or off topics) for you. See http://www.piclist.com/#topics

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\07\22@184332 by Olin Lathrop

face picon face
> > Hi Christopher, how many different frequencies
> > do you need, and how accurate does each one have
> > to be? 20Hz t 400Hz is not a very big range.
> > -Roman
> >
>
> Preferably all 380, but in the program I cut it down to 20Hz  to 255Hz.
with
> one value for each frequency. This was so that all the registers were kept
as
> 8bit . Also about 5% accuracy is alright.....I worked out a table
> for each of the values.....just implementing it into the program is a
> problem.. :)  I hope that helps.

Saying "all" 380 makes no sense here, since there are an infinite number of
frequencies between 20Hz and 400Hz  I guess you mean all the frequencies
that happen to come out to integer values when measured in Herz?  OK, but
that contradicts your 5% accuracy requirement.  400Hz/20Hz is a frequency
range of 20:1.  At 5% accuracy, this can therefore be covered by Log1.05(20)
= 62 different frequencies.  You need to decide what your requirements
really are.

A simple way to produce different tones is using the PWM output as a square
wave generator.  However, the lowest frequency generated that way is
oscillator/16,384.  You could use either a slow clock if the PIC has little
else to do, or an external divider after the PWM output.

Another way is to use timer 1 with a CCP module in compare mode.  This gets
you a 16 bit period register.

Another way is to do it all in software.  This is feasible in your case
because your frequencies are so low.  Even a 12C508A can do this, but I
don't know what other features you need to decide which frequency to emit.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, spam_OUTolinTakeThisOuTspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\07\24@191409 by Christopher Tyler

flavicon
face
{Quote hidden}

Thanx for the help, the timer1 & CCP module thing sounds like what I need.
16bits is what I need :) I would still need to use the lookup table, right?


About the PWM, we have a choice of going that way or using DDS(Direct Digital
Synthesis:  for DDS theory
--->http://www.geocities.com/CapeCanaveral/5611/dds.html)
Although I will need to port it to a 16C717 or flash version of it, I think PWM
is the way to go.

BTW: I didnt make myself clear about the accuracy, because it was a
thumbsuck...:) But it does actually have to be accurate. esp. the higher Hz.
And I need to have the Hz. in integers, ie. (1,2,3,4,5.....399,400) Sorry about
that...

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2001\07\26@114816 by Akbar Patil

flavicon
face
Hallo everybody this is my first massage.
I want information about the best PIC programmers ( economically &
functionally)available in the market.
I want use it for hobby purpose. Mainly I would like to work on on flash
type microcontrollers.
Can I get second hand programmer.
Akbar Patil

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


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