Det är tänkt att få en PWM signal ut med 50% .
Kod: Markera allt
#include <avr/io.h>
int main(void){
#define PULSE_WIDTH 0x7F
void pwm_start(){
OCR1AL = PULSE_WIDTH;
OCR1AH = 0;
DDRD |= (1<<5);
TCCR1A = 0x81;
TCCR1B = 1;
}
return 1;
}
Kod: Markera allt
AVRASM: AVR macro assembler 2.1.42 (build 1796 Sep 15 2009 10:48:36)
Copyright (C) 1995-2009 ATMEL Corporation
C:\Users\Slim\Documents\8535\8535.asm(1): Including file 'C:\WinAVR-20100110\avr\include\avr/io.h'
C:\WinAVR-20100110\avr\include\avr/io.h(99): Including file 'C:\WinAVR-20100110\avr\include\avr/sfr_defs.h'
C:\WinAVR-20100110\avr\include\avr/sfr_defs.h(126): Including file 'C:\WinAVR-20100110\avr\include\inttypes.h'
C:\WinAVR-20100110\avr\include\inttypes.h(37): Including file 'C:\WinAVR-20100110\avr\include\stdint.h'
C:\WinAVR-20100110\avr\include\stdint.h(121): error: typedef: Unknown instruction or macro
C:\WinAVR-20100110\avr\include\inttypes.h(37): info: 'C:\WinAVR-20100110\avr\include\stdint.h' included from here
C:\WinAVR-20100110\avr\include\avr/sfr_defs.h(126): info: 'C:\WinAVR-20100110\avr\include\inttypes.h' included from here
C:\WinAVR-20100110\avr\include\avr/io.h(99): info: 'C:\WinAVR-20100110\avr\include\avr/sfr_defs.h' included from here
C:\Users\Slim\Documents\8535\8535.asm(1): info: 'C:\WinAVR-20100110\avr\include\avr/io.h' included from here
C:\WinAVR-20100110\avr\include\stdint.h(121): error: syntax error, unexpected FUNCTION
C:\WinAVR-20100110\avr\include\inttypes.h(37): info: 'C:\WinAVR-20100110\avr\include\stdint.h' included from here
C:\WinAVR-20100110\avr\include\avr/sfr_defs.h(126): info: 'C:\WinAVR-20100110\avr\include\inttypes.h' included from here
C:\WinAVR-20100110\avr\include\avr/io.h(99): info: 'C:\WinAVR-20100110\avr\include\avr/sfr_defs.h' included from here
C:\Users\Slim\Documents\8535\8535.asm(1): info: 'C:\WinAVR-20100110\avr\include\avr/io.h' included from here
Assembly failed, 2 errors, 0 warnings
Kod: Markera allt
typedef int int8_t __attribute__((__mode__(__QI__)));
typedef unsigned int uint8_t __attribute__((__mode__(__QI__)));
typedef int int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int uint16_t __attribute__ ((__mode__ (__HI__)));
typedef int int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int uint32_t __attribute__ ((__mode__ (__SI__)));
#if !__USING_MINT8
typedef int int64_t __attribute__((__mode__(__DI__)));
typedef unsigned int uint64_t __attribute__((__mode__(__DI__)));
#endif
Har för mej att jag fått något fel innan när jag höll på med detta och då fungera det fin utan de raderna men nu får man en lång fin lista om man plockar väck dem.
Tackar