‘Custom function’ generator

Initially I planned to make a custom function generator which will be able to store waveforms, can be interfaced with computers, can be self contained, with a LCD as the UI, and would be able to produce bipolar waveforms with adjustable amplitudes and frequencies.

My first trial went in the attempt of running a 128×64 graphic LCD module with a PIC18F4550. After a little experimentation and brainstorming I realized that PIC18F4550 didn’t have enough RAM to run the display routines and generate the functions, let alone interfacing with the computers. I stopped trying,

A few days after my first failure of running the Graphic LCD module I learned about this emulated USB-serial library from Microchip. I thought it would be very cool when I will interface with the computers. From the start the PIC architecture scares me a little. Maybe that is because I am more accustomed with AVRs.

Few days ago I got this AVRISP mkII from Atmel and I started to work on the function generator. First I wrote a Processing sketch that would be used to ‘paint’ the waveforms. When the painting program was done, I started to rummage samples of DACs I got as samples from Texas Instruments. I find their service of samples really helpful for students like me.

I settled with the DAC TLC7226, it’s a quad DAC with 8-bit input. Has unipolar operation and can work in latched and transparent mode. After looking at the Datasheet I started wiring the DAC with an ATmega8 on breadboard. Within a few minutes I could get analog signals in my DSO nano.

Then I thought of bipolar signalling, although I left the electrical circuit part for unipolar to bipolar conversion for later, I started writing the AVR firmware for bipolar signalling with adjustable frequency which will be adjustable from the PC with UART communication line.

After I  coded a little, I started to test processing with the Bluetooth modem I had with me. I found out that it’s really a hassle free serial cable replacement but it won’t work with Processing. After a lot of tweaking the Processing IDE, I slid in the ExpressCard which adds Serial(RS-232) and Parallel port to my laptop and used my old custom made MAX232 board.

Then I started to code Processing sketch and the firmware almost simultaneously, trying to make a serial communication work. After an evening of bugging and debugging, I decided to strip down features and make a simple unipolar fixed frequency signal generator. After a while I was having trouble with the serial communication and found out that the problem was the slowness of the AVR and the speed of the PC. Even if I get the bauds right, the UART buffer in AVR is pitifully small and cannot handle all the bytes sent to it, so I added delay to the serial transmission from the PC. After getting the delays right, I found trouble in managing the UART routines in AVR. I decided to use interrupts with flags and got it done!

Ultimately I got the thing running and updating waveforms that was given from the PC. Then I added this frequency adjustment feature and I was at my first version.

This is the hardware on breadboard, and my custom breadboard AVRISP 6-pin programming header above. 🙂

Here’s the waveform generated, shown in DSO nano v2 running BenF firmware.

The circuit schematic is pretty simple I didn’t bother to document that. The AVR C (compiled with AVRGCC) code has all the necessary descriptions.

I uploaded the AVR Studio 5.0 project file and the processing sketch. Click here to download.

I couldn’t manage to get to higher frequencies, maybe with better designed routines I can push it a little more. My next stop would be to extending this function generator, with bipolar signal generation, amplitude control etc. For the the project is shelved. I have other things in mind.

Two waveforms and there DSO captures,

Advertisements

2 thoughts on “‘Custom function’ generator

  1. hi bro,

    i’m doing almost similar project,coincidentally i’m too using TLC7226 🙂
    my question is what did you use to create that custom waveform(bar like GUI)?
    any control with visual basic or so?i also saw it on your video at vimeo

    • Thanks for checking up my blog.

      The GUI is made with Processing. It’s a Java based language tailor made for these purpose. It’s very easy to use. Check it up at http://www.processing.org/.

      And there is also a serial Express expansion card used. There is one problem that I encountered while using Serial-over-bluetooth. It somehow is not compatible with Processing. Do use legacy serial ports of expansion cards.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s