;*------------------------------------------------- ;* Analog-Digital-Wandlung ;* mit Analog-Komparator ;* - - - - - - - - - - - - - - - - - - - - - - - - ;* Port B Bit 0 RC-Glied 1uF/10 kOhm ;* Port B Bit 1 Mess-Spannung ;* Port B Bit 3 Timer-PWM-Ausgang ;* MCU ATTiny4313, Takt 4 MHz ;* PortD LCD Ausgabe: R/W=GND ;* PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0 ;* n/a LED ena rs D7 D6 D5 D4 ;* Adapter auf LCD-Port: ;* PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0 ;* D7 D6 D5 D4 LED n/a ena rs ; ATtiny4313 memory use summary [bytes]: ; Segment Begin End Code Data Used Size Use% ;-------------------------------------------------- ;[.cseg] 0x000000 0x0002a6 650 28 678 4096 16.6% ;[.dseg] 0x000060 0x000060 0 0 0 256 0.0% ;[.eseg] 0x000000 0x000000 0 0 0 256 0.0% ;Assembly complete, 0 errors. 0 warnings ;-------------------------------------------------- ; .nolist .include "tn4313def.inc" .list ; .def temp = r16 ; Temporaerregister 1 .def temp1 = r17 ; Temporaerregister 2 .def temp2 = r18 ; Temporaerregister 3 .def temp3 = r19 ; Temporaerregister 4 .equ daten = portd ; PortD nur 7 Bit Breite, Bit 7 fehlt .equ rs = 4 ; 0bn00x0000 Portbit Register Select .equ ena = 5 ; 0bn0x00000 Portbit Enable .equ licht = 6 ; 0bnx000000 Portbit LCD-Beleuchtung .equ zeit0 = 200 ; Zeitschleifen Ladewerte .equ zeit1 = 65535 .cseg .org 0x0000 rjmp main ; zum Hauptprogramm ; main: ldi temp, low(ramend) ; Stackpointer initialisieren out spl, temp ldi temp, high(ramend) out sph, temp ; ldi temp, 0xFF ; Ports einrichten out ddrb, temp ; PortB A/D out portb, temp ; Pullups setzen out ddrd, temp ; PortD Ausgabe LCD out portd, temp ; Pullups setzen rcall lcdinit ldi temp, 0x18 ; Watchdog enable (1<