Started LCD
This commit is contained in:
parent
10f12f31cd
commit
119942f88e
35
16x2_lcd/Makefile
Normal file
35
16x2_lcd/Makefile
Normal file
|
@ -0,0 +1,35 @@
|
|||
BINARY=lcd
|
||||
|
||||
AS=avr-as
|
||||
LD=avr-ld
|
||||
OBJCOPY=avr-objcopy
|
||||
GDB=avr-gdb
|
||||
|
||||
AVRDUDE=avrdude
|
||||
AVRDUDE_CONFIG=/etc/avrdude.conf
|
||||
|
||||
TTY=/dev/ttyACM0
|
||||
|
||||
ARCH=atmega328p
|
||||
|
||||
SIMAVR=simavr
|
||||
|
||||
build:
|
||||
$(AS) -g -mmcu=$(ARCH) -o $(BINARY).o $(BINARY).s
|
||||
$(LD) -o $(BINARY).elf $(BINARY).o
|
||||
$(OBJCOPY) -O ihex -R .eeprom $(BINARY).elf $(BINARY).hex
|
||||
|
||||
upload:
|
||||
$(AVRDUDE) -C $(AVRDUDE_CONFIG) -p $(ARCH) -c arduino -P $(TTY) -b 115200 -D -U flash:w:$(BINARY).hex:i
|
||||
|
||||
sim:
|
||||
$(SIMAVR) -m $(ARCH) $(BINARY).elf -g
|
||||
|
||||
debug:
|
||||
$(GDB) $(BINARY).elf
|
||||
|
||||
|
||||
run: build upload
|
||||
|
||||
clean:
|
||||
ls | grep $(BINARY) | grep -v *.s | xargs rm -f --
|
55
16x2_lcd/lcd.s
Normal file
55
16x2_lcd/lcd.s
Normal file
|
@ -0,0 +1,55 @@
|
|||
.equ RAMEND, 0x08FF
|
||||
|
||||
.equ SREG, 0x3F
|
||||
.equ SPL, 0x3D
|
||||
.equ SPH, 0x3E
|
||||
|
||||
.equ PORTD, 0x0B
|
||||
.equ DDRD, 0x0A
|
||||
|
||||
.equ PORTB, 0x05
|
||||
.equ DDRB, 0x04
|
||||
|
||||
.equiv PINCONFIG, 24
|
||||
|
||||
.org 0x0000
|
||||
|
||||
INIT_MEM:
|
||||
|
||||
; Description:
|
||||
; -----------
|
||||
;
|
||||
; Reset the system status in SREG, initialize the stack using SPL and
|
||||
; SPH and set output PINs on PORTB.
|
||||
;
|
||||
; Pins used for DATA will be DIGITAL PIN 1-7 from PORTD and DIGITAL PIN 8
|
||||
; from PORTB.
|
||||
;
|
||||
; Pins used for REGISTER SELECT, READ/WRITE and ENABLE are DIGITAL PINS
|
||||
; 10, 11, respectively 12 from PORTB.
|
||||
|
||||
clr r16
|
||||
out SREG, r16
|
||||
|
||||
ldi r16, lo8(RAMEND)
|
||||
out SPL, r16
|
||||
|
||||
ldi r16, hi8(RAMEND)
|
||||
out SPH, r16
|
||||
|
||||
ldi r16, 0xFE
|
||||
out DDRD, r16
|
||||
|
||||
ldi r16, 0x1C
|
||||
out DDRB, r16
|
||||
|
||||
INIT_LCD:
|
||||
|
||||
ldi PINCONFIG, 0x10
|
||||
out PORTB, PINCONFIG
|
||||
|
||||
ldi PINCONFIG, 0x70
|
||||
out PORTD, PINCONFIG
|
||||
|
||||
MAIN:
|
||||
rjmp MAIN
|
Loading…
Reference in New Issue
Block a user