0
Offline
Newbie
Karma: 0
Posts: 9
Arduino rocks
|
 |
« Reply #12 on: September 30, 2007, 05:46:54 am » |
I modified now the pins_arduino.c file and changed the build command in the preferences. The compiling works fine without error message. As I have problems with upload (I have a STK200 parallel programmer), I use the .hex file that will be generated in the applet folder and upload it separately with AVRDude. At the end, writing is successful, but no reaction on my atmel16....
What can be the problem? I didn't touch so far the wiring.c file because I hope that maybe the ATmega8 and 16 have the same parameters. No idea....
Although i get no error message with compiling I don't know, if the changes i made, are ok. Especially I don't know if #elseif is correct syntax at all. I attach you the code of the file. I hope someone can help me to figure out what is wrong. Thanks!
#include <avr/io.h> #include "wiring_private.h" #include "pins_arduino.h"
#define PA 1 #define PB 2 #define PC 3 #define PD 4
// these arrays map port names (e.g. port B) to the // appropriate addresses for various functions (e.g. reading // and writing) const uint8_t PROGMEM port_to_mode_PGM[] = { NOT_A_PORT, #if defined(__AVR_ATmega16__) &DDRA, #else NOT_A_PORT, #endif &DDRB, &DDRC, &DDRD, };
const uint8_t PROGMEM port_to_output_PGM[] = { //NOT_A_PORT, #if defined(__AVR_ATmega16__) &PORTA,
#else NOT_A_PORT, #endif &PORTB, &PORTC, &PORTD, };
const uint8_t PROGMEM port_to_input_PGM[] = { //NOT_A_PORT, #if defined(__AVR_ATmega16__) &PINA, #else NOT_A_PORT, #endif &PINB, &PINC, &PIND, };
const uint8_t PROGMEM digital_pin_to_port_PGM[] = { PD, /* 0 */ PD, PD, PD, PD, PD, PD, PD, PB, /* 8 */ PB, PB, PB, PB, PB, PC, /* 14 */ PC, PC, PC, PC, PC, #if defined(__AVR_ATmega16__) PC, PC, PA, /* 22*/ PA, PA, PA, PA, PA, PA, PA, #endif
};
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { _BV(0), /* 0, port D */ _BV(1), _BV(2), _BV(3), _BV(4), _BV(5), _BV(6), _BV(7), _BV(0), /* 8, port B */ _BV(1), _BV(2), _BV(3), _BV(4), _BV(5), _BV(0), /* 14, port C */ _BV(1), _BV(2), _BV(3), _BV(4), _BV(5), #if defined(__AVR_ATmega16__) _BV(6), _BV(7), _BV(0), /* 22, port A */ _BV(1), _BV(2), _BV(3), _BV(4), _BV(5), _BV(6), _BV(7), #endif
};
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { NOT_ON_TIMER, /* 0 - port D */ NOT_ON_TIMER, NOT_ON_TIMER, // on the ATmega168, digital pin 3 has hardware pwm #if defined(__AVR_ATmega168__) TIMER2B, #else NOT_ON_TIMER, #endif NOT_ON_TIMER, // on the ATmega168, digital pins 5 and 6 have hardware pwm #if defined(__AVR_ATmega168__) TIMER0B, TIMER0A, #elseif defined(__AVR_ATmega16__) TIMER1B, TIMER1A, #else NOT_ON_TIMER, NOT_ON_TIMER, #endif
#if defined(__AVR_ATmega16__) TIMER2, #else
NOT_ON_TIMER, #endif NOT_ON_TIMER, /* 8 - port B */ #if defined(__AVR_ATmega16__) NOT_ON_TIMER, NOT_ON_TIMER, #else TIMER1A, TIMER1B, #endif
#if defined(__AVR_ATmega168__) TIMER2A, #elseif defined(__AVR_ATmega16__) NOT_ON_TIMER, #else TIMER2, #endif NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER,/* 14 - port C */ NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, #if defined(__AVR_ATmega16__) NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, /*22 port A */ NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, #endif
};
|