Hello boys and girls,
I have a problem with my code.I measure themperature using DS1820 and display it on an LCD.I want to hear a buzzer if the temurature reach 90 degrees C.My comparison is not working.
PLEASE HAVE A LOOK
-------------------------------------------
@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT ' system clock options
@ DEVICE pic16F628, WDT_ON ' watchdog timer
@ DEVICE pic16F628, PWRT_ON ' power-on timer
@ DEVICE pic16F628, MCLR_OFF ' master clear options (internal)
@ DEVICE pic16F628, BOD_ON ' brown-out detect
@ DEVICE pic16F628, LVP_OFF ' low-voltage programming
@ DEVICE pic16F628, CPD_OFF ' data memory code Protect
@ DEVICE pic16F628, PROTECT_OFF ' program code protection
Define LCD_BITS 4 ' 4-bit interface
Define LCD_LINES 2 ' 2 line LCD
Define LCD_DREG PORTA
Define LCD_DBIT 0
Define LCD_RSREG PORTA
Define LCD_RSBIT 4
Define LCD_EREG PORTB
Define LCD_EBIT 3
Define LCD_COMMANDUS 2000 ' Adjust for slower LCD modules
Define LCD_DATAUS 50
INCLUDE "MODEDEFS.BAS"
INTCON = 0 ' Disable interrupts
CMCON = 7
Pause 500 ' Wait for LCD to startup
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "By:Geronikolos" ' Display Hello
Lcdout $fe,$c0,"FW-05T" ' Clear LCD screen
PAUSE 5000 ' Wait 5 second
DQ var PortB.4
temp var word
loop:
owout DQ,1,[$cc]
owout DQ,0,[$44]
Pause 2000
owout DQ,1,[$cc]
owout DQ,0,[$be]
owin DQ,0,[temp.byte0,temp.byte1]
lcdout $FE,1
temp=temp*5
lcdout $fe, 1,"Temp = ",DEC2 temp/10,".", dec1 temp," ",$DF,"C"
lcdout $fe, $C0,"Temp = ",dec temp
pause 2000
IF temp > 90 THEN ;--this comparison is not working FOR 90 DEGREES
portb.0 = 1
endif
goto loop
end
---------------------------------------------------------------
Regards
Nikos
Bookmarks