Advertisement

Function Generator Sine / Triangle / Square / Saw ( PIC16F870 )

Not rated 8,824

#function generator #PIC16F870 #sine wave #triangle wave #square wave #saw wave #D/A converter #R/2R ladder #lookup table
Function Generator Sine / Triangle / Square / Saw ( PIC16F870 )
Function Generator Sine / Triangle / Square / Saw ( PIC16F870 )

Description: After the recent demise of our multifunction signal generator, we decided to make one of our own. The circuit uses a PIC16F870 (about $3), an R/2R resistor ladder network (for a real fast and cheap D/A), and a few other parts. You can check out the schematic and the current source file. Also the object (hex) file. All of the sine wave functions utilize a full 256 byte by 8 bit lookup table. Contrary to what you may have heard elsewhere, it is possible to use a full memory page in the PIC for a lookup table - check it out. The only real elaboration was the design of the low-pass filter. With the present design running on a 20 mhz clock, you can get over 60 khz of very clean sine waves. The frequency is adjustable in 1, 25, and 500 hz steps. The unit produces accurate frequencies down to 1 hz.

Since all of the waves are generated in software, the 'user interface' had to be kept to a minimum. Three LED's indicate the functions (which vary depending on the type of wave being generated). Three more LED's indicate the step rate of the adjustment control. Pushing the RATE button advances to the next step rate and pushing the select button goes to the next function.

The wave function itself is selected by holding down the select button while rotating the adjustment control. Since there is no visible indication of the wave type or frequency, you need to have a scope hooked up to see what you are doing.

The design of the multifunction signal generator incorporates a microcontroller, specifically the PIC16F870, which serves as the core processing unit. This microcontroller is programmed to generate various waveforms including sine, square, and triangle waves using a software-based approach. The R/2R resistor ladder network functions as a digital-to-analog converter (DAC), providing a cost-effective means to convert the digital signals from the microcontroller into analog waveforms.

The architecture utilizes a lookup table that is 256 bytes in size, with each entry being 8 bits. This table is crucial for generating the sine wave functions, allowing for smooth and accurate waveform outputs. The design also includes a low-pass filter to ensure the generated sine waves are clean and free from high-frequency noise, which is particularly important when operating at frequencies exceeding 60 kHz.

Frequency adjustment is achieved through a user interface that consists of a minimalistic control scheme. The interface features three LEDs that indicate the current waveform function and an additional three LEDs that signal the step rate of frequency adjustment. The user can cycle through different step rates by pressing the RATE button and can select different waveform functions by holding down the SELECT button while adjusting the control knob.

The ability to generate frequencies down to 1 Hz, with adjustable steps of 1 Hz, 25 Hz, and 500 Hz, enhances the versatility of this signal generator. However, due to the lack of a visual display, users must connect an oscilloscope to monitor the output waveforms and verify the selected frequency and waveform type. This design approach emphasizes functionality and cost-effectiveness while maintaining the essential capabilities of a multifunction signal generator.After the recent demise of our multifunction signal generator, we decided to make one of our own. The circuit uses a PIC16F870 (about $3), an R/2R resistor ladder network (for a real fast and cheap D/A), and a few other parts. You can check out the schematic and the current source file. Also the object (hex) file. All of the sine wave functions utilize a full 256 byte by 8 bit lookup table. Contrary to what you may have heard elsewhere, it is possible to use a full memory page in the PIC for a lookup table - check it out.

The only real elaboration was the design of the low-pass filter. With the present design running on a 20 mhz clock, you can get over 60 khz of very clean sine waves. The frequency is adjustable in 1, 25, and 500 hz steps. The unit produces accurate frequencies down to 1 hz. Since all of the waves are generated in software, the 'user interface' had to be kept to a minimum. Three LED's indicate the functions (which vary depending on the type of wave being generated). Three more LED's indicate the step rate of the adjustment control. Pushing the RATE button advances to the next step rate and pushing the select button goes to the next function. The wave function itself is selected by holding down the select button while rotating the adjustment control.

Since there is no visible indication of the wave type or frequency, you need to have a scope hooked up to see what you are doing.

Related Circuits