Pomos s přeložením programu

Dobrý den, Pomohl by mi prosím někdo s přeložením programu pro attiny 85? [code]
// Based on Lightstrip Controller
// by Adam Greig, 2008-06-04
// CC BY-SA-NC 3.0

#define F_CPU 8000000UL // 8MHz
#include <util/delay.h>
#include <avr/interrupt.h>
#include <avr/io.h>

// The LED circuit is connected to PB4 on the ATTiny85
#define LEDS 4

// Some helper MACROS
#define SET |=
#define CLR &=~
#define TOG ^=

//Converge - how fast the average will converge to the current value. Default: 10
#define CONVERGE 10

//Peak - what multiple of the average will be considered a peak. Default: 1.3
#define PEAK 1.3

//Store duty cycle, background average, current result, difference between result and average.
volatile unsigned char duty;
volatile unsigned char avg;
volatile unsigned char result;
volatile signed char diff;

int main(void)
{
// set LEDS pin to output
DDRB SET (1 << LEDS);
PORTB = 0x00;

// flash the LEDs twice to signify we’re on
PORTB SET (1 << LEDS);
_delay_ms(1000);
PORTB CLR (1 << LEDS);
_delay_ms(1000);
PORTB SET (1 << LEDS);
_delay_ms(1000);
PORTB CLR (1 << LEDS);

//Initialise registers. Note that the compiler optimises each to an integer, so the 0s just make life easier.
ADMUX = (0<<REFS0) | (1<<ADLAR) | (1<<MUX1) | (1<<MUX0);
ADCSRA = (1<<ADEN) | (0<<ADSC) | (0<<ADATE) | (0<<ADIF) | (0<<ADIE) | (1<<ADPS2) | (1<<ADPS1) | (0<<ADPS0);
DIDR0 = (0<<ADC0D) | (0<<ADC1D) | (0<<ADC2D ) | (1<<ADC3D);

//Initialise ADC, ignore first result
ADCSRA SET (1<<ADSC);
while( ADCSRA & (1<<ADSC) ) {}

// reset the ADC
ADCSRA SET (1<<ADIE);
ADCSRA SET (1<<ADSC);
sei();

// infinite loop – all the work is done in the ADC interrupt routine
while (1) {}

return 1;
}

// interrupt routine for when the ADC gets a result
ISR(ADC_vect)
{
result = ADCH;

//Find the difference and converge the average
diff = result - avg;
avg += diff / CONVERGE;

// Determine if it’s a peak,
// and if so turn the LEDs
if( result > avg * PEAK )
{
duty = (100*result)/avg;
}
else
{
duty = 0;
}

//Execute the duty cycle
if (duty != 0 )
{
PORTB SET (1 << LEDS);
}

for( int j=0; j<duty; j++ )
{
asm( “nop\n\t” “nop\n\t” “nop\n\t” :: );
}

PORTB CLR (1 << LEDS);
for( int j=100; j>duty; j-- )
{
asm( “nop\n\t” “nop\n\t” “nop\n\t” :: );
}

// and set it off again
ADCSRA SET (1<<ADSC);
}
[/code]

jde o program z stránek: howardsandford.com/blog/flashing … lytocom=7#

Předem moc děkuji

:arrow_right: administrator: přesunuto z "AVR"

:question: :question: :question:
co si máme představit pod pojmem “přeložit” ? to jako do češtiny, nebo slovenčiny?
Jinak do hex. souboru ti to nejlépe přeloží Avr studio + Winavr. :slight_smile: