CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Generate a sine wave using a PIC microcontroller
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Sat Dec 24, 2016 3:27 pm     Reply with quote

All sine waves can be made with 90 deg of table.

0-90 positive count UP rom
90-0 positive down rom

The negative half cycle is created by output inversion
of the two sequences above
as you cross zero at the end of the second 1/4 cycle.

Learning to write your own program for the AD9833
takes just as much pic skill but requires so much less hardware and power
and leaves the PIC free to do useful work -
other than grind out a jittery low resolution CONST ROM table......
Ttelmah



Joined: 11 Mar 2010
Posts: 20059

View user's profile Send private message

PostPosted: Sat Dec 24, 2016 3:42 pm     Reply with quote

And, be aware that using a 16bit DAC does not give you the corresponding quality on the output, unless everything about your board is _very_ carefully designed. For a couple of volts output, one bit on a 16bit DAC, is just 30uV, unless every feature of your design (particularly separation of digital and analog paths, and really good quality grounding), is really well done, you won't get even 'close' to 16bit performance.
It's amazing how 'poor' many supposedly 16bit systems actually 'are' when you put them on test....
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Sat Dec 24, 2016 8:00 pm     Reply with quote

Arakel wrote:
I know that this information is gold and I am angry that I can not understand it!

Thank you! I do not quite get the decibels, I do not know exactly how much a decibel is because it is an equesion( ratio). I think it should be something like
the higher the decibels the closer do we get to "1" meaning to the idealistic result? I guess minus decibels are from minus to the idalistic result?

So a 16 bit DAC should do the job especially if there is one specialized for SIN wave conversion( I do not know if there is one)? But it still depends on the components accuracy. I know it is done somehow now a days so I have to find how.

Should it not be 180 degrees?
asmboy is correct.
You only NEED 90 degrees worth of SIN data.
Think about it.
SIN 0 to 90 goes from 0 to 1.
SIN 90 to 180 are mirror of SIN 90 to 0.
(SIN 100 = SIN 80, SIN 110 = SIN 70 etc)
SIN 180 to SIN 360 are inversion of SIN 180 to 0.
(SIN 190 = - SIN 170, SIN 200 = - SIN 160 etc)

Draw and cut out a sine wave on paper, then fold it to see how it works.

Look up decibels in your school book.

Mike
temtronic



Joined: 01 Jul 2010
Posts: 9632
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Dec 25, 2016 8:14 am     Reply with quote

gee, I wonder how 'good' the waveform has to be to run a 25Hz syncho 3Watt clock motor? I salvaged a 'time clock' unit from old factory here and 25Hz was the power frequency until early 50s when Canada went 60 Hz.

One of those interestng PICprojects still 'on the books' to do.....

Jay
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Sun Dec 25, 2016 11:31 am     Reply with quote

Quote:
how 'good'


Square waves when used to drive inductive things like motors
make EMI/RFI and compliance testing headaches.

How "Good" depends on what compliance standards you must meet.
I do medical electronics and my "good" is spec'd awfully tight.
Too tight by far for what you describe...
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group