- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I am currently trying to implement a PI controller with an output that will be multiplied with a 60 Hzsine wave.
I am currently using the WaveDAC8 component of the top design in the PSoC 5LP. My first idea was to feed the output of the WaveDAC into an ADC SAR, however, the results I was getting were a bit funky.
Would this operation be better if I used a lookup table? Or would it not make a difference?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need a table for sine values (int preferred) of the size of the points (resolution) you need.
Set up a timer that generates an interrupt every time a new sample has to be generated (60 * points number) per second. and do your calculations. You may even save 3/4 of your table by adjusting the value to the quadrant you actually work on, Do not spend too much time in the interrupt handler, do the AD conversion in the main-loop.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The WaveDAC is using a lookup-table. So you might use a timer to rread from a table the wanted value with your wanted granularity.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Would this work for multiplication with some other variable that is also a value read from an ADC?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also, how would I implement this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need a table for sine values (int preferred) of the size of the points (resolution) you need.
Set up a timer that generates an interrupt every time a new sample has to be generated (60 * points number) per second. and do your calculations. You may even save 3/4 of your table by adjusting the value to the quadrant you actually work on, Do not spend too much time in the interrupt handler, do the AD conversion in the main-loop.
Bob