TODOPIC
Microcontroladores PIC => Lenguaje Basic para microcontroladores PIC => Mensaje iniciado por: cdistri en 01 de Julio de 2009, 07:11:23
-
Hola
Tengo un termometro digital el cual estaba funcionando correctamente, de buenas a primeras dejo de funcionar.Lo he montado en el simulador proteus y he mirado y compilado el codigo de nuevo pero me sigue sin funcionar.
A ver si alguien me pudiera hechar una mano.
Estoy utilizando mikrobasic y el micro es 16f877
Este es el codigo que utilizo:
programa TermometroDigital
dim i,j1,j2 as byte
text as string[6]
tmp_sign as byte
main:
text="Temp:"
adcon1=255
PORTA=255
PORTB=255
PORTD=0
TRISA=255
TRISB=255
TRISD=0
Lcd_Init(PORTD)
lcd_cmd(Lcd_Cursor_OFF)
lcd_out(1,1,text)
lcd_chr(2,12,223)
lcd_chr(2,13,"C")
while TRUE
ow_reset(PORTB,3)
ow_write(PORTB,3,$CC)
ow_write(PORTB,3,$44)
delay_us(120)
i=ow_reset(PORTB,3)
ow_write(PORTB,3,$CC)
ow_write(PORTB,3,$BE)
j1=ow_read(PORTB,3)
j2=ow_read(PORTB,3)
if j2 = $FF then
tmp_sign = "-"
j1= j1 or $FF
j1= j1 + $01
else
tmp_sign="+"
end if
j2=(j1 and $01)*5
j1=j1>>1
if j1<=10 then
PORTB.0=1
end if
ByteToStr(j1,text)
lcd_chr(2,7,tmp_sign)
lcd_chr(2,8,text[1])
lcd_chr(2,9,text[2])
lcd_chr(2,10,46)
ByteToStr(j2,text)
lcd_chr(2,11,text[2])
Delay_Ms(500)
wend
end.