actually turn display on

This commit is contained in:
agsler
2024-01-13 00:14:05 +01:00
parent 512f4c9d5d
commit 9b4d68fd6f
6 changed files with 81 additions and 0 deletions

Binary file not shown.

BIN
code/Builds/main.elf Normal file

Binary file not shown.

BIN
code/Builds/main.o Normal file

Binary file not shown.

59
code/Makefile Normal file
View File

@@ -0,0 +1,59 @@
TARGET = main
SRCS := $(shell find -name '*.c')
FILES = $(SRCS:%.c=%) #main uart avrIOhelper/io-helper #uart#hier alle c-Datein reinschreiben, trennung durch " " und ohne .c-Endung
MCU = atmega328p
PROGC = m328p
CC = avr-gcc
#TOOL = stk500 -P /dev/ttyUSB0
TOOL = atmelice_isp
#TOOL = avrispmkii
#TOOL = usbasp-clone
BUILDDIR = Builds
DEFINES = -DF_CPU=2000000UL -DLCD_PORT=PORTD -DLCD_DDR=DDRD
CFLAGS =-mmcu=$(MCU) -O2 -Wall -Wpedantic $(DEFINES) -std=c99 -ffunction-sections -fdata-sections
LDFLAGS =-mmcu=$(MCU) -Wl,--gc-sections
LDFILES = $(foreach FILE,$(FILES),$(BUILDDIR)/$(FILE).o)
all: clean $(BUILDDIR)/$(TARGET).elf
$(BUILDDIR)/%.o: %.c
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $(BUILDDIR)/$*.o
$(BUILDDIR)/$(TARGET).elf: $(LDFILES)
mkdir -p $(dir $@)
$(CC) $(LDFLAGS) $(LDFILES) -o $(BUILDDIR)/$(TARGET).elf
$(BUILDDIR)/$(TARGET).hex : $(BUILDDIR)/$(TARGET).elf
avr-objcopy -j .data -j .text -O ihex $< $@
fuse:
avrdude -p $(PROGC) -c $(TOOL) -U lfuse:w:0xE8:m -U hfuse:w:0xD1:m
load: $(BUILDDIR)/$(TARGET).hex
avrdude -p $(PROGC) -c $(TOOL) -U flash:w:$(BUILDDIR)/$(TARGET).hex -v -B 125kHz
program: clean load
reset:
avrdude -p $(PROGC) -c $(TOOL)
size: $(BUILDDIR)/$(TARGET).elf
avr-size -C --mcu=$(MCU) $(BUILDDIR)/$(TARGET).elf
.PHONY=clean
clean:
rm -rf $(BUILDDIR)
#Fuse m1284p external Osz. Long startuptime
# avrdude -c usbasp-clone -p m1284p -U lfuse:w:0xff:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m
#Fuse m1284p internal Osz. Long startuptime
# avrdude -c usbasp-clone -p m1284p -U lfuse:w:0xe2:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m

1
code/avr-hd44780 Submodule

Submodule code/avr-hd44780 added at 1360f8dd01

21
code/main.c Normal file
View File

@@ -0,0 +1,21 @@
#include <avr/io.h>
#include <util/delay.h>
#include "avr-hd44780/lcd.h"
int main(void){
DDRC |= 1<<0;
DDRC |= 1<<1;
DDRD |= 1<<7;
lcd_init();
lcd_on();
lcd_clear();
lcd_puts("test");
while(1){
PORTC ^= 1<<0;
_delay_ms(1000);
PORTC ^= 1<<1;
}
}