Hello everyone.
I have made an external file to make all my port manipulations, in an ATTINY85 mcu, and it does't seem to work while if I put the code in the main it does.
I am posting the code I am testing with other parts excluded for ease of reading.
My main file is
#define F_CPU 8000000 #include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #include "setUp.h" #include "inPuts.h" #define tap (1<<PB3) #define divSel (1<<PB4) #define beatSel (1<<PB2) #define beat2 (1<<PB1) #define beat4 (1<<PB0) int main(void) { setUp(); while (1) { inPuts(); }
Setup.h
#include <avr/io.h> #ifndef SETUP_H_ #define SETUP_H_ void setUp(void); #endif /* SETUP_H_ */
setUp.c
#include <avr/io.h> #include <avr/interrupt.h> #define tap (1<<PB3) #define divSel (1<<PB4) #define beatSel (1<<PB2) #define beat2 (1<<PB1) #define beat4 (1<<PB0) void setUp(){ //inputs-outputs DDRB|=beatSel | beat4 | beat2; //outputs DDRB &= ~(divSel) & ~(tap); // inputs PORTB |= divSel | tap; //pullup resistors inputs }
inPuts.h
include <avr/io.h> #include <avr/interrupt.h> #ifndef INPUTS_H_ #define INPUTS_H_ void inPuts(void); #endif /* INPUTS_H_ */
inPuts.c
#define F_CPU 8000000 #include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #include "setUp.h" #include "inPuts.h" #define tap (1<<PB5) #define divSel (1<<PB3) #define beatSel (1<<PB4) #define beat2 (1<<PB2) #define beat4 (1<<PB1) #define beat8 (1<<PB0) void inPuts (void){ PORTB^=beatSel; }
Thanks in advace