ATmega32 Code replacemnt for ATtiny13

Status
Not open for further replies.

Asadkh21

Junior Member level 1
Joined
Oct 13, 2013
Messages
16
Helped
1
Reputation
2
Reaction score
1
Trophy points
3
Visit site
Activity points
119
Can anybody help me with writing a replacemnt code i wrote which should perform the same function as this one for ATtiny13.
This is what I want my AtTiny13 to do what my ATmega32 is doing right now.

Code:
#include <mega32.h>
#include <delay.h>

void main()
{
   DDRB=0xFF;
    while(1)
        {
        PORTB.0=1;
        delay_ms(2);
        PORTB.0=0;
        delay_ms(3);
        PORTB.1=1; 
        delay_ms(2);
        PORTB.1=0;
        delay_ms(3);
        }
        }
 
Last edited by a moderator:

I think it should be the same. Just properly change first #include statement (I guess even this is not necessary).
 

Here is the code. I compiled for 4 MHz Clock. If you are trying to blink LED then increase delays to greater than or equal to 500 ms.
 

Attachments

  • ATTiny.rar
    18 KB · Views: 60

It is always a good idea to specify your compiler, in this case it seems to be codevision

The code is quite simple so you just need to chance the port if portb is not available in attiny and also change the pin number (PORTB.x) if you are using different pins.
You also need to chance the included header to match the chip you intend to use
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…