You are on page 1of 4

define OSC 4

INCLUDE "modedefs.bas"
DEFINE ADC_BITS 8
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
yo var bit
Adc VAR word
conversion VAR WORD
unid VAR byte
dece VAR byte
cent VAR byte
n var word
w var word
conversion2 VAR WORD
unid2 VAR byte
dece2 VAR byte
cent2 VAR byte
record var word
ADCON1 = %00001110 ;falta conf
TRISA = %11111111
TRISC = %00000000
TRISD = %00000000
Inicio:
n=0
programa:
; Pause 20
yo=0
ADCIN 0,Adc ; la entrada analogica se carga aqui
read 0,record
if PORTA.1=0 then gosub resetn
if PORTA.2=0 then gosub reseteeprom
if n<adc then n=Adc
conversion = n*98/25
conversion2 = record*98/25
unid = conversion DIG 0
PORTD = 62
PORTC = unid+224
Pause 2
unid2 = conversion2 DIG 0
PORTD = 55
PORTC = unid2+224
Pause 2
dece = conversion DIG 1
PORTD = 61
PORTC = dece+208
Pause 2
dece2 = conversion2 DIG 1
PORTD = 47
PORTC = dece2+208
Pause 2
cent = conversion DIG 2
PORTD = 59
PORTC = cent+176
Pause 2
cent2 = conversion2 DIG 2
PORTD = 31
PORTC = cent2+176
Pause 2
if n>record then write 0,n
GoTo programa
resetn:
; if PORTA.1=0 then cambio ;rutina para estabilizar tecla
pause 20
n=0
return

reseteeprom:
pause 20
write 0,yo
return

end
_____________________________________________________--
define OSC 4
INCLUDE "modedefs.bas"
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
yo var word
Adc VAR word
analogico var word
numero var word
conversion VAR WORD
unid VAR byte
dece VAR byte
cent VAR byte
;w var word
conversion2 VAR WORD
unid2 VAR byte
dece2 VAR byte
cent2 VAR byte
record var word
ADCON1 = %00001110 ;falta conf
TRISA = %11111111
TRISC = %00000000
TRISD = %00000000

Inicio:
numero=0
yo=0
programa:
ADCIN 0,Adc ; la entrada analogica se carga aqui
analogico=Adc/5
read 0,record
if PORTA.1=0 then gosub resetn
if PORTA.2=0 then gosub reseteeprom
if numero<analogico then numero=analogico
conversion = numero
conversion2 = record
unid = conversion DIG 1
PORTD = 62 ;000111110
PORTC = unid+224
Pause 2
unid2 = conversion2 DIG 1
PORTD = 55 ;00110111
PORTC = unid2+224
Pause 2
dece = conversion DIG 2
PORTD = 61 ;00111101
PORTC = dece+208
Pause 2
dece2 = conversion2 DIG 2
PORTD = 47 ;00101111
PORTC = dece2+208
Pause 2
cent = conversion DIG 3
PORTD = 59
PORTC = cent+176
Pause 2
cent2 = conversion2 DIG 3
PORTD = 31
PORTC = cent2+176
Pause 2
if numero>record then write 0,numero
GoTo programa
resetn:
; if PORTA.1=0 then cambio ;rutina para estabilizar tecla
pause 20
numero=0
return
reseteeprom:
pause 20
write 0,yo
return
end

;define OSC 4
INCLUDE "modedefs.bas"
DEFINE ADC_BITS 8
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
Adc VAR word
conversion VAR WORD
unid VAR byte
dece VAR byte
cent VAR byte
n var word
w var word
conversion2 VAR WORD
unid2 VAR byte
dece2 VAR byte
cent2 VAR byte
record var word
TRISA = %11111111
ADCON1 = %00001110 ;falta conf
TRISC = %00000000
TRISD = %00000000
Inicio:
; Pause 20
ADCIN 0,Adc
read 0,record
if n<adc then n=Adc
conversion = n*98/25

unid = conversion DIG 0


PORTC = unid + 224
Pause 5
conversion2 = record*98/25
unid2 = conversion2 DIG 0
PORTD = unid2 + 224
Pause 5
dece = conversion DIG 1
PORTC = dece + 208
Pause 5
dece2 = conversion2 DIG 1
PORTD = dece2 + 208
Pause 5
cent = conversion DIG 2
PORTC = cent + 176
Pause 1
cent2 = conversion2 DIG 2
PORTD = cent2 + 176
Pause 1
if n>record then gosub bucle
GoTo Inicio
bucle
write 0,n

return
end