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: systemInitHardware:
; set all ports as inputs and enable internal pull-up resistors ; set all ports as inputs and enable internal pull-up resistors
ldi r16, 0xff ; ldi r16, 0xff
clr r17 clr r17
out DDRA, r17 ; all input outr DDRA, r17 ; all input
sts PUEA, r16 ; enable pull-up on all outr PUEA, r17 ; disable pull-up on all
out DDRB, r17 ; all input outr DDRB, r17 ; all input
sts PUEB, r16 ; enable pull-up on all outr PUEB, r17 ; disable pull-up on all
ret ret
; @end ; @end
@@ -50,6 +50,22 @@ systemSetSpeed:
clr r16 ; SUT=0, CLKPS=0 clr r16 ; SUT=0, CLKPS=0
sts CCP, r17 sts CCP, r17
sts CLKPR, r16 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 .endif
ret ret
@@ -118,16 +134,16 @@ systemSetupTimer0: ; setup timer for IRQ every 100ms
ldi r16, (1<<OCF0A) ; clear pending interrupts ldi r16, (1<<OCF0A) ; clear pending interrupts
.ifdef TIFR0 .ifdef TIFR0
out TIFR0, r16 outr TIFR0, r16
.else .else
out TIFR, r16 outr TIFR, r16
.endif .endif
ldi r16, (1<<OCIE0A) ; Timer/Counter0 Output Compare Match A Interrupt Enable ldi r16, (1<<OCIE0A) ; Timer/Counter0 Output Compare Match A Interrupt Enable
.ifdef TIMSK0 .ifdef TIMSK0
out TIMSK0, r16 outr TIMSK0, r16
.else .else
out TIMSK, r16 outr TIMSK, r16
.endif .endif
sec sec
ret ret