comparison code_part1/OSTC_code_asm_part1/adc_rtc.asm @ 81:31fa973a70fd

Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
author JeanDo
date Mon, 06 Dec 2010 18:05:39 +0100
parents 263348f83485
children 17de42ab02b6
comparison
equal deleted inserted replaced
80:d2d7cb96100d 81:31fa973a70fd
21 ; last updated: 05/15/08 21 ; last updated: 05/15/08
22 ; known bugs: 22 ; known bugs:
23 ; ToDo: 23 ; ToDo:
24 24
25 get_battery_voltage: ; starts ADC and waits until fnished 25 get_battery_voltage: ; starts ADC and waits until fnished
26 ; In MPLAB Sim mode (hardware emulation), use a DMCI slider to
27 ; directly set a 16 bit value in the range 0..1023
28 ; In normal mode, jut wait for the value to be ready:
29
30 ifndef TESTING
26 bsf ADCON0,0 ; power on ADC 31 bsf ADCON0,0 ; power on ADC
27 nop 32 nop
28 bsf ADCON0,1 ; start ADC 33 bsf ADCON0,1 ; start ADC
34
29 get_battery_voltage2: 35 get_battery_voltage2:
30 btfsc ADCON0,1 ; Wait... 36 btfsc ADCON0,1 ; Wait...
31 bra get_battery_voltage2 37 bra get_battery_voltage2
38 endif
32 39
33 ; 3.3V/1024=3,2227mV Input/Bit=9,6680mV Battery/Bit. 40 ; 3.3V/1024=3,2227mV Input/Bit=9,6680mV Battery/Bit.
34 ; Example: 434*9,6680mV=4195,9mV Battery. 41 ; Example: 434*9,6680mV=4195,9mV Battery.
35 42
36 movff ADRESH,xA+1 43 movff ADRESH,xA+1