Haberler:

Forum kuralları güncellendi LÜTFEN  okuyunuz:  https://bit.ly/2IjR3ME

Ana Menü

ds18b20 tavsiye

Başlatan styx75, 15 Mart 2014, 12:51:28

styx75

selam arkadaşlar
aşağıdaki programı yazdım..tecrübeli arkadaşlar eksik yada falıkları nelerdedir tavsiyelerini yazarsa sevinirim
program çalışmaktadır..

pause 200
TRISB  = 0   
TRISA  = %11111   
LOW PORTB.7
SYMBOL SEC=PORTA.0
SYMBOL A =PORTA.1
SYMBOL E =PORTA.2

DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 0   
DEFINE LCD_RSREG PORTB 
DEFINE LCD_RSBIT 4 
DEFINE LCD_EREG PORTB 
DEFINE LCD_EBIT 5
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000 
DEFINE LCD_DATAUS 50

  DQ var PORTA.3
  deger var word
  derece var word
  SET VAR BYTE
  TOL VAR BYTE 
  SC VAR BYTE
  CMCON=7
  SC=0
  READ 0,TOL
  READ 5,SET
  LCDOUT $FE,$48, 3, 3, 0,0, 0, 0, 0, 0
  PAUSE 50
  ILK:

  LCDOUT $FE,$01," BOYLER"
  LCDOUT $FE ,$C0,"SET"," ",#SET,1,"C"
  PAUSE 500
  LCDOUT $FE,$01
  PAUSE 500
  LCDOUT $FE,$01," BOYLER"
  LCDOUT $FE ,$C0,"SET"," ",#SET,1,"C"
  PAUSE 500
  LCDOUT $FE,$01," BOYLER"
  LCDOUT $FE ,$C0,"TOLR"," ",#TOL,1,"C"
  PAUSE 500
  LCDOUT $FE,$01
  PAUSE 500
  LCDOUT $FE,$01," BOYLER"
  LCDOUT $FE ,$C0,"TOLR"," ",#TOL,1,"C"
  PAUSE 1000         
'-anadongu-----

  LCDOUT $FE,$01," BOYLER"
  LCDOUT $FE ,$C0,"BASLIYOR"
  PAUSE 3000
  LCDOUT $FE,$01," BOYLER" 
basla:
  IF DERECE<=SET-TOL THEN HIGH PORTB.7
  IF DERECE>=SET THEN LOW PORTB.7 
  IF SEC=0 THEN GOSUB AYAR
  WHILE SEC=0
  WEND
  PAUSE 10     
  GOSUB OKUMA
  GOTO BASLA
'-OKUMA ALT PROG----   
OKUMA:
  owout dq, 1,[$CC, $44]
  pause 20
  owout dq, 1,[$CC, $BE]
  owin DQ, 0, [deger.lowbyte, deger.highbyte]
  DERECE=DEGER/16   
  LCDOUT $FE ,$C0,"  ", DEC DERECE,1,"C"
  RETURN
'-AYAR ALT PROG-----
  AYAR:
  SC=0
  SC=SC+1
  GOSUB SETD                 
'-SETD ALT PROG-----
  SETD:
  SETD1:
  LOW PORTB.7
  IF A=0 THEN SET=SET+1
  LCDOUT $FE,$01," BOYLER"
  LCDOUT $FE ,$C0,"SET"," ",#SET,1,"C"
  PAUSE 150
  IF SET>99 THEN SET=1
  IF A=0 THEN GOTO SETD1   
  WRITE 5,SET
  SETD2:       
  IF E=0 THEN SET=SET-1
  LCDOUT $FE,$01," BOYLER"
  LCDOUT $FE ,$C0,"SET"," ",#SET,1,"C"
  PAUSE 150
  IF SET<1 THEN SET=99
  IF E=0 THEN GOTO SETD2   
  WRITE 5,SET 
  IF SEC=0 THEN SC=SC+1
  WHILE SEC=0
  WEND     
  IF SC=2 THEN GOSUB TL
  IF SC=1 THEN GOTO SETD
'-TOL ALT PROGRAMI----
  TL:
  TLT:
  LOW PORTB.7
  IF A=0 THEN TOL=TOL+1
  LCDOUT $FE,$01," BOYLER"
  LCDOUT $FE ,$C0,"TOLR"," ",#TOL
  PAUSE 150
  IF TOL>15 THEN TOL=1
  IF A=0 THEN GOTO TLT 
  WRITE 0,TOL
  TLT1:
  IF E=0 THEN TOL=TOL-1
  LCDOUT $FE,$01," BOYLER"
  LCDOUT $FE ,$C0,"TOLR"," ",#TOL
  PAUSE 150
  IF TOL<1 THEN TOL=15
  IF E=0 THEN GOTO TLT1 
  WRITE 0,TOL
  IF SEC=0 THEN SC=SC+1
  WHILE SEC=0
  WEND
  PAUSE 5
  IF SC=3 THEN GOTO ILK
  IF SC=2 THEN GOTO TL 
  END

EFESU