Attiny2313 C program with function

Status
Not open for further replies.

b0j3

New Member
Hello!

I am trying to program attiny2313 using avr-gcc.
The program:

#include <avr/io.h>

int subfunc(volatile uint8_t *port, uint8_t mask) {
*port |= mask;
return 0;
}

int main() {
subfunc(&PORTB,0xff);
return 0;
}


I am using avr-gcc (on Ubuntu 6.06 linux) but the program doesn't work. It seems to get stuck in subfunction.

Any ideas what I am doing wrong.
 
To mask off a bit don't use a function use a macro. a lot easier. AS far as you code I thing the & in the call is messing you up. try getting ride of it
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…