onsdag den 1. juni 2011

Diagram for the DAC

Here is the diagram for the standard setup of the DAC
The reference voltage is 5 volts
The amplification is -1
The amplifier is inverting
There are external resistors to bring the voltage down from 15 volts to 5 volt
There are internal resistors for the reference resistor and the DAC

The diagram for the code structure:

Code and DAC construction

After making the diagrams, I constructed the sinus wave table, the DAC code and the physical DAC.
Here is a graph of the sinus table:

This is how the DAC ended up looking like this:


The ten red wires coming from the PIC is the ten input bits.
The small board is easy access for 15 volts, -15 volts, output and ground




Measuring results

 After getting the code to run and assembling the 10 bit DAC converter I went to the lab to measure it.
The code is written to make a slow curve. One cycle is 3.6 seconds.

søndag den 29. maj 2011

Extras

This is the code for the generating of the sinus table:



#include 
#include 
#include 
using namespace std;


float number = 34.453;
float counter = 0;

void sinusTableFunktion(float _counter, float _number)
{

  ofstream myfile;
  myfile.open ("sinusTable.txt" , ios::app);
  myfile << (int)_counter << "\t" << (int)_number << "\n";
   myfile.close();

}

void writeSinusTable()
{

 ofstream myfile;
  myfile.open ("sinusTable.txt" );
    myfile.close();

    for(int i = 0 ; i < 361 ; i++)
 {
  number = 512+(512*sin(counter/57.295779513082)); //   360/(PI*3)
  sinusTableFunktion(counter, number);
  counter++;
 }

}


void main()
{
 
 writeSinusTable();

}