Hello!
I just installed Avrstudio 6 and have ran into a weird problem (I am used to Avr GCC on Mac and don't have much experience with avr studio). The following does not work (when I program the MCU = Attiny25).
void testSet(void){ SETBIT(I2C_PORT,I2C_SDA); } void testClr(void){ CLEARBIT(I2C_PORT,I2C_SDA); } int main(void) { //init(); DDRB = 0x18; for(;;) { if (bit_is_clear(PINB, PB0)){ _delay_ms(SM_DELAY); //prell delay testClr(); //CLEARBIT(I2C_PORT,I2C_SDA); while(bit_is_clear(PINB, PB0)); //until button is released _delay_ms(SM_DELAY); //prell delay testSet(); //SETBIT(I2C_PORT,I2C_SDA); } } return 0; }
But if I do like this. Then it works:
void testSet(void){ SETBIT(I2C_PORT,I2C_SDA); } void testClr(void){ CLEARBIT(I2C_PORT,I2C_SDA); } int main(void) { //init(); DDRB = 0x18; for(;;) { if (bit_is_clear(PINB, PB0)){ _delay_ms(SM_DELAY); //prell delay //testClr(); CLEARBIT(I2C_PORT,I2C_SDA); while(bit_is_clear(PINB, PB0)); //until button is released _delay_ms(SM_DELAY); //prell delay //testSet(); SETBIT(I2C_PORT,I2C_SDA); } } return 0; }
same deal if I move the
DDRB = 0x18;
inside the init function.
Any suggestions to what the cause can be?