Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

Latest threads

New Articles From Microcontroller Tips

Back
Top