Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Cheap small PIC needed to generate half sine reference signal

Status
Not open for further replies.

cupoftea

Advanced Member level 5
Joined
Jun 13, 2021
Messages
2,611
Helped
54
Reputation
108
Reaction score
115
Trophy points
63
Activity points
13,687
Hi,
We wish to get a unipolar sinusoidal reference....ie like a rectified sine....we only want 1vpk...and preferably variable to eg 0.9vpk etc.
Also 50Hz...but it will be 100Hz because its a train of positive sine "halves".
{EDIT...it doesnt have to provide any power}

Which cheap, small PIC can be programmed to give a sinusoidally varying PWM so that we can filter it and get our half sine pulse train?
Can any PIC do this?
 

Two PWM channels, one to gen the arbitrary waveform, half sine, the other to control a jfet acting
as a variable R in a voltage divider to control sine amplitude by controlling JFET Vgs.


Or -

1628418522751.png



This is single chip design. Also if you wanted to control amplitude over a COM interface,
like I2C, SPI, UART, chip can accommodate that as well. Or use onchip quaddec to handle a
rotary encoder to manage amplitude using onchip PGA and the onchip Wavedac DAC
control.

Do you want continuous fine control over amplitude or steps ?

Note Wavedac, under user control, can be sync or asych to AC line.

Of course you have not, as of yet, speced precision in frequency, amplitude, resolution needed.



Regards, Dana.
 
Last edited:
Hi,

I guess every PIC with PWM periferal will do the job.

Amplitude control could be done by "multiplying" the PWM (duty cycle) values.

Klaus
 
Using multiplying PWM values for amplitude control has some drawbacks, discussed here, post #4, filtering
compromises.....



Regards, Dana.
 
Hi,

here we talk about 1V amplitude down to 0.9V amplitude.
This is 90%. or in bits: a reduction of 0.15 bits. --> like 10 bit resolution vs 9.85 bit resolution.

I guess the "low point count per fullwave" results in higher distortion.

Klaus
 
Hi,

Either the table makes no sense or I don´t understand it.

* I don´t understand the difference in "fundamental dbV" from #64 samples to #32 samples of about 18dB
* the PWM resolution is completely missing (it just says DAC resolution 8 bits)
* What is 1st harmonic? ... usually this is fundamental....
* I expect even order harmonics much lower than odd order harmonics

And usually you need an analog reconstruction filter. It has big influence on resulting THD.

Klaus
 
Hi,

Either the table makes no sense or I don´t understand it.

* I don´t understand the difference in "fundamental dbV" from #64 samples to #32 samples of about 18dB
* the PWM resolution is completely missing (it just says DAC resolution 8 bits)
* What is 1st harmonic? ... usually this is fundamental....
* I expect even order harmonics much lower than odd order harmonics

And usually you need an analog reconstruction filter. It has big influence on resulting THD.

Klaus
1) Fund dbV is label for vertical axis values in spectrum.
2) Referenced post was done with a sw cap DAC, not a PWM
3) Forgot to update the old post table, 1'st is fundamental
4) Spectrum I got off simp[e test bed and analyzer

1628453059017.png



Regards, Dana.
--- Updated ---

Reconstruction filter, none used, however DAC is buffered by OpAmp so its
slew and GBW acts on DAC output. Of course the resolution BW of analyzer
is functioning as a filter.
 
Last edited:
Can any PIC do this?
Answering the original question - yes, any PIC with either enough IO pins to drive an R-2R network or has a PWM generator will work and can easily produce almost any repetitive waveform you want. The first that comes to my mind is the 8-pin 12F683 but almost all PICs can do it.

Brian.
 
Here is actual solution -

1628627094230.png


Basically WaveDAC generates sine, used just 64 sample, could have used up to 256.
Output is 4V, so R divider takes that down to 1V. A button is debounced and drives a
T F-F to select between .9V and 1V. You could have used a pot to make amplitude
variable. Then R divider is buffered via OpAmp follower.

When button is pushed that toggles .9V or 1V selection, and lights LED when in .9V.
The T F-F feeds and open drain driver to ground the additional divider R to drop the V
to .9V.

Single chip solution except for Rs, LED, button.

In this example only two lines of code needed. To start the WaveDAC8 and the OpAmp.
If you needed to burst N half sines in a single burst thats easily accomplished with onchip
resources.

Scope shot -

1628627384080.png


Again sample resolution could be raised to get a more continuous generation of the half sine.

This all used very few chip resources, leaving the rest available for use.



Regards, Dana.
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top