potrzebuję zrobić generator na Timer 1 w ATmega 8 1kHz prostokąt.
Proszę o sprawdzenie kodu czy może to działać .
Siedzę nad pdf atmegi ,przeglądam konfigurację i opisy i nie bardzo rozumiem.
Taktowanie wewnętrzne 1Mhz /preskaler =8/ 125 = powinno wyjść 1kHz
,pożniej jeszcze modyfikacja aby można było przełaczyc na 500 i 250 Hz.
I jeszcze jedno:
wykonuję ćwiczenia z książki P.Mirka Kardasia , ale przy kompilacji wywala zawsze takie błędy w konsoli,nawet jak wytnę i wkleję gotowca do programu:
15:44:27 **** Incremental Build of configuration Release for project Tester Wtryskiwaczy ****
make all
'Building file: ../main.c'
'Invoking: AVR Compiler'
avr-gcc -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega8 -DF_CPU=1000UL -MMD -MP -MF"main.d" -MT"main.o" -c -o "main.o" "../main.c"
../main.c:16:2: error: expected identifier or '(' before 'volatile'
../main.c:16:2: error: expected ')' before '(' token
../main.c:18:2: error: expected identifier or '(' before 'volatile'
../main.c:18:2: error: expected ')' before '(' token
../main.c:19:2: error: expected identifier or '(' before 'volatile'
../main.c:19:2: error: expected ')' before '(' token
../main.c:20:2: error: expected identifier or '(' before 'volatile'
../main.c:20:2: error: expected ')' before '(' token
../main.c:21:2: error: expected identifier or '(' before 'volatile'
../main.c:21:2: error: expected ')' before '(' token
../main.c:22:2: error: expected identifier or '(' before 'volatile'
../main.c:22:2: error: expected ')' before '(' token
../main.c: In function 'main':
../main.c:28:9: error: expected declaration specifiers or '...' before '*' token
make: *** [main.o] Error 1