Bereketnesh

May 27, 2010

Assembly Code

Filed under: Uncategorized — admin @ 8:01 am

;
; Displaying LCD and LED + to make it read temprature
;
; read and send temperature
;
; Neil Gershenfeld
; CBA MIT 10/25/07
;
; (c) Massachusetts Institute of Technology 2007
; Permission granted for experimental and personal use;
; license for commercial sale available from MIT.
;
;BEKY Tried to modify the MIT code.
;We will see on the next episode

;
.include “tn44def.inc”
;
; definitions
;
.equ red = PB0; red pin
.equ green = PB1; green pin
.equ blue = PB2; blue pin
;
; registers
;
.def temp = R16; temporary storage
.def temp1 = R17; temporary storage
.def count = R17; loop counter
.def pwm = R18; PWM counter
;
; code segment
;
.cseg
.org 0
rjmp reset
;
; main program
;
;
.equ DB7 = PA0
.equ DB6 = PA1
.equ DB5 = PA2
.equ DB4 = PA3
.equ E = PA4
.equ RS = PA5
;
; registers
;
.def lcdbyte = R16
.def temp2 = R20
.def temp3 = R21
;
; code segment
;
;
; long_delay
; delay before redraw
;
.equ long_delay_time = 100
long_delay:
ldi temp1, long_delay_time
long_delay1:
ldi temp2, long_delay_time
long_delay2:
ldi temp3, long_delay_time
long_delay3:
dec temp3
brne long_delay3
dec temp2
brne long_delay2
dec temp1
brne long_delay1
ret
;
; lcd_delay
; delay between commands
;
.equ lcd_delay_time = 100
lcd_delay:
ldi temp1, lcd_delay_time
lcd_delay1:
ldi temp2, lcd_delay_time
lcd_delay2:
dec temp2
brne lcd_delay2
dec temp1
brne lcd_delay1
ret
;
; lcd_putchar
; put character in lcdbyte
;
lcd_putchar:
;
; set RS for data
;
sbi PORTA, RS
;
; output high nibble
;
cbi PORTA, DB7
sbrc lcdbyte, 7
sbi PORTA, DB7
cbi PORTA, DB6
sbrc lcdbyte, 6
sbi PORTA, DB6
cbi PORTA, DB5
sbrc lcdbyte, 5
sbi PORTA, DB5
cbi PORTA, DB4
sbrc lcdbyte, 4
sbi PORTA, DB4
;
; strobe E
;
nop
sbi PORTA, E
nop
cbi PORTA, E
;
; wait
;
rcall lcd_delay ; can be shorter
;
; output low nibble
;
cbi PORTA, DB7
sbrc lcdbyte, 3
sbi PORTA, DB7
cbi PORTA, DB6
sbrc lcdbyte, 2
sbi PORTA, DB6
cbi PORTA, DB5
sbrc lcdbyte, 1
sbi PORTA, DB5
cbi PORTA, DB4
sbrc lcdbyte, 0
sbi PORTA, DB4
;
; strobe E
;
nop
sbi PORTA, E
nop
cbi PORTA, E
;
; wait and return
;
rcall lcd_delay ; can be shorter
ret
;
; lcd_putcmd
; put command in lcdbyte
;
lcd_putcmd:
;
; clear RS for command
;
cbi PORTA, RS
;
; output command bits
;
out PORTA, lcdbyte
;
; strobe E
;
nop
sbi PORTA, E
nop
cbi PORTA, E
;
; wait and return
;
rcall lcd_delay
ret
;
; lcd_init
; initialize the LCD
;
lcd_init:
;
; power-up delay
;
rcall lcd_delay
;
; initialization sequence
;
ldi lcdbyte, (1 << DB5) + (1 << DB4)
rcall lcd_putcmd
ldi lcdbyte, (1 << DB5) + (1 << DB4)
rcall lcd_putcmd
ldi lcdbyte, (1 << DB5) + (1 << DB4)
rcall lcd_putcmd
;
; 4-bit interface
;
ldi lcdbyte, (1 << DB5)
rcall lcd_putcmd
;
; two lines, 5×7 font
;
ldi lcdbyte, (1 << DB5)
rcall lcd_putcmd
ldi lcdbyte, (1 << DB7)
rcall lcd_putcmd
;
; display on
;
clr lcdbyte
rcall lcd_putcmd
ldi lcdbyte, (1 << DB7) + (1 << DB6) + (1 << DB5)
rcall lcd_putcmd
;
; entry mode
;
clr lcdbyte
rcall lcd_putcmd
ldi lcdbyte, (1 << DB6) + (1 << DB5)
rcall lcd_putcmd
ret
;
; lcd_print
; print a null-terminated string
;
lcd_print:
lcd_print_loop:
lpm
mov lcdbyte, R0
cpi lcdbyte, 0
breq return
rcall lcd_putchar
adiw zl, 1
rjmp lcd_print_loop
return:
ret
;
; strings to print
;
line_1:
.db “Holla to”,0
line_2:
.db “fab labs!!”,0
;
; reset routine
;
reset:
;
; set clock divider to /8
;
;ldi temp, (1 << CLKPCE)
;ldi temp1, (0 << CLKPS3) | (0 << CLKPS2) | (1 << CLKPS1) | (1 << CLKPS0)
;out CLKPR, temp
;out CLKPR, temp1
;
; set stack pointer to top of RAM
;
ldi temp, high(RAMEND)
out SPH, temp
ldi temp, low(RAMEND)
out SPL, temp
;
; init LED pins for output
;
sbi PORTB, red
sbi DDRB, red
sbi PORTB, green
sbi DDRB, green
sbi PORTB, blue
sbi DDRB, blue
;
; set stack pointer to top of RAM
;
ldi temp, high(RAMEND)
out SPH, temp
ldi temp, low(RAMEND)
out SPL, temp
;
; init I/O pins
;
cbi PORTA, DB7
sbi DDRA, DB7
cbi PORTA, DB6
sbi DDRA, DB6
cbi PORTA, DB5
sbi DDRA, DB5
cbi PORTA, DB4
sbi DDRA, DB4
cbi PORTA, E
sbi DDRA, E
cbi PORTA, RS
sbi DDRA, RS
;
; init LCD
;
rcall lcd_init
;
; ldi count, 255
off_red_loop:
mov pwm, count
sbi PORTB, red
off_red_loop_off:
dec pwm
brne off_red_loop_off
mov pwm, count
cbi PORTB, red
off_red_loop_on:
inc pwm
brne off_red_loop_on
dec count
brne off_red_loop
ldi count, 255
red_green_loop:
mov pwm, count
cbi PORTB, red
sbi PORTB, green
red_green_loop_off:
dec pwm
brne red_green_loop_off
mov pwm, count
sbi PORTB, red
cbi PORTB, green
red_green_loop_on:
inc pwm
brne red_green_loop_on
dec count
brne red_green_loop
green_blue_loop:
mov pwm, count
cbi PORTB, green
sbi PORTB, blue
green_blue_loop_off:
dec pwm
brne green_blue_loop_off
mov pwm, count
sbi PORTB, green
cbi PORTB, blue
green_blue_loop_on:
inc pwm
brne green_blue_loop_on
dec count
brne green_blue_loop
blue_on_loop:
mov pwm, count
sbi PORTB, red
sbi PORTB, green
blue_on_loop_off:
dec pwm
brne blue_on_loop_off
mov pwm, count
cbi PORTB, red
cbi PORTB, green
blue_on_loop_on:
inc pwm
brne blue_on_loop_on
dec count
brne blue_on_loop
on_off_loop:
mov pwm, count
cbi PORTB, red
cbi PORTB, green
cbi PORTB, blue
on_off_loop_off:
dec pwm
brne on_off_loop_off
mov pwm, count
sbi PORTB, red
sbi PORTB, green
; main loop
;
main:
;
; go to zero position
;
clr lcdbyte
rcall lcd_putcmd
ldi lcdbyte, (1 << DB5)
rcall lcd_putcmd
;
; print first line
;
ldi zl,low(line_1*2)
ldi zh,high(line_1*2)
rcall lcd_print
;
; move to second line
;
ldi lcdbyte, (1 << DB7) + (1 << DB6)
rcall lcd_putcmd
clr lcdbyte
rcall lcd_putcmd
;
; print second line
;
ldi zl,low(line_2*2)
ldi zh,high(line_2*2)
rcall lcd_print
;
; pause
;
rcall long_delay
;
; clear display
;
clr lcdbyte
rcall lcd_putcmd
ldi lcdbyte, (1 << DB4)
rcall lcd_putcmd
;
; repeat
;
rjmp main

January 27, 2010

Molding and Casting

Filed under: Uncategorized — admin @ 6:04 pm

I.

From 3D molding

II.

From 3D molding

III.

From 3D molding

IV.

From 3D molding

V.

From 3D molding




December 18, 2009

Big projects in barcelona

Filed under: Uncategorized — admin @ 10:55 am

Fablab Barcelona students have made different designs for something big project. The projects include different furnitures, products and expermental designs.

December 14, 2009

Electronics design fabrication

Filed under: Uncategorized — admin @ 11:28 am
Electro
View more documents from bereketnesh.

December 9, 2009

Something Big

Filed under: Uncategorized — admin @ 10:50 pm

Computer controlled cutting

Filed under: Uncategorized — admin @ 10:43 pm

October 14, 2009

LED CLTHS

Filed under: assignment -CAD — admin @ 5:46 am

The rotating accessory is LED connected to the cloth, which changes the color of the clothing and shows the temprature, the second is a footwear that will change its form by extending it to the upper and change the color as well.

September 30, 2009

Semester project

Filed under: Uncategorized — admin @ 7:31 am

Here are the project I proposed to be fabricated here in FabLab. The project is Lighting digital wearable designs which I thought I can go far with it.

September 29, 2009

Activities done

Filed under: Addis! — admin @ 10:14 am

For FabLab Addis- Here are some activities done in FabLab Bcn and We will be posting each activities done every Friday.

Self-Reproducing machine

Filed under: Project I — admin @ 4:42 am

This is a self reproducing machine proposal
It condenses and distributes molecules in it by casting them inside. The inner and the outer shape is the same so that it duplicates it self. The proportion of distribution is a golden mean proportion which can be seen in plants and animals.

Powered by WordPress