....nolist ; We don't want to actually include defs in our listing file. .include "m168def.inc" ; m168def.inc defines all the pins on the Mega168 so we can ; use them by their names rather than addresses (not fun). .list ; We DO want to include the following code in our listing ;D rjmp main ; You usually place these two lines after all your main: ; directives. They make sure that resets work correctly. ldi r16,0xFF ; LoaD Immediate. This sets r16 = 0xFF (255) out DDRB,r16 ; Out writes to SRAM, which is one way of accessing ; pins. DDRB controls PORTB's in/out state. ldi r16,0x00 ; r16 is where we'll store current LED state ; 0x00 means all off. This is preserved over loops.
; LEDblink.asm - M. Covington 2006
; For ATtiny13.
; Blinks the LEDs attached to PB0 and PB1.
.include "tn13def.inc"
.def temp = R16
.def temp1 = R17
.def temp2 = R18
.def mask = R19
start: ldi temp,0b00000010
out PORTB,temp ; initialize port B
ser mask
out DDRB,mask ; port B all outputs
blink:
; Delay 0.1 sec (1.2 MHz)
ldi temp1,200 ; outer loop count
L1: ldi temp2,199 ; inner loop count
L2: dec temp2
brne L2
dec temp1
brne L1
; Toggle PB0 and PB1
ldi mask,0b00000011
eor temp,mask
out PORTB,temp
rjmp blink
; End of program
So when I got to Maker Day at Maker Faire yesterday afternoon, I was happy to find that Limor Fried, the founder of Adafruit, was giving a presentation on how to start your own business selling kits. This is a growing business right now, as people look for reasons to teach their kids how to solder, or just want to build a neat device. (Adafruit teamed with the Maker Store to offer the infamous TV-B-Gone kit that garnered a lot of attention at CES this year.)
void setup(){
pinMode(13, OUTPUT);
}
void loop(){
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(500);
}
First, we configure pin 13 for output by setting a bit in Data Direction Register B. Then we turn pin 13 by setting its bit in PORTB. Then we delay 500 milliseconds by marking the current value of timer0, converted into milliseconds, and letting the counter be incremented repeatedly at each clock cycle and overflowed into ever larger holders until the new value of timer0 represents an elapsed time of 500ms. Next we set the bit for pin 13 in PORTB low to turn the LED off. We do the delay dance again and we're home.
This is the first in a series of articles about generating sound with an Arduino. The goals are to generate good quality sound which can be used to play simple tones, stored music, sampled sound, and even act as a MIDI synthesizer. I will cover the basic design, including code and hardware that anyone can use to add sound to Arduino microcontroller projects.
The first step is to look what has already been done. We want to explore many possible options for sound generation and resolve which is best for given situations. I hope to spark some discussion so please comment with information links, advice, suggestions and general opinions.
gdb and simulavr are the backend of AVR studio. With gdb and simulavr you can do the same things you can do with AVR studio. Ubuntu has in its repository some ready packages. Look for gcc-avr, binutils-avr, avr-libc, avrdude, gdb-avr, simulavr. Just install them, that's it Cool The downside is that you don't have a GUI, you probably need to simulate your code from the command line.
This tutorial will demonstrate the following development process: Write C programs in AVR Studio. Compile them into a .hex file using the AVR-GCC compiler (which integrates into AVR Studio). Simulate the target AVR chip and debug the code within AVR Studio. Program the actual chip using the AVRISP mkII USB device, which is attached to our target chip with a special 6-pin cable. Once programmed, the chip runs the program in your circuit.
Navigator: + AVR main + Frutt home + Contact me Subjects o Assembler o DisAssembler o man avrdis o Gigaweb o NGW 100 o Opcodes o Yomal o VAX 01 o VAX 02 Okapi o Design o Control Assembler o EBNF o aa001 Achatz o ICSP dongle Service + Downloads + Achatz.nl