Waveform Generator using PIC

Thread Starter

Munyaneza Ghislain

Joined Dec 29, 2015
Hello everyone ,
I am a noobie so I don’t know much about PIC and microcontroler ( Basic knowledge of C and PIC18 programming ) . But I am making a group project in order to learn . The global project is to make some DIY Signal Generator/Oscilloscope ( a bit like NI myDAQ ) .

My part is the generator I would like to generate a square wave and a sine

-Sine 1V Max with variable amplitude
-Square 0V-5V ( fixed duty cycle 50% )
-Both signal should have variable frequency [ Range : 10Hz - 100kHz ]
-Parameters wil be sent by another PIC ( SPI )

I was thinking using a PIC16 or PIC18 and generate a simple PWM signal for the square wave and adding a D/A converter chip for the sine but i’m not quite sure if I am on the good path. That’s why I would like to know your opinion on:

-Wich PIC familly should I use for this project and why ? ( I know it depend on the resolution i want but since the purpose is to learn I’ll go for the cheapest )
-Which method is the most straightforward for a beginner to implement this ( just the main idea ) ?


Joined Jun 28, 2014
I suggest you select a PIC with built-in DAC. Any PIC family will do which is fast enough.

The most important thing is resolution. How fast you want your points to be generated? For examle, 100kHz sine wave is 5us per half-wave. How many points you want on your half-wave. 50? Then you need to update your DAC every 100 ns. Sure as hell, you cannot do it with PIC18, as the fastest PIC18 takes 63ns per instruction. 5? Then you need to update DAC every 1us. This can be done with fast PIC18 (16 instructions per 1us), but will be hard unless you did these things before. Better get a good PIC with DMA, such as PIC24, or lower your requirements.

Don't worry, the part of the team doing the oscilloscope is in much more troubles than you are :)


Joined May 4, 2013
You may want to consider Direct Digital Synthesis techniques. More complex than just outputting a binary value to a DAC but there are advantages as well.
(I agree with NorthGuy about the scope part being more difficult.)