mandag den 30. maj 2011

Code and DAC construction

After making the diagrams, I constructed the code and the DAC.
The DAC ended up looking like this:

















The four red wires coming from the PIC is the four input bits.
The other wires are connections for 15 volts, -15 volts, output and ground.

The code for the counter is as follows:

#include 

void main()
{
 TRISD = 0;
 
 PORTD = 0b00000000;

while(1)
{

PORTD++;

if(PORTD == 16)
{
 PORTD = 0; 
}

for(int i = 0 ; i < 30000 ; i++);
 
}
}

Ingen kommentarer:

Send en kommentar