comparison src/hwos.asm @ 646:5b7fe7777425

3.16 release
author heinrichs weikamp
date Thu, 14 Oct 2021 12:03:24 +0200
parents a9a0188091e4
children 357341239438
comparison
equal deleted inserted replaced
642:a9a0188091e4 646:5b7fe7777425
42 ac_ram udata_acs ac_ram ; access RAM data 42 ac_ram udata_acs ac_ram ; access RAM data
43 43
44 44
45 ;---- Flags - Hardware Descriptors 45 ;---- Flags - Hardware Descriptors
46 HW_descriptor res 1 ; OSTC - model descriptor (cleared & rebuilt in restart) 46 HW_descriptor res 1 ; OSTC - model descriptor (cleared & rebuilt in restart)
47 HW_variants res 1 ; OSTC - model variants (NOT cleared in restart) 47 HW_variants res 1 ; OSTC - model variants (NOT cleared in restart)
48 48 HW_variants2 res 1 ; OSTC - more model variants (NOT cleared in restart)
49
49 ;---- Flags - Hardware States 50 ;---- Flags - Hardware States
50 HW_flags_state1 res 1 ; hardware - states 1 51 HW_flags_state1 res 1 ; hardware - states 1
51 HW_flags_state2 res 1 ; hardware - states 2 52 HW_flags_state2 res 1 ; hardware - states 2
53 HW_flags_state3 res 1 ; hardware - states 3
52 54
53 ;--- Flags - Operating System 55 ;--- Flags - Operating System
54 OS_flags_persist res 1 ; system - persistent settings (NOT cleared in restart) 56 OS_flags_persist res 1 ; system - persistent settings (NOT cleared in restart)
55 OS_flags_ISR1 res 1 ; system - ISR control 1 57 OS_flags_ISR1 res 1 ; system - ISR control 1
56 OS_flags_ISR2 res 1 ; system - ISR control 2 58 OS_flags_ISR2 res 1 ; system - ISR control 2
105 battery_temperature res 2 ; battery temperature in 0.1 Kelvin 107 battery_temperature res 2 ; battery temperature in 0.1 Kelvin
106 gauge_status_byte res 1 ; gauge IC status byte 108 gauge_status_byte res 1 ; gauge IC status byte
107 109
108 110
109 111
110 ; 40 byte user data 112 ; 44 byte user data
111 ; 32 byte tmp data placed by C compiler 113 ; 32 byte tmp data placed by C compiler
112 ; 20 byte variables placed by math library 114 ; 20 byte variables placed by math library
113 ; == 115 ; ==
114 ; 92 byte used, 4 byte free (96 byte total available) 116 ; 96 byte used, 0 byte free (96 byte total available)
115 117
116 118
117 global HW_descriptor 119 global HW_descriptor
118 global HW_variants 120 global HW_variants
121 global HW_variants2
119 global HW_flags_state1 122 global HW_flags_state1
120 global HW_flags_state2 123 global HW_flags_state2
124 global HW_flags_state3
121 global OS_flags_persist 125 global OS_flags_persist
122 global OS_flags_ISR1 126 global OS_flags_ISR1
123 global OS_flags_ISR2 127 global OS_flags_ISR2
124 global OM_flags_mode 128 global OM_flags_mode
125 global DM_flags_deco 129 global DM_flags_deco
175 179
176 ;bcf RCON,SBOREN ; brown-out off (not needed here, is handled in bootloader) 180 ;bcf RCON,SBOREN ; brown-out off (not needed here, is handled in bootloader)
177 bcf RCON,IPEN ; priority interrupts off 181 bcf RCON,IPEN ; priority interrupts off
178 182
179 banksel WDTCON 183 banksel WDTCON
180 movlw b'10000000' ; setup watchdog 184 movlw b'00010000' ; setup watchdog, put VCORE Reg into Ultra Low-Power mode in Sleep
181 movwf WDTCON ; ... 185 movwf WDTCON ; ...
182 186
183 187
184 ; I/O Ports 188 ; I/O Ports
185 banksel 0xF16 ; addresses F16h ... F5Fh are not part of the access RAM 189 banksel 0xF16 ; addresses F16h ... F5Fh are not part of the access RAM
364 368
365 ; MSSP1 Module: I2C Master 369 ; MSSP1 Module: I2C Master
366 movlw b'00101000' ; set up I2C to master mode 370 movlw b'00101000' ; set up I2C to master mode
367 movwf SSP1CON1 ; ... 371 movwf SSP1CON1 ; ...
368 clrf SSP1CON2 ; ... 372 clrf SSP1CON2 ; ...
369 movlw 0x9C ; select speed 100kHz @ 64MHz Fosc 373 movlw i2c_speed_value
370 movwf SSP1ADD ; ... 374 movwf SSP1ADD ; ...
371 375
372 376
373 ; PWM Module(s) 377 ; PWM Module(s)
374 ; PWM 1 for LED dimming 378 ; PWM 1 for LED dimming
439 movwf INTCON3 ; ... 443 movwf INTCON3 ; ...
440 movlw b'00000001' ; enable timer 1 IRQ 444 movlw b'00000001' ; enable timer 1 IRQ
441 movwf PIE1 ; ... 445 movwf PIE1 ; ...
442 movlw b'00000010' ; enable timer 3 IRQ 446 movlw b'00000010' ; enable timer 3 IRQ
443 movwf PIE2 ; ... 447 movwf PIE2 ; ...
444 movlw b'00000000' ; enable timer 5 IRQ
445 movwf PIE5 ; ...
446 movlw b'00000001' ; enable RTCC IRQ 448 movlw b'00000001' ; enable RTCC IRQ
447 movwf PIE3 ; ... 449 movwf PIE3 ; ...
448 movlw b'00001001' ; enable timer 7 and timer 4 IRQ 450 movlw b'00001001' ; enable timer 7 and timer 4 IRQ
449 movwf PIE5 ; ... 451 movwf PIE5 ; ...
450 452