AVR GCC

Installation Tools

apt-get install avr-gcc avr-libc avrdude

Fuses Config auslesen

avrdude -P /dev/ttyS0 -c ponyser -p m16 -v

Bsp. Default Fuses Atmega16

avrdude: Device signature = 0x1e9403
avrdude: safemode: lfuse reads as E1
avrdude: safemode: hfuse reads as 99

= 1 MHz RC Osci Takt intern

1tes Testprogramm

//----------------------------------------------------------------------
// Titel     : Beispiel LED an für myAVR-Board
//----------------------------------------------------------------------
// Funktion  : Schaltet alle 3 LEDs an
// Schaltung : PortB 0-2 an LEDs
//----------------------------------------------------------------------
// Prozessor : ATmega8/48/88/168
// Takt      : 3.6864 MHz
// Sprache   : C
//----------------------------------------------------------------------
#define  F_CPU 3686400  // Taktfrequenz des myAVR-Boards
#include <avr/io.h>;     // AVR Register und Konstantendefinitionen
#include <util/delay.h>; // Delay Funktion
//----------------------------------------------------------------------
void long_delay(uint16_t ms) {
       for(; ms>0; ms--) _delay_ms(1);
 }
main ()
 {
    DDRB=0xFF;        //PortB auf Ausgang konfigurieren
    do
    {
       PORTB=0x01;    // PortB High, LEDs on
       long_delay(100);
       PORTB=0x02;
       long_delay(100);
       PORTB=0x04;
       long_delay(100);
       PORTB=0x02;
       long_delay(100);
     } while (1);     // Mainloop
 }
//----------------------------------------------------------------------

Programm compilen und auf den ATMEGA8 flashen

Skript atmegaflash.sh

avr-gcc -O -mmcu=atmega8 -o $1.out $1.c
avr-strip $1.out
avr-objcopy -O ihex $1.out $1.hex
#avrdude -c sp12 -p m8 -P /dev/parport0
avrdude -p m8 -c sp12 -P /dev/parport0 -E noreset,vcc -U flash:w:$1.hex

Programm compilen und auf Atmega32u2 flashen

avr-gcc -O -mmcu=atmega32u2 -o avr-usb-162_led.out avr-usb-162_led.c 
avr-strip avr-usb-162_led.out 
avr-objcopy -O ihex avr-usb-162_led.out avr-usb-162_led.hex 

sudo dfu-programmer atmega32u2 erase 
sudo dfu-programmer atmega32u2 flash avr-usb-162_led.hex 
sudo dfu-programmer atmega32u2 start

Programm auf Atmega32u2 mit Arduino Bootloader flashen

avrdude -v -v -v -v -patmega32u2 -cavr109 -P/dev/ttyACM3 -b57600 -D -Uflash:w:avr32u2dac.hex:i

Atmel AVR AVRISP MKII Treiber wechseln

Zadig – USB driver installation made easy

Programme

A/D Wandler Test

#include <avr/io.h>

int main(void)
{
   DDRB = 0xFF;
   while (1)
   {
        uint8_t i;
        uint16_t result;
        int i2 = 60;
        ADMUX = (0<<REFS1)|(1<<REFS0); // Kanal waehlen
        ADMUX |= (1<<REFS1) | (1<<REFS0); // interne Referenzspannung nutzen


        ADCSRA = (1<<ADEN) | (1<<ADPS1) | (1<<ADPS0);  
	// Frequenzvorteiler
        // setzen auf 8 (1) und ADC aktivieren (1)

        /* nach Aktivieren des ADC wird ein "Dummy-Readout" empfohlen, man liest
          also einen Wert und verwirft diesen, um den ADC "warmlaufen zu lassen" */
        ADCSRA |= (1<<ADSC); // eine ADC-Wandlung
        while ( ADCSRA & (1<<ADSC) ) {
          ;     // auf Abschluss der Konvertierung warten
        }
        result = ADCW;  // ADCW muss einmal gelesen werden,
        // sonst wird Ergebnis der nächsten Wandlung
        // nicht übernommen.

        /* Eigentliche Messung - Mittelwert aus 4 aufeinanderfolgenden Wandlungen */
        result = 0;


        for( i=0; i<i2; i++ )
        {
         ADCSRA |= (1<<ADSC);            // eine Wandlung "single conversion"
         while ( ADCSRA & (1<<ADSC) ) {
           ;   // auf Abschluss der Konvertierung warten
         }
         result += ADCW; // Wandlungsergebnisse aufaddieren

        }
        ADCSRA &= ~(1<<ADEN); // ADC deaktivieren (2)

         result /= i2; // Summe durch vier teilen = arithm. Mittelwert
         if (result < 128)
         {            
            PORTB = 0b10000000;
         }
         else if (result >= 128 && result < 256)   
         {
            PORTB = 0b01000000;
         }
         else if (result >= 256 && result < 384)   
         {
            PORTB = 0b00100000;
         }
         else if (result >= 384 && result < 512)   
         {
            PORTB = 0b00010000;
         }
         else if (result >= 512 && result < 640)   
         {
            PORTB = 0b00001000;
         }
         else if (result >= 640 && result < 768)   
         {
            PORTB = 0b00000100;
         }
         else if (result >= 768 && result < 896)   
         {
            PORTB = 0b00000010;
         }
         else
         {
            PORTB = 0b00000001;
         }
   }
   return 1;
}

Pollin Programmer Board

Flash mit avrdude und compile mit avr-gcc
Anschluss über serielle Schnittstelle

avr-gcc -O -mmcu=atmega8 -o $1.out $1.c
avr-strip $1.out
avr-objcopy -O ihex $1.out $1.hex
avrdude -p m8 -c ponyser -P /dev/ttyS0 -v -U flash:w:$1.hex

LED Muster Generator

//----------------------------------------------------------------------
// Titel     : LED schalten / Poti auswerten / Muster generieren
//----------------------------------------------------------------------
// Funktion  : Schaltet alle 6 LEDs nacheinander in verschiedenen Mustern an 
// Schaltung : PortB 0-5 an LEDs bzw. ULN2803, PortD 0 an Poti
//----------------------------------------------------------------------
// Prozessor : ATmega8
// Takt      : 3.6864 MHz
// Sprache   : C
//----------------------------------------------------------------------
#define  F_CPU 3686400  // Taktfrequenz des myAVR-Boards
#include <avr/io.h>     // AVR Register und Konstantendefinitionen
#include <util/delay.h> // Delay Funktion
//----------------------------------------------------------------------
void long_delay(uint16_t ms) {
       for(; ms>0; ms--) _delay_ms(1);
 }

int main(void)
{
   DDRB = 0xFF;
   int delay = 20;
   while (1)
   {
        uint8_t i;
        uint16_t result;
        int i2 = 60;
        ADMUX = (0<<REFS1)|(1<<REFS0); // Kanal waehlen
        ADMUX |= (1<<REFS1) | (1<<REFS0); // interne Referenzspannung nutzen


        ADCSRA = (1<<ADEN) | (1<<ADPS1) | (1<<ADPS0);  
	// Frequenzvorteiler
        // setzen auf 8 (1) und ADC aktivieren (1)

        /* nach Aktivieren des ADC wird ein "Dummy-Readout" empfohlen, man liest
          also einen Wert und verwirft diesen, um den ADC "warmlaufen zu lassen" */
        ADCSRA |= (1<<ADSC); // eine ADC-Wandlung
        while ( ADCSRA & (1<<ADSC) ) {
          ;     // auf Abschluss der Konvertierung warten
        }
        result = ADCW;  // ADCW muss einmal gelesen werden,
        // sonst wird Ergebnis der nächsten Wandlung
        // nicht übernommen.

        /* Eigentliche Messung - Mittelwert aus 4 aufeinanderfolgenden Wandlungen */
        result = 0;


        for( i=0; i<i2; i++ )
        {
         ADCSRA |= (1<<ADSC);            // eine Wandlung "single conversion"
         while ( ADCSRA & (1<<ADSC) ) {
           ;   // auf Abschluss der Konvertierung warten
         }
         result += ADCW; // Wandlungsergebnisse aufaddieren

        }
        ADCSRA &= ~(1<<ADEN); // ADC deaktivieren (2)

         result /= i2; // Summe durch vier teilen = arithm. Mittelwert
         if (result < 128)
         {            
		PORTB = 0b00000001;
		long_delay(delay);
		PORTB = 0b00000010;
		long_delay(delay);
		PORTB = 0b00000100;
		long_delay(delay);
		PORTB = 0b00001000;
		long_delay(delay);
		PORTB = 0b00010000;
		long_delay(delay);
		PORTB = 0b00100000;
		long_delay(delay);
         }
         else if (result >= 128 && result < 256)   
         {
		PORTB = 0b00000001;
		long_delay(delay);
		PORTB = 0b00000010;
		long_delay(delay);
		PORTB = 0b00000100;
		long_delay(delay);
		PORTB = 0b00001000;
		long_delay(delay);
		PORTB = 0b00010000;
		long_delay(delay);
		PORTB = 0b00100000;
		long_delay(delay);
		PORTB = 0b00010000;
		long_delay(delay);
		PORTB = 0b00001000;
		long_delay(delay);
		PORTB = 0b00000100;
		long_delay(delay);
		PORTB = 0b00000010;
		long_delay(delay);
         }
         else if (result >= 256 && result < 384)   
         {
		PORTB = 0b00111111;
		long_delay(10);
		PORTB = 0b00000000;
		long_delay(10);
         }
         else if (result >= 384 && result < 512)   
         {
		PORTB = 0b00111111;
		long_delay(20);
		PORTB = 0b00000000;
		long_delay(20);
         }
         else if (result >= 512 && result < 640)   
         {
		PORTB = 0b00111111;
		long_delay(30);
		PORTB = 0b00000000;
		long_delay(30);
         }
         else if (result >= 640 && result < 768)   
         {
		PORTB = 0b00000000;
         }
         else if (result >= 768 && result < 896)   
         {
		PORTB = 0b00000000;
         }
         else
         {
		PORTB = 0b11111111;
         }
   }
   return 1;
}

LED Fading

#include <avr/io.h>
#include <stdint.h>

// Analog/Digital Wandler initialisieren
void adc_init(void) 
{
        // externe Referenzspannung und AD-Wandlerkanal 0 (ADC0 / PC0) auswählen
        ADMUX = 0;

        // AD-Wandler einschalten und Prescaler = 64 einstellen (enstpricht 115 khz Wandlertakt)
        ADCSRA = (1<<ADEN)|(1<<ADPS2)|(1<<ADPS1);
}

// Timer einstellen
void timer_init(void)
{
 	// OC1A auf Ausgang
	DDRB = (1 << PB1 );

	// Was die einzelnen Einstellungen genau bedeuten steht im Datenblatt
	//
	// Timer 1 einstellen
        //  
        // Modus 14: Fast PWM, Top von ICR1
        //
        // >> WGM13    WGM12   WGM11    WGM10
        //     	1        1       1        0
        //
        // Timer Vorteiler: 1
	//
        // >> CS12     CS11    CS10
        //      0        0       1
        //
        //  Steuerung des Ausgangsport: Set at BOTTOM, Clear at match
	//
        // >> COM1A1   COM1A0
        //      1        0

	TCCR1A = (1<<COM1A1) | (1<<WGM11);
	TCCR1B = (1<<WGM13) | (1<<WGM12) | (1<<CS10);

	// Den Endwert (TOP) für den Zähler setzen
 	// Der Zähler zählt bis zu diesem Wert
	// Hier kann man unter anderem die Frequenz der PWM einstellen
  	ICR1 = 0x0080;

	// 0x0080 ist eine Abstufung mit 128 Stufen.
	// Problem: Wenn wir einen Motor mir PWM ansteuern vibrieren
	// seine Teile automatisch in der Frequenz mit.
	// Also legen wir diese in den nicht hörbaren Bereich.
	// 4MHz / 128 = 31250 Hz

}  

int main()
{
	// 16bit Variable
  	uint16_t buffer;

	// Timer für PWM initialisieren
	timer_init();

  	// A/D - Wandler initialisieren
  	adc_init();

	// OCR1A ist der Compare Wert
	// Wenn der Zähler diesen Wert erreicht, wird mit
	// obiger Konfiguration der OC1A Ausgang abgeschaltet
	// Sobald der Zähler wieder bei 0 startet, wird der	
	// Ausgang wieder auf 1 gesetzt
	//
	// Durch Verändern dieses Wertes, werden die unterschiedlichen
	// PWM Werte eingestellt.

 	// Startwert = 0. Wird in der while-Schleife gesetzt.
  	OCR1A = 0x0000;


	while( 1 )
	{
	// Wandlung vom analogen Eingang starten
        ADCSRA |= (1<<ADSC);

        // Warten bis die AD-Wandlung abgeschloßen ist
        while ( !(ADCSRA & (1<<ADIF)) )
        	;

        // AD-Wert auslesen.
        // ADCH muss als zweites gelesen werden, da nachdem ADCL gelesen wurde
        // das ADC-Register gesperrt ist bis ADCH auch ausgelesen wurde.
        // buffer = ADCL | (ADCH<<8);

        // Oder einfacher.
        buffer = ADC;

	// Da die PWM eine Auflösung von 8bit hat aber der buffer 10bit gross ist
	// müssen wir noch transformieren

	OCR1A = (buffer>>3);
   } 
}

UART

serielle Schnittstelle unter Linux einstellen:

setserial /dev/ttyS0 uart 16550A skip_test

uart.h

#ifndef _UART_H_
#define _UART_H_

#include <avr/io.h>

extern void uart_init();

static inline int
uart_putc (const uint8_t c)
{
    // Warten, bis UDR bereit ist für einen neuen Wert 
    while (!(UCSRA & (1 << UDRE)))
        ;

    // UDR Schreiben startet die Übertragung 
    UDR = c;

    return 1;
}

static inline int 
uart_puts(char *s){
  while(*s){
    uart_putc(*s);
  s++;
  }
}


static inline uint8_t
uart_getc_wait()
{
    // Warten, bis etwas empfangen wird 
    while (!(UCSRA & (1 << RXC)))
        ;

    // Das empfangene Zeichen zurückliefern 
    return UDR;
}

static inline int
uart_getc_nowait()
{
    // Liefer das empfangene Zeichen, falls etwas empfangen wurde; -1 sonst 
    return (UCSRA & (1 << RXC)) ? (int) UDR : -1;
}

#endif /* _UART_H_  */

uartgps.c

#define F_CPU 1000000 // Takt des MCU
#define BAUDRATE 4800UL //Definition als unsigned long, sonst gibt es Fehler

#include "uart.h"	// Include für serielle Schnittstelle UART
#include <avr/io.h>     // AVR Register und Konstantendefinitionen
#include <util/delay.h> // Delay Funktion
#include <string.h> 	// String Funktionen

void uart_init()
{
    uint16_t ubrr = (uint16_t) ((uint32_t) F_CPU/(16*BAUDRATE) - 1);

    UBRRH = (uint8_t) (ubrr>>8);
    UBRRL = (uint8_t) (ubrr);

    // UART Receiver und Transmitter anschalten 
    // Data mode 8N1, asynchron, no parity 
    UCSRB = (1 << RXEN) | (1 << TXEN);
    // UMSEL 0 = async UMSEL 1 = sync
    // UPM1/UPM0 = 00 Dis, 01 Res, 10 En Even Parity, 11 En Odd Parity
    // USBS Stop Bit 0 = 1 Bit, 1 = 2 Bit
    // UCSZ2/UCSZ1/UCSZ0 = 000 = 5 Bit 001 = 6 Bit 010 = 7 Bit 011 = 8 Bit
    UCSRC = (1 << URSEL) | (0 << UMSEL) | (0 <<UCSZ2) | (1 << UCSZ1) | (1 << UCSZ0) | (0 << UPM1) | (0 << UPM0) | (0 << USBS);

    // Flush Receive-Buffer (entfernen evtl. vorhandener ungültiger Werte) 
    do
    {
        UDR;
    }
    while (UCSRA & (1 << RXC));
}

void long_delay(uint16_t ms) {
       for(; ms>0; ms--) _delay_ms(1);
 }


main () 
{
	DDRA = 0xFF;
	uart_init();

	char rxzeichen;	
	int count = 0;

	while(1)
		{
			rxzeichen = uart_getc_wait();
			if (strcmp(rxzeichen,'$'))
			{
			    PORTA = (1 << PA0);
			    PORTA = (0 << PA0);
			}
		        uart_putc(rxzeichen);
		};
 }

GPS an serieller Schnittstelle ttyS0

stty -F /dev/ttyS0

stty -F /dev/ttyS0 4800

cat /dev/ttyS0 | hd

Navilock EM406a Protokollausschnitt

00000000  24 50 53 52 46 54 58 54  2c 56 65 72 73 69 6f 6e  |$PSRFTXT,Version|
00000010  3a 47 53 57 33 2e 32 2e  34 5f 33 2e 31 2e 30 30  |:GSW3.2.4_3.1.00|
00000020  2e 31 32 2d 53 44 4b 30  30 33 50 31 2e 30 30 61  |.12-SDK003P1.00a|
00000030  20 0a 0a 24 50 53 52 46  54 58 54 2c 56 65 72 73  | ..$PSRFTXT,Vers|
00000040  69 6f 6e 32 3a 46 2d 47  50 53 2d 30 33 2d 30 37  |ion2:F-GPS-03-07|
00000050  30 31 33 31 33 0a 0a 24  50 53 52 46 54 58 54 2c  |01313..$PSRFTXT,|
00000060  56 65 72 73 69 6f 6e 33  3a 4e 41 56 49 4c 4f 43  |Version3:NAVILOC|
00000070  4b 0a 0a 24 50 53 52 46  54 58 54 2c 57 41 41 53  |K..$PSRFTXT,WAAS|
00000080  20 44 69 73 61 62 6c 65  0a 0a 24 50 53 52 46 54  | Disable..$PSRFT|
00000090  58 54 2c 54 4f 57 3a 20  20 31 31 38 34 34 33 0a  |XT,TOW:  118443.|
000000a0  0a 24 50 53 52 46 54 58  54 2c 57 4b 3a 20 20 20  |.$PSRFTXT,WK:   |
000000b0  31 35 35 35 0a 0a 24 50  53 52 46 54 58 54 2c 50  |1555..$PSRFTXT,P|
000000c0  4f 53 3a 20 20 36 33 37  38 31 33 37 20 30 20 30  |OS:  6378137 0 0|
000000d0  0a 0a 24 50 53 52 46 54  58 54 2c 43 4c 4b 3a 20  |..$PSRFTXT,CLK: |
000000e0  20 39 36 32 35 30 0a 0a  24 50 53 52 46 54 58 54  | 96250..$PSRFTXT|
000000f0  2c 43 48 4e 4c 3a 20 31  32 0a 0a 24 50 53 52 46  |,CHNL: 12..$PSRF|
00000100  54 58 54 2c 42 61 75 64  20 72 61 74 65 3a 20 34  |TXT,Baud rate: 4|
00000110  38 30 30 20 0a 0a 24 47  50 47 47 41 2c 30 38 35  |800 ..$GPGGA,085|
00000120  33 35 30 2e 35 39 31 2c  2c 2c 2c 2c 30 2c 30 30  |350.591,,,,,0,00|
00000130  2c 2c 2c 4d 2c 30 2e 30  2c 4d 2c 2c 30 30 30 30  |,,,M,0.0,M,,0000|
00000140  2a 35 30 0a 0a 24 47 50  47 53 41 2c 41 2c 31 2c  |*50..$GPGSA,A,1,|
00000150  2c 2c 2c 2c 2c 2c 2c 2c  2c 2c 2c 2c 2c 2c 2a 31  |,,,,,,,,,,,,,,*1|
00000160  45 0a 0a 24 47 50 52 4d  43 2c 30 38 35 33 35 30  |E..$GPRMC,085350|
00000170  2e 35 39 31 2c 56 2c 2c  2c 2c 2c 2c 2c 32 36 31  |.591,V,,,,,,,261|
00000180  30 30 39 2c 2c 2a 32 35  0a 0a 24 47 50 56 54 47  |009,,*25..$GPVTG|
00000190  2c 2c 54 2c 2c 4d 2c 2c  4e 2c 2c 4b 2a 34 45 0a  |,,T,,M,,N,,K*4E.|
000001a0  0a 24 47 50 47 47 41 2c  30 38 35 33 35 31 2e 35  |.$GPGGA,085351.5|
000001b0  33 36 2c 2c 2c 2c 2c 30  2c 30 30 2c 2c 2c 4d 2c  |36,,,,,0,00,,,M,|
000001c0  30 2e 30 2c 4d 2c 2c 30  30 30 30 2a 35 43 0a 0a  |0.0,M,,0000*5C..|
000001d0  24 47 50 47 53 41 2c 41  2c 31 2c 2c 2c 2c 2c 2c  |$GPGSA,A,1,,,,,,|
000001e0  2c 2c 2c 2c 2c 2c 2c 2c  2c 2a 31 45 0a 0a 24 47  |,,,,,,,,,*1E..$G|
000001f0  50 52 4d 43 2c 30 38 35  33 35 31 2e 35 33 36 2c  |PRMC,085351.536,|
00000200  56 2c 2c 2c 2c 2c 2c 2c  32 36 31 30 30 39 2c 2c  |V,,,,,,,261009,,|
00000210  2a 32 39 0a 0a 24 47 50  56 54 47 2c 2c 54 2c 2c  |*29..$GPVTG,,T,,|
00000220  4d 2c 2c 4e 2c 2c 4b 2a  34 45 0a 0a 24 47 50 47  |M,,N,,K*4E..$GPG|
00000230  47 41 2c 30 38 35 33 35  32 2e 35 33 37 2c 2c 2c  |GA,085352.537,,,|
00000240  2c 2c 30 2c 30 30 2c 2c  2c 4d 2c 30 2e 30 2c 4d  |,,0,00,,,M,0.0,M|
00000250  2c 2c 30 30 30 30 2a 35  45 0a 0a 24 47 50 47 53  |,,0000*5E..$GPGS|
00000260  41 2c 41 2c 31 2c 2c 2c  2c 2c 2c 2c 2c 2c 2c 2c  |A,A,1,,,,,,,,,,,|
00000270  2c 2c 2c 2c 2a 31 45 0a  0a 24 47 50 52 4d 43 2c  |,,,,*1E..$GPRMC,|
00000280  30 38 35 33 35 32 2e 35  33 37 2c 56 2c 2c 2c 2c  |085352.537,V,,,,|
00000290  2c 2c 2c 32 36 31 30 30  39 2c 2c 2a 32 42 0a 0a  |,,,261009,,*2B..|
000002a0  24 47 50 56 54 47 2c 2c  54 2c 2c 4d 2c 2c 4e 2c  |$GPVTG,,T,,M,,N,|
000002b0  2c 4b 2a 34 45 0a 0a 24  47 50 47 47 41 2c 30 38  |,K*4E..$GPGGA,08|
000002c0  35 33 35 33 2e 35 33 39  2c 2c 2c 2c 2c 30 2c 30  |5353.539,,,,,0,0|
000002d0  30 2c 2c 2c 4d 2c 30 2e  30 2c 4d 2c 2c 30 30 30  |0,,,M,0.0,M,,000|
000002e0  30 2a 35 31 0a 0a 24 47  50 47 53 41 2c 41 2c 31  |0*51..$GPGSA,A,1|
000002f0  2c 2c 2c 2c 2c 2c 2c 2c  2c 2c 2c 2c 2c 2c 2c 2a  |,,,,,,,,,,,,,,,*|
00000300  31 45 0a 0a 24 47 50 52  4d 43 2c 30 38 35 33 35  |1E..$GPRMC,08535|
00000310  33 2e 35 33 39 2c 56 2c  2c 2c 2c 2c 2c 2c 32 36  |3.539,V,,,,,,,26|
00000320  31 30 30 39 2c 2c 2a 32  34 0a 0a 24 47 50 56 54  |1009,,*24..$GPVT|
00000330  47 2c 2c 54 2c 2c 4d 2c  2c 4e 2c 2c 4b 2a 34 45  |G,,T,,M,,N,,K*4E|
00000340  0a 0a 24 47 50 47 47 41  2c 30 38 35 33 35 34 2e  |..$GPGGA,085354.|
00000350  35 34 33 2c 2c 2c 2c 2c  30 2c 30 30 2c 2c 2c 4d  |543,,,,,0,00,,,M|
00000360  2c 30 2e 30 2c 4d 2c 2c  30 30 30 30 2a 35 42 0a  |,0.0,M,,0000*5B.|
00000370  0a 24 47 50 47 53 41 2c  41 2c 31 2c 2c 2c 2c 2c  |.$GPGSA,A,1,,,,,|
00000380  2c 2c 2c 2c 2c 2c 2c 2c  2c 2c 2a 31 45 0a 0a 24  |,,,,,,,,,,*1E..$|
00000390  47 50 47 53 56 2c 33 2c  31 2c 31 32 2c 32 30 2c  |GPGSV,3,1,12,20,|
000003a0  30 30 2c 30 30 30 2c 2c  31 30 2c 30 30 2c 30 30  |00,000,,10,00,00|
000003b0  30 2c 2c 33 31 2c 30 30  2c 30 30 30 2c 2c 32 37  |0,,31,00,000,,27|
000003c0  2c 30 30 2c 30 30 30 2c  2a 37 43 0a 0a 24 47 50  |,00,000,*7C..$GP|
000003d0  47 53 56 2c 33 2c 32 2c  31 32 2c 31 39 2c 30 30  |GSV,3,2,12,19,00|
000003e0  2c 30 30 30 2c 2c 30 37  2c 30 30 2c 30 30 30 2c  |,000,,07,00,000,|
000003f0  2c 30 34 2c 30 30 2c 30  30 30 2c 2c 32 34 2c 30  |,04,00,000,,24,0|
00000400  30 2c 30 30 30 2c 2a 37  36 0a 0a 24 47 50 47 53  |0,000,*76..$GPGS|
00000410  56 2c 33 2c 33 2c 31 32  2c 31 36 2c 30 30 2c 30  |V,3,3,12,16,00,0|
00000420  30 30 2c 2c 32 38 2c 30  30 2c 30 30 30 2c 2c 32  |00,,28,00,000,,2|
00000430  36 2c 30 30 2c 30 30 30  2c 2c 32 39 2c 30 30 2c  |6,00,000,,29,00,|
00000440  30 30 30 2c 2a 37 38 0a  0a 24 47 50 52 4d 43 2c  |000,*78..$GPRMC,|
00000450  30 38 35 33 35 34 2e 35  34 33 2c 56 2c 2c 2c 2c  |085354.543,V,,,,|
00000460  2c 2c 2c 32 36 31 30 30  39 2c 2c 2a 32 45 0a 0a  |,,,261009,,*2E..|
00000470  24 47 50 56 54 47 2c 2c  54 2c 2c 4d 2c 2c 4e 2c  |$GPVTG,,T,,M,,N,|
00000480  2c 4b 2a 34 45 0a 0a 24  47 50 47 47 41 2c 30 38  |,K*4E..$GPGGA,08|
00000490  35 33 35 35 2e 35 34 31  2c 2c 2c 2c 2c 30 2c 30  |5355.541,,,,,0,0|
000004a0  30 2c 2c 2c 4d 2c 30 2e  30 2c 4d 2c 2c 30 30 30  |0,,,M,0.0,M,,000|
000004b0  30 2a 35 38 0a 0a 24 47  50 47 53 41 2c 41 2c 31  |0*58..$GPGSA,A,1|
000004c0  2c 2c 2c 2c 2c 2c 2c 2c  2c 2c 2c 2c 2c 2c 2c 2a  |,,,,,,,,,,,,,,,*|
000004d0  31 45 0a 0a 24 47 50 52  4d 43 2c 30 38 35 33 35  |1E..$GPRMC,08535|
000004e0  35 2e 35 34 31 2c 56 2c  2c 2c 2c 2c 2c 2c 32 36  |5.541,V,,,,,,,26|
000004f0  31 30 30 39 2c 2c 2a 32  44 0a 0a 24 47 50 56 54  |1009,,*2D..$GPVT|
00000500  47 2c 2c 54 2c 2c 4d 2c  2c 4e 2c 2c 4b 2a 34 45  |G,,T,,M,,N,,K*4E|
00000510  0a 0a 24 47 50 47 47 41  2c 30 38 35 33 35 36 2e  |..$GPGGA,085356.|
00000520  35 33 37 2c 2c 2c 2c 2c  30 2c 30 30 2c 2c 2c 4d  |537,,,,,0,00,,,M|
00000530  2c 30 2e 30 2c 4d 2c 2c  30 30 30 30 2a 35 41 0a  |,0.0,M,,0000*5A.|
00000540  0a 24 47 50 47 53 41 2c  41 2c 31 2c 2c 2c 2c 2c  |.$GPGSA,A,1,,,,,|
00000550  2c 2c 2c 2c 2c 2c 2c 2c  2c 2c 2a 31 45 0a 0a 24  |,,,,,,,,,,*1E..$|
00000560  47 50 52 4d 43 2c 30 38  35 33 35 36 2e 35 33 37  |GPRMC,085356.537|
00000570  2c 56 2c 2c 2c 2c 2c 2c  2c 32 36 31 30 30 39 2c  |,V,,,,,,,261009,|
00000580  2c 2a 32 46 0a 0a 24 47  50 56 54 47 2c 2c 54 2c  |,*2F..$GPVTG,,T,|
00000590  2c 4d 2c 2c 4e 2c 2c 4b  2a 34 45 0a 0a 24 47 50  |,M,,N,,K*4E..$GP|
000005a0  47 47 41 2c 30 38 35 33  35 37 2e 35 34 33 2c 2c  |GGA,085357.543,,|
000005b0  2c 2c 2c 30 2c 30 30 2c  2c 2c 4d 2c 30 2e 30 2c  |,,,0,00,,,M,0.0,|
000005c0  4d 2c 2c 30 30 30 30 2a  35 38 0a 0a 24 47 50 47  |M,,0000*58..$GPG|
000005d0  53 41 2c 41 2c 31 2c 2c  2c 2c 2c 2c 2c 2c 2c 2c  |SA,A,1,,,,,,,,,,|
000005e0  2c 2c 2c 2c 2c 2a 31 45  0a 0a 24 47 50 52 4d 43  |,,,,,*1E..$GPRMC|
000005f0  2c 30 38 35 33 35 37 2e  35 34 33 2c 56 2c 2c 2c  |,085357.543,V,,,|
00000600  2c 2c 2c 2c 32 36 31 30  30 39 2c 2c 2a 32 44 0a  |,,,,261009,,*2D.|
00000610  0a 24 47 50 56 54 47 2c  2c 54 2c 2c 4d 2c 2c 4e  |.$GPVTG,,T,,M,,N|
00000620  2c 2c 4b 2a 34 45 0a 0a  24 47 50 47 47 41 2c 30  |,,K*4E..$GPGGA,0|
00000630  38 35 33 35 38 2e 35 33  37 2c 2c 2c 2c 2c 30 2c  |85358.537,,,,,0,|
00000640  30 30 2c 2c 2c 4d 2c 30  2e 30 2c 4d 2c 2c 30 30  |00,,,M,0.0,M,,00|
00000650  30 30 2a 35 34 0a 0a 24  47 50 47 53 41 2c 41 2c  |00*54..$GPGSA,A,|
00000660  31 2c 2c 2c 2c 2c 2c 2c  2c 2c 2c 2c 2c 2c 2c 2c  |1,,,,,,,,,,,,,,,|
00000670  2a 31 45 0a 0a 24 47 50  52 4d 43 2c 30 38 35 33  |*1E..$GPRMC,0853|
00000680  35 38 2e 35 33 37 2c 56  2c 2c 2c 2c 2c 2c 2c 32  |58.537,V,,,,,,,2|
00000690  36 31 30 30 39 2c 2c 2a  32 31 0a 0a 24 47 50 56  |61009,,*21..$GPV|
000006a0  54 47 2c 2c 54 2c 2c 4d  2c 2c 4e 2c 2c 4b 2a 34  |TG,,T,,M,,N,,K*4|
000006b0  45 0a 0a 24 47 50 47 47  41 2c 30 38 35 33 35 39  |E..$GPGGA,085359|
000006c0  2e 35 33 37 2c 2c 2c 2c  2c 30 2c 30 30 2c 2c 2c  |.537,,,,,0,00,,,|
000006d0  4d 2c 30 2e 30 2c 4d 2c  2c 30 30 30 30 2a 35 35  |M,0.0,M,,0000*55|
000006e0  0a 0a 24 47 50 47 53 41  2c 41 2c 31 2c 2c 2c 2c  |..$GPGSA,A,1,,,,|

LCD Routine

#include <avr/io.h>
#define TAKT 1000000ul
#define LCDPEN PORTD
#define LCDEN PD3
#define LCDPRS PORTD
#define LCDRS PD2
#define LCDPDAT PORTD
#define LCDBUS 'h'

unsigned char curpos = 0;
unsigned char i = 0;
unsigned int count = 0;
unsigned int j = 0;

void wartexms(unsigned int faktor)
{
	for (j = 0; j < faktor; j++)
	{
		for(count = TAKT/4000ul; count > 0; count--);
	}
}

void lcd4com(unsigned char x)
{
	#if LCDBUS == 'l'
	x = (x << 4) | (x >> 4);
	#endif
	LCDPDAT = x;
	LCDPRS &= ~(1 << LCDRS);
	LCDPEN |= (1 << LCDEN);
	wartexms(5);
	LCDPEN &= ~(1 << LCDEN);
	x = (x << 4) | (x >> 4);
	LCDPDAT = x;
	LCDPRS &= ~(1 << LCDRS);
	LCDPEN |= (1 << LCDEN);
	wartexms(5);
	LCDPEN &= ~(1 << LCDEN);
	LCDPDAT = 0;
	wartexms(10);
}

void lcd4put(unsigned char x)
{
	#if LCDBUS == 'l'
	x = (x << 4) | (x >> 4);
	#endif
	LCDPDAT = x;
	LCDPRS |= (1 << LCDRS);
	LCDPEN |= (1 << LCDEN);
	wartexms(5);
	LCDPEN &= ~(1 << LCDEN);
	x = (x << 4) | (x >> 4);
	LCDPDAT = x;
	LCDPRS |= (1 << LCDRS);
        LCDPEN |= (1 << LCDEN);
	wartexms(5);
	LCDPEN &= ~(1 << LCDEN);
	LCDPDAT = 0;
	wartexms(5);
}

void lcd4ini(void)
{
	wartexms(500);
	lcd4com(0x33);
	lcd4com(0x32);
	lcd4com(0x28);
	lcd4com(0x0e);
	lcd4com(0x06);
	lcd4com(0x02);
	lcd4com(0x01);
}

void lcd4cur(void)
{
	curpos++;
	if (curpos == 0x10) {curpos = 0x40; lcd4com(0x80 | 0x40); }
	if (curpos == 0x50) {curpos = 0x10; lcd4com(0x80 | 0x10); }
	if (curpos == 0x20) {curpos = 0x50; lcd4com(0x80 | 0x50); }
	if (curpos == 0x60) {curpos = 0x00; lcd4com(0x80 | 0x00); }
}

void lcd4puts(unsigned char *zeiger)
{
	while(*zeiger != 0) {lcd4put(*zeiger++); lcd4cur();}
}

int main(void)
{
	unsigned char meldung [] = "Willkommen";
	DDRD = 0xff;
	LCDPEN &= ~(1 << LCDEN);
	DDRD |= (1 << LCDEN);
	lcd4ini();
	lcd4puts(meldung);
	while(1)
	{
	}
	return 0;
}

Sinuswerte

126, 129, 132, 135, 138, 141, 144, 148        //Anfang der positiven Halbwelle
151, 154, 157, 160, 163, 166, 168, 171
174, 177, 180, 183, 185, 188, 191, 193
196, 199, 201, 204, 206, 208, 211, 213
215, 217, 219, 221, 223, 225, 227, 229
231, 232, 234, 236, 237, 239, 240, 241
242, 244, 245, 246, 247, 247, 248, 249
250, 250, 251, 251, 251, 252, 252, 252
252, 252, 252, 252, 251, 251, 251, 250
250, 249, 248, 247, 247, 246, 245, 244
242, 241, 240, 239, 237, 236, 234, 232
231, 229, 227, 225, 223, 221, 219, 217
215, 213, 211, 208, 206, 204, 201, 199
196, 193, 191, 188, 185, 183, 180, 177
174, 171, 168, 166, 163, 160, 157, 154
151, 148, 144, 141, 138, 135, 132, 129        //Ende der positiven Halbwelle
126, 123, 120, 117, 114, 111, 108, 104        //Anfang der negativen Halbwelle
101,  98,  95,  92,  89,  86,  84,  81
78,  75,  72,  69,  67,  64,  61,  59
56,  53,  51,  48,  46,  44,  41,  39
37,  35,  33,  31,  29,  27,  25,  23
21,  20,  18,  16,  15,  13,  12,  11
10,   8,   7,   6,   5,   5,   4,   3
2,   2,   1,   1,   1,   0,   0,   0
0,   0,   0,   0,   1,   1,   1,   2
2,   3,   4,   5,   5,   6,   7,   8
10,  11,  12,  13,  15,  16,  18,  20
21,  23,  25,  27,  29,  31,  33,  35
37,  39,  41,  44,  46,  48,  51,  53
56,  59,  61,  64,  67,  69,  72,  75
78,  81,  84,  86,  89,  92,  95,  98
101, 104, 108, 111, 114, 117, 120, 123       //Ende der negativen Halbwelle

Funktionsgenerator mit Atmega32u2 Sinus / Dreieck

//----------------------------------------------------------------------
// Titel     : Funktionsgenerator AVR Minimus -- Atmega32u2@16MHz
//----------------------------------------------------------------------
// Funktion  : Schaltet Portpins PD0-PD7 als DAC 8Bit
// Schaltung : R2R Netzwerk an PD0-PD7
//----------------------------------------------------------------------
// Prozessor : ATmega32u2
// Takt      : 16.0 MHz
// Sprache   : C
//----------------------------------------------------------------------
#define  F_CPU 16000000  // Taktfrequenz des myAVR-Boards
#include <avr/io.h>     // AVR Register und Konstantendefinitionen
#include <util/delay.h> // Delay Funktion
#include <avr/pgmspace.h> // Program Space
//----------------------------------------------------------------------

static const int8_t sawtoothtable[]  PROGMEM = 
{
0,127,64,191,32,159,96,223,16,143,80,207,48,175,112,239,8,135,72,199,40,167,104,231,24,151,88,215,56,183,120,247,4,131,68,
195,36,163,100,227,20,147,84,211,52,179,116,243,12,139,76,203,44,171,108,235,28,155,92,219,60,187,124,251,2,129,66,193,34,
161,98,225,18,145,82,209,50,177,114,241,10,137,74,201,42,169,106,233,26,153,90,217,58,185,122,249,6,133,70,197,38,165,102,
229,22,149,86,213,54,181,118,245,14,141,78,205,46,173,110,237,30,157,94,221,62,189,126,253,1,128,65,192,33,160,97,224,17,
144,81,208,49,176,113,240,9,136,73,200,41,168,105,232,25,152,89,216,57,184,121,248,5,132,69,196,37,164,101,228,21,148,
85,212,53,180,117,244,13,140,77,204,45,172,109,236,29,156,93,220,61,188,125,252,3,130,67,194,35,162,99,226,19,146,83,
210,51,178,115,242,11,138,75,202,43,170,107,234,27,154,91,218,59,186,123,250,7,134,71,198,39,166,103,230,23,150,87,214,
55,182,119,246,15,142,79,206,47,174,111,238,31,158,95,222,63,190,127,254
};

void long_delay(uint16_t ms) {
       for(; ms>0; ms--) _delay_ms(1);
 }

main ()
 {
    int8_t count;

    DDRD |= (1<<PD0);           // als Ausgang
    DDRD |= (1<<PD1);           // als Ausgang
    DDRD |= (1<<PD2);           // als Ausgang
    DDRD |= (1<<PD3);           // als Ausgang
    DDRD |= (1<<PD4);           // als Ausgang
    DDRD |= (1<<PD5);           // als Ausgang
    DDRD |= (1<<PD6);           // als Ausgang
    DDRD |= (1<<PD7);           // als Ausgang

    do
    {
	 for(count = 0; count < 255;count++)
	{
		PORTD = pgm_read_word(&sawtoothtable[count]); 
	};
     } while (1);     // Mainloop
 }
//----------------------------------------------------------------------
Teilspannungen R2R Netzwerk			T. Lorenz	23.10.2013							

Auflösung	8	Bit									
V Referenz	5	Volt									

Bit 0	0,01953125	V									
Bit 1	0,0390625	V									
Bit 2	0,078125	V									
Bit 3	0,15625	V									
Bit 4	0,3125	V									
Bit 5	0,625	V									
Bit 6	1,25	V									
Bit 7	2,5	V									


Wert-Nr.	Bit 0	Bit 1	Bit 2	Bit 3	Bit 4	Bit 5	Bit 6	Bit 7	Dezimal	Spannungswert	Einheit
0	0	0	0	0	0	0	0	0	0	0,000	V
1	1	0	0	0	0	0	0	0	1	0,020	V
2	0	1	0	0	0	0	0	0	2	0,039	V
3	1	1	0	0	0	0	0	0	3	0,059	V
4	0	0	1	0	0	0	0	0	4	0,078	V
5	1	0	1	0	0	0	0	0	5	0,098	V
6	0	1	1	0	0	0	0	0	6	0,117	V
7	1	1	1	0	0	0	0	0	7	0,137	V
8	0	0	0	1	0	0	0	0	8	0,156	V
9	1	0	0	1	0	0	0	0	9	0,176	V
10	0	1	0	1	0	0	0	0	10	0,195	V
11	1	1	0	1	0	0	0	0	11	0,215	V
12	0	0	1	1	0	0	0	0	12	0,234	V
13	1	0	1	1	0	0	0	0	13	0,254	V
14	0	1	1	1	0	0	0	0	14	0,273	V
15	1	1	1	1	0	0	0	0	15	0,293	V
16	0	0	0	0	1	0	0	0	16	0,313	V
17	1	0	0	0	1	0	0	0	17	0,332	V
18	0	1	0	0	1	0	0	0	18	0,352	V
19	1	1	0	0	1	0	0	0	19	0,371	V
20	0	0	1	0	1	0	0	0	20	0,391	V
21	1	0	1	0	1	0	0	0	21	0,410	V
22	0	1	1	0	1	0	0	0	22	0,430	V
23	1	1	1	0	1	0	0	0	23	0,449	V
24	0	0	0	1	1	0	0	0	24	0,469	V
25	1	0	0	1	1	0	0	0	25	0,488	V
26	0	1	0	1	1	0	0	0	26	0,508	V
27	1	1	0	1	1	0	0	0	27	0,527	V
28	0	0	1	1	1	0	0	0	28	0,547	V
29	1	0	1	1	1	0	0	0	29	0,566	V
30	0	1	1	1	1	0	0	0	30	0,586	V
31	1	1	1	1	1	0	0	0	31	0,605	V
32	0	0	0	0	0	1	0	0	32	0,625	V
33	1	0	0	0	0	1	0	0	33	0,645	V
34	0	1	0	0	0	1	0	0	34	0,664	V
35	1	1	0	0	0	1	0	0	35	0,684	V
36	0	0	1	0	0	1	0	0	36	0,703	V
37	1	0	1	0	0	1	0	0	37	0,723	V
38	0	1	1	0	0	1	0	0	38	0,742	V
39	1	1	1	0	0	1	0	0	39	0,762	V
40	0	0	0	1	0	1	0	0	40	0,781	V
41	1	0	0	1	0	1	0	0	41	0,801	V
42	0	1	0	1	0	1	0	0	42	0,820	V
43	1	1	0	1	0	1	0	0	43	0,840	V
44	0	0	1	1	0	1	0	0	44	0,859	V
45	1	0	1	1	0	1	0	0	45	0,879	V
46	0	1	1	1	0	1	0	0	46	0,898	V
47	1	1	1	1	0	1	0	0	47	0,918	V
48	0	0	0	0	1	1	0	0	48	0,938	V
49	1	0	0	0	1	1	0	0	49	0,957	V
50	0	1	0	0	1	1	0	0	50	0,977	V
51	1	1	0	0	1	1	0	0	51	0,996	V
52	0	0	1	0	1	1	0	0	52	1,016	V
53	1	0	1	0	1	1	0	0	53	1,035	V
54	0	1	1	0	1	1	0	0	54	1,055	V
55	1	1	1	0	1	1	0	0	55	1,074	V
56	0	0	0	1	1	1	0	0	56	1,094	V
57	1	0	0	1	1	1	0	0	57	1,113	V
58	0	1	0	1	1	1	0	0	58	1,133	V
59	1	1	0	1	1	1	0	0	59	1,152	V
60	0	0	1	1	1	1	0	0	60	1,172	V
61	1	0	1	1	1	1	0	0	61	1,191	V
62	0	1	1	1	1	1	0	0	62	1,211	V
63	1	1	1	1	1	1	0	0	63	1,230	V
64	0	0	0	0	0	0	1	0	64	1,250	V
65	1	0	0	0	0	0	1	0	65	1,270	V
66	0	1	0	0	0	0	1	0	66	1,289	V
67	1	1	0	0	0	0	1	0	67	1,309	V
68	0	0	1	0	0	0	1	0	68	1,328	V
69	1	0	1	0	0	0	1	0	69	1,348	V
70	0	1	1	0	0	0	1	0	70	1,367	V
71	1	1	1	0	0	0	1	0	71	1,387	V
72	0	0	0	1	0	0	1	0	72	1,406	V
73	1	0	0	1	0	0	1	0	73	1,426	V
74	0	1	0	1	0	0	1	0	74	1,445	V
75	1	1	0	1	0	0	1	0	75	1,465	V
76	0	0	1	1	0	0	1	0	76	1,484	V
77	1	0	1	1	0	0	1	0	77	1,504	V
78	0	1	1	1	0	0	1	0	78	1,523	V
79	1	1	1	1	0	0	1	0	79	1,543	V
80	0	0	0	0	1	0	1	0	80	1,563	V
81	1	0	0	0	1	0	1	0	81	1,582	V
82	0	1	0	0	1	0	1	0	82	1,602	V
83	1	1	0	0	1	0	1	0	83	1,621	V
84	0	0	1	0	1	0	1	0	84	1,641	V
85	1	0	1	0	1	0	1	0	85	1,660	V
86	0	1	1	0	1	0	1	0	86	1,680	V
87	1	1	1	0	1	0	1	0	87	1,699	V
88	0	0	0	1	1	0	1	0	88	1,719	V
89	1	0	0	1	1	0	1	0	89	1,738	V
90	0	1	0	1	1	0	1	0	90	1,758	V
91	1	1	0	1	1	0	1	0	91	1,777	V
92	0	0	1	1	1	0	1	0	92	1,797	V
93	1	0	1	1	1	0	1	0	93	1,816	V
94	0	1	1	1	1	0	1	0	94	1,836	V
95	1	1	1	1	1	0	1	0	95	1,855	V
96	0	0	0	0	0	1	1	0	96	1,875	V
97	1	0	0	0	0	1	1	0	97	1,895	V
98	0	1	0	0	0	1	1	0	98	1,914	V
99	1	1	0	0	0	1	1	0	99	1,934	V
100	0	0	1	0	0	1	1	0	100	1,953	V
101	1	0	1	0	0	1	1	0	101	1,973	V
102	0	1	1	0	0	1	1	0	102	1,992	V
103	1	1	1	0	0	1	1	0	103	2,012	V
104	0	0	0	1	0	1	1	0	104	2,031	V
105	1	0	0	1	0	1	1	0	105	2,051	V
106	0	1	0	1	0	1	1	0	106	2,070	V
107	1	1	0	1	0	1	1	0	107	2,090	V
108	0	0	1	1	0	1	1	0	108	2,109	V
109	1	0	1	1	0	1	1	0	109	2,129	V
110	0	1	1	1	0	1	1	0	110	2,148	V
111	1	1	1	1	0	1	1	0	111	2,168	V
112	0	0	0	0	1	1	1	0	112	2,188	V
113	1	0	0	0	1	1	1	0	113	2,207	V
114	0	1	0	0	1	1	1	0	114	2,227	V
115	1	1	0	0	1	1	1	0	115	2,246	V
116	0	0	1	0	1	1	1	0	116	2,266	V
117	1	0	1	0	1	1	1	0	117	2,285	V
118	0	1	1	0	1	1	1	0	118	2,305	V
119	1	1	1	0	1	1	1	0	119	2,324	V
120	0	0	0	1	1	1	1	0	120	2,344	V
121	1	0	0	1	1	1	1	0	121	2,363	V
122	0	1	0	1	1	1	1	0	122	2,383	V
123	1	1	0	1	1	1	1	0	123	2,402	V
124	0	0	1	1	1	1	1	0	124	2,422	V
125	1	0	1	1	1	1	1	0	125	2,441	V
126	0	1	1	1	1	1	1	0	126	2,461	V
127	1	1	1	1	1	1	1	0	127	2,480	V
128	0	0	0	0	0	0	0	1	128	2,500	V
129	1	0	0	0	0	0	0	1	129	2,520	V
130	0	1	0	0	0	0	0	1	130	2,539	V
131	1	1	0	0	0	0	0	1	131	2,559	V
132	0	0	1	0	0	0	0	1	132	2,578	V
133	1	0	1	0	0	0	0	1	133	2,598	V
134	0	1	1	0	0	0	0	1	134	2,617	V
135	1	1	1	0	0	0	0	1	135	2,637	V
136	0	0	0	1	0	0	0	1	136	2,656	V
137	1	0	0	1	0	0	0	1	137	2,676	V
138	0	1	0	1	0	0	0	1	138	2,695	V
139	1	1	0	1	0	0	0	1	139	2,715	V
140	0	0	1	1	0	0	0	1	140	2,734	V
141	1	0	1	1	0	0	0	1	141	2,754	V
142	0	1	1	1	0	0	0	1	142	2,773	V
143	1	1	1	1	0	0	0	1	143	2,793	V
144	0	0	0	0	1	0	0	1	144	2,813	V
145	1	0	0	0	1	0	0	1	145	2,832	V
146	0	1	0	0	1	0	0	1	146	2,852	V
147	1	1	0	0	1	0	0	1	147	2,871	V
148	0	0	1	0	1	0	0	1	148	2,891	V
149	1	0	1	0	1	0	0	1	149	2,910	V
150	0	1	1	0	1	0	0	1	150	2,930	V
151	1	1	1	0	1	0	0	1	151	2,949	V
152	0	0	0	1	1	0	0	1	152	2,969	V
153	1	0	0	1	1	0	0	1	153	2,988	V
154	0	1	0	1	1	0	0	1	154	3,008	V
155	1	1	0	1	1	0	0	1	155	3,027	V
156	0	0	1	1	1	0	0	1	156	3,047	V
157	1	0	1	1	1	0	0	1	157	3,066	V
158	0	1	1	1	1	0	0	1	158	3,086	V
159	1	1	1	1	1	0	0	1	159	3,105	V
160	0	0	0	0	0	1	0	1	160	3,125	V
161	1	0	0	0	0	1	0	1	161	3,145	V
162	0	1	0	0	0	1	0	1	162	3,164	V
163	1	1	0	0	0	1	0	1	163	3,184	V
164	0	0	1	0	0	1	0	1	164	3,203	V
165	1	0	1	0	0	1	0	1	165	3,223	V
166	0	1	1	0	0	1	0	1	166	3,242	V
167	1	1	1	0	0	1	0	1	167	3,262	V
168	0	0	0	1	0	1	0	1	168	3,281	V
169	1	0	0	1	0	1	0	1	169	3,301	V
170	0	1	0	1	0	1	0	1	170	3,320	V
171	1	1	0	1	0	1	0	1	171	3,340	V
172	0	0	1	1	0	1	0	1	172	3,359	V
173	1	0	1	1	0	1	0	1	173	3,379	V
174	0	1	1	1	0	1	0	1	174	3,398	V
175	1	1	1	1	0	1	0	1	175	3,418	V
176	0	0	0	0	1	1	0	1	176	3,438	V
177	1	0	0	0	1	1	0	1	177	3,457	V
178	0	1	0	0	1	1	0	1	178	3,477	V
179	1	1	0	0	1	1	0	1	179	3,496	V
180	0	0	1	0	1	1	0	1	180	3,516	V
181	1	0	1	0	1	1	0	1	181	3,535	V
182	0	1	1	0	1	1	0	1	182	3,555	V
183	1	1	1	0	1	1	0	1	183	3,574	V
184	0	0	0	1	1	1	0	1	184	3,594	V
185	1	0	0	1	1	1	0	1	185	3,613	V
186	0	1	0	1	1	1	0	1	186	3,633	V
187	1	1	0	1	1	1	0	1	187	3,652	V
188	0	0	1	1	1	1	0	1	188	3,672	V
189	1	0	1	1	1	1	0	1	189	3,691	V
190	0	1	1	1	1	1	0	1	190	3,711	V
191	1	1	1	1	1	1	0	1	191	3,730	V
192	0	0	0	0	0	0	1	1	192	3,750	V
193	1	0	0	0	0	0	1	1	193	3,770	V
194	0	1	0	0	0	0	1	1	194	3,789	V
195	1	1	0	0	0	0	1	1	195	3,809	V
196	0	0	1	0	0	0	1	1	196	3,828	V
197	1	0	1	0	0	0	1	1	197	3,848	V
198	0	1	1	0	0	0	1	1	198	3,867	V
199	1	1	1	0	0	0	1	1	199	3,887	V
200	0	0	0	1	0	0	1	1	200	3,906	V
201	1	0	0	1	0	0	1	1	201	3,926	V
202	0	1	0	1	0	0	1	1	202	3,945	V
203	1	1	0	1	0	0	1	1	203	3,965	V
204	0	0	1	1	0	0	1	1	204	3,984	V
205	1	0	1	1	0	0	1	1	205	4,004	V
206	0	1	1	1	0	0	1	1	206	4,023	V
207	1	1	1	1	0	0	1	1	207	4,043	V
208	0	0	0	0	1	0	1	1	208	4,063	V
209	1	0	0	0	1	0	1	1	209	4,082	V
210	0	1	0	0	1	0	1	1	210	4,102	V
211	1	1	0	0	1	0	1	1	211	4,121	V
212	0	0	1	0	1	0	1	1	212	4,141	V
213	1	0	1	0	1	0	1	1	213	4,160	V
214	0	1	1	0	1	0	1	1	214	4,180	V
215	1	1	1	0	1	0	1	1	215	4,199	V
216	0	0	0	1	1	0	1	1	216	4,219	V
217	1	0	0	1	1	0	1	1	217	4,238	V
218	0	1	0	1	1	0	1	1	218	4,258	V
219	1	1	0	1	1	0	1	1	219	4,277	V
220	0	0	1	1	1	0	1	1	220	4,297	V
221	1	0	1	1	1	0	1	1	221	4,316	V
222	0	1	1	1	1	0	1	1	222	4,336	V
223	1	1	1	1	1	0	1	1	223	4,355	V
224	0	0	0	0	0	1	1	1	224	4,375	V
225	1	0	0	0	0	1	1	1	225	4,395	V
226	0	1	0	0	0	1	1	1	226	4,414	V
227	1	1	0	0	0	1	1	1	227	4,434	V
228	0	0	1	0	0	1	1	1	228	4,453	V
229	1	0	1	0	0	1	1	1	229	4,473	V
230	0	1	1	0	0	1	1	1	230	4,492	V
231	1	1	1	0	0	1	1	1	231	4,512	V
232	0	0	0	1	0	1	1	1	232	4,531	V
233	1	0	0	1	0	1	1	1	233	4,551	V
234	0	1	0	1	0	1	1	1	234	4,570	V
235	1	1	0	1	0	1	1	1	235	4,590	V
236	0	0	1	1	0	1	1	1	236	4,609	V
237	1	0	1	1	0	1	1	1	237	4,629	V
238	0	1	1	1	0	1	1	1	238	4,648	V
239	1	1	1	1	0	1	1	1	239	4,668	V
240	0	0	0	0	1	1	1	1	240	4,688	V
241	1	0	0	0	1	1	1	1	241	4,707	V
242	0	1	0	0	1	1	1	1	242	4,727	V
243	1	1	0	0	1	1	1	1	243	4,746	V
244	0	0	1	0	1	1	1	1	244	4,766	V
245	1	0	1	0	1	1	1	1	245	4,785	V
246	0	1	1	0	1	1	1	1	246	4,805	V
247	1	1	1	0	1	1	1	1	247	4,824	V
248	0	0	0	1	1	1	1	1	248	4,844	V
249	1	0	0	1	1	1	1	1	249	4,863	V
250	0	1	0	1	1	1	1	1	250	4,883	V
251	1	1	0	1	1	1	1	1	251	4,902	V
252	0	0	1	1	1	1	1	1	252	4,922	V
253	1	0	1	1	1	1	1	1	253	4,941	V
254	0	1	1	1	1	1	1	1	254	4,961	V
255	1	1	1	1	1	1	1	1	255	4,980	V