comparison src/start.asm @ 650:bc214815deb2

3.19/10.75 release
author heinrichsweikamp
date Sun, 28 Aug 2022 13:13:38 +0200
parents aeca5717d9eb
children 75e90cd0c2c3
comparison
equal deleted inserted replaced
649:ef2ed7e3a895 650:bc214815deb2
394 bra restart3 ; NO - no BT then 394 bra restart3 ; NO - no BT then
395 ENDIF 395 ENDIF
396 bsf ble_available ; YES - BT available 396 bsf ble_available ; YES - BT available
397 397
398 restart3: 398 restart3:
399 bsf PORTE,0 ; power down BT chip 399 IFDEF _external_sensor ; Compiled for external analog interface?
400 btfsc ble_available ; BT available? 400 bsf ext_input_s8_ana ; YES - Set the flag
401 bra restart4 ; YES - can't be a cR then 401 call eeprom_serial_number_read ; read OSTC serial number
402 btfss battery_gauge_available ; NO - rechargeable? 402 movlw .31
403 bra restart4 ; NO - can't be a cR 403 cpfslt hi ; bigger than WREG?
404 bsf ext_input_s8_ana ; YES - it's a cR, S8/analog sensor input available 404 bsf ble_available ; NO - must be new OSTC+ with interface
405
406 restart4:
407 ; Do the check for BLE-cR
408 IFDEF _external_sensor
409 bsf mcp_power ; power-up instrumentation amp (used by S8 and analog input)
410 btfss mcp_power ; power-up completed?
411 bra $-4 ; NO - loop
412 WAITMS .1
413 banksel BAUDCON2 ; select bank for IO register access
414 movlw b'00000000' ; speed generator configuration: BRG16=0, normal for S8
415 movwf BAUDCON2 ; ...
416 movlw b'00100000' ; TX configuration: BRGH=0, SYNC=0
417 movwf TXSTA2 ; ...
418 movlw .25 ; speed configuration: SPBRGH:SPBRG = .25 : 9615 BAUD @ 16 MHz
419 movwf SPBRG2 ; ...
420 movlw b'10010000' ; RX configuration
421 movwf RCSTA2 ; ...
422 banksel common ; back to bank common
423 WAITMS .1
424 ; Check sensor 1 input with no limits
425 movlw b'00000000' ; AVDD Vref+
426 movwf ADCON1 ; ...
427 ; set to read Sensor 1
428 extern wait_adc
429 movlw b'00100001' ; power on ADC, select AN8
430 call wait_adc ; wait for ADC
431 movlw .10 ; ~ >1,900V
432 cpfslt ADRESH ; >10 on the high byte -> confident that there is cR circuity
433 bsf ext_input_s8_ana ; YES - it's a cR, S8/analog sensor input available
434 call disable_ir_s8_analog ; power-down circuity again
435 ENDIF 405 ENDIF
436 406
437 407
438 bsf lv_core ; default to low voltage core 408 bsf lv_core ; default to low voltage core
439 movlw 0x80 ; point to 0x1F780 409 movlw 0x80 ; point to 0x1F780