Hi all..
I am working on a small project using attiny 10 microcontroller where i need to test the blink program initially.
Code:
#define F_CPU 8000000UL // define it now as 1 MHz unsigned long
#include <avr/io.h>
#include <stdint.h>
#include <util/delay.h>
int main (void)
{
unsigned int i;
CCP = 0xD8;
// CLKPS[3:0] sets the clock division factor
CLKPSR = 0;
for(i=0; i<=100; i++)
{
PORTB = 0b0000; // TURN ON LED
_delay_ms(50);
PORTB = 0b1111; // TURN OFF LED
_delay_ms(50);
}
}
Schamatic Attached.
i am using anduino nano to program attiny chip.
REF: https://junkplusarduino.blogspot.com/p/attiny10-resources.html
what my problem is...
my controller does not start. The LED is not blinking. i have even tried programming 4 to 5 boards, but non of them work.
can anybody please let me know what the problem is
Don't work on simulation ? Don't work on actual circuit ?
And more...you did not specify what compiler you are using.
BTW: You seemingly forgot to configure DDRB register.
Don't work on simulation ? Don't work on actual circuit ?
And more...you did not specify what compiler you are using.
BTW: You seemingly forgot to configure DDRB register.
Probably not your problem but remember that an embedded app does NOT have an OS to return to when it finishes (although it never should 'finish').
Typically such apps have a main loop that is infinite - typically written as 'while(1){...}'.
I would recommend that you replace the 'for' loop with such an infinite main loop. This way your code will have the proper structure for all future projects.
Susan