Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Programming Attiny10 Microcontroller

Status
Not open for further replies.

gauravkothari23

Advanced Member level 2
Joined
Mar 21, 2015
Messages
640
Helped
5
Reputation
10
Reaction score
4
Trophy points
1,298
Activity points
6,921
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
 

Attachments

  • Attiny 10.png
    Attiny 10.png
    27.2 KB · Views: 121

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.

Sorry...
i had configured but forgot to mention.
Code:
DDRB |= (1 << PB0);
DDRB |= (1 << PB2);

i am using atmel studio. and the it does not work on actual circuit.
 

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
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top