User:Frosti/Sensors, Actuators, and Displays

From Fab Lab Wiki - by NMÍ Kvikan
Revision as of 11:02, 30 March 2010 by Frosti (talk | contribs)
Jump to navigation Jump to search

Hello Speaker and Hello Step I decided to try to start making the board, by drawing it in Eagle.

First I drew hello.speaker.45.MTA.

Then I tried to use Inkscape to

I downloaded [AVR Data sheet for Attiny45] from Atmel


AVR

  • SBI -> Set Bit in I/O Register
  • CBI -> Clear Bit in I/O Register
  • LDI -> Load Immediate
  • BRNE-> Branch if Not Equal

First we made some experiments

  • Open AVR studio
  • File New Project
  • Write .asm code
include "tn44def.inc";
sbi DDRA, 0;
ldi R18, 10;
LoopA:
	sbi PORTA, 0;
	ldi R19, 15; 
	Loop2:
		dec R19;
		brne Loop2;
		cbi PORTA, 0;
		ldi R19, 20;
		Loop3:
			dec R19;
			brne Loop3
  	dec R18;
  	brne LoopA;
  • Build and Run
  • Step into

Alternate the code

Define variablbe.

.def sensor_pin = PB3	; we call pin PB3 a sensor pin
def charge_pin = PB4	; PB4 is our charge pin

.def sensor_value_high = R23 ; temporary storage for sensor value (here we store our sensor values (because we have 10 bit value, here we have the higher value) .def sensor_value_low = R24 ; temporary storage for sensor value (here we store our sensor values (because we have 10 bit value, here we have the lower value)


Links