Showing posts with label tiny13. Show all posts
Showing posts with label tiny13. Show all posts

Monday, November 3, 2008

Gorgeous LED Egg



After I completed the LED egg prototype with Atmel AVRtiny13 and a 10x10 LED matrix, I passed the LED egg to kaas, she worked very hard to decorate the LED egg case. It is very pretty now and I am happy to show you here.

For those who are interested in the details of the electronics, please check out my previous post:
http://www.bitartist.org/2008/06/gif2led-released-and-with-my-led-egg.html

Before:


After(click to view full sized image):

Wednesday, October 22, 2008

LED fake candle made from ATtiny13


AVR tiny13 with limited IO, small and powerful, so it is really good to make a DIY LED candle.


Link:
http://www.electronics-lab.com/blog/?p=2948

Monday, October 20, 2008

AVR tiny powered by Lemon!!

+

Tiny13V is aimed for running on low power condition! How low is it? It can be powered by the natural battery "Lemon".

Monday, July 28, 2008

AVR Assembler Tutorial

I found a very good site about programming AVR in assembly. The main idea of this site is that Learning by practical examples!

Some highlights:
1) Stepper motor control with AVR Tiny13
2) Egg timer design with AVR Tiny2313

Here is the site: http://www.avr-asm-tutorial.net/

Sunday, July 6, 2008

CTC mode on Tiny13

There are two OC0A and OC0B compare outputs in Tiny13. It is useful to generate waveform . In this example, we use OC0A to output a square wave to blink the LED which is very similar to the previous timer interrupt example instead the output is generate inside Tiny13 but not our interrupt routine.

int main (void)
{
b0_output; //OC0A as led output

TCCR0B = 0x03; //select timer clkio/64

TCCR0A = (0x01)<<6 | 0x02; // Toggle OC0A | CTC MODE
TCNT0 = 0x0; //starting couter value

OCR0A = 0x7F; //around frequency @ 2.2HZ

//make the clk cpu slower
CLKPR = 1<<CLKPCE; //tell cpu to update the CLKPR

CLKPR = 0x8; //clkio = clkcpu/256


while(1) {
;; //interrupt do the rest
}
}

We set the output to be toggled every time the counter value match our OCR0A value. Thus, a square wave is generated:



The complete project can be found here: http://labs.bitartist.org/compare_int.tar.gz

Timer interrupt on Tiny13

Sometimes we have to do somethings in certain period, so timer may be useful for you.
AVR tiny13 have one timer and it count until to 0xFF value for each clock. An interrupt will be then generated and call your interrupt routine.

In our example, we have the following interrupt routine:

ISR(TIM0_OVF_vect) {
if (led){
b0_high;
led = 0;
} else {
b0_low;
led = 1;
}
}


This routine is used to toggle the LED On or Off.

The complete project code can be found here: http://labs.bitartist.org/timer_int.tar.gz

Testing external interrupt INT0 on tiny13

Tiny 13 have an external interrupt "INT0" on PB1, We have created a test project on avr-gcc to have a quick testing on the INT0.



#include <avr/io.h>
#include <avr/interrupt.h>
#include "pin_macros.h"

unsigned char led=0;

ISR(INT0_vect) {
if (led){
b0_high;
led = 0;
} else {
b0_low;
led = 1;
}
}

int main (void)
{
b1_input; //switch
b0_output; //led output

MCUCR = 1<<isc01; //set INT0 as falling edge trigger

GIMSK = 1<<INT0; //enable INTO in global interrupt mask


sei(); //enable interrupt

while(1) {
;; //interrupt do the rest
}
}



B1 is connected to a switch, and B0 is connected to a LED.
When B1 is pressed, it would toggle the LED On or Off.

Download the whole project : http://labs.bitartist.org/test_int0.tar.gz

Reference:
http://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html