added code to read calibration data.

This commit is contained in:
Martin Preuss
2025-07-06 12:22:22 +02:00
parent f930b846c2
commit b6ba56a564

View File

@@ -19,14 +19,14 @@
systemInitHardware:
; set all ports as inputs and enable internal pull-up resistors
ldi r16, 0xff
; ldi r16, 0xff
clr r17
out DDRA, r17 ; all input
sts PUEA, r16 ; enable pull-up on all
outr DDRA, r17 ; all input
outr PUEA, r17 ; disable pull-up on all
out DDRB, r17 ; all input
sts PUEB, r16 ; enable pull-up on all
outr DDRB, r17 ; all input
outr PUEB, r17 ; disable pull-up on all
ret
; @end
@@ -50,6 +50,22 @@ systemSetSpeed:
clr r16 ; SUT=0, CLKPS=0
sts CCP, r17
sts CLKPR, r16
#if 0
; read and set calibration data
push r15
inr r15, SREG
cli
ldi zl, 0
ldi zh, 1
ldi r16, (1<<RSIG) | (1<<SPMEN)
outr SPMCSR, r16
lpm r17, Z
outr OSCCAL0, r17
outr SREG, r15
pop r15
#endif
.endif
ret
@@ -118,16 +134,16 @@ systemSetupTimer0: ; setup timer for IRQ every 100ms
ldi r16, (1<<OCF0A) ; clear pending interrupts
.ifdef TIFR0
out TIFR0, r16
outr TIFR0, r16
.else
out TIFR, r16
outr TIFR, r16
.endif
ldi r16, (1<<OCIE0A) ; Timer/Counter0 Output Compare Match A Interrupt Enable
.ifdef TIMSK0
out TIMSK0, r16
outr TIMSK0, r16
.else
out TIMSK, r16
outr TIMSK, r16
.endif
sec
ret