Professional Documents
Culture Documents
Fits I.E. Medium and Large
Fits I.E. Medium and Large
Fits I.E. Medium and Large
……………………………………………………………………………………………
; This is an ISR routine for external event counter EX0,
………………………………………………………………………………………………
Ie1_isr:setb pwm
Cpl zcd2_bit
Mov t10,pwml ;load timer0
Mov t10,pwmh
Setb tr0 ;start timer0
Clr Ie 1
Reti
……………………………………………………………………………………………
This is an ISR routin for timer0
……………………………………………………………………………………………..
Tim0_isr: clr pwm ;triac on
Clr tr0 ;stop timer
Reti
………………………………………………………………………………………………
initialize variables
………………………………………………………………………………………………
ini_var:mov p3,#0ffh
Clr nebit ;clear bit
Clr nce ;
Clr zcd1_bit
Clr zcd2_bit
Setb pwm ;off triac
Reti
…………………………………………………………………………………………
Init timer 1
…………………………………………………………………………………………
………………………………………………………………………………………………
This routin will show display temperature
Destroy=ACC,DPTR,r3,r4
………………………………………………………………………………………………
……………………………………………………………………………………………
; Keyboard routine
………………………………………………………………………………………………
This routine will chk for k/b hit. it scan all lines.
; px7 px6 px5 px4 px3 px2 px1 px0
; [output] [input]
; if no key pressed clear carry else set carry.
; Input: Nothing
;output :carry flag :0-no key
1-key available in accumulator
;destroy ; acc,B
………………………………………………………………………………………………
;--------------------------------------------------------------------------------------------
;wait till kb not hit
;--------------------------------------------------------------------------------------------
;-------------------------------------------------------------------------------------------
;chk for key released
;-------------------------------------------------------------------------------------------
************************************************************************
KB routines ends
Input: hex_1:hex_2(HEX data)
Output: convert input data to BCD
Display it on data field
………………………………………………………………………………………………
Dat_disp: mov hex_1,#0 ;take hex data
Mov hex_2,a
Push acc
Lcall hex_bcd :hex to BCD
Mov ct,hex_2 :store current temp in BCD
Mov r4,hex_1 :parameter passing to display
Mov r3,hex_2
Mov a,cur_pos ;load cursor position
Lcall disp ;display data
Mov a,indx_e
Lcall ot_d
Mov a,indx_ce
Lcall ot_d
Pop acc
Quito: ret
………………………………………………………………………………………………
message
------------------------------------------------------------------------------------------------------------
Sgn_on:dfb ‘fuzzy Controller’
Dfb temp=
Bl_nk: dfb ‘ ‘
Dfb , ‘
lcall dely_I0
lcall command
lcall dely_l0
lcall command
lcall dely_l0
mov a,#38h
leall command
lcall dely_10
mov a,#10h
lcall command
leall dely_l0
mov a,#0eh
lcall command
lcall dely_I0
mov a,#06h
lcall command
lcall dely_l0
mov a,#0lh
lcall command
lcall dely_l0
ret
;-----------------------------------------------------------------------------------------------------------
; This routin will provide command to LCD module
; port2 D7 D6 D5 D4 D3 D2 Dl D0
; l l l l l l l l
; E R/W RS
;RS = 0 (command reg access)
;R/W = 0 (write operation)
;EN = ( enable make 0/1/0)
;-----------------------------------------------------------------------------------------------------------
command: mov lcd _port,a
clr RS ;clr RS
clr RW ;write
nop
nop
nop
nop
nop
setb E ;EN= 1
nop
nop
nop
nop
nop
clr E ;EN= 0
ret
;-----------------------------------------------------------------------------------------------------------
; This routin will provide display data to LCD module
; RS = 1 ( data reg access)
;-----------------------------------------------------------------------------------------------------------
display: mov Lcd_port,a
setb RS ;set RS
;write
clr RW
nop
nop
nop
nop
setb E ;EN = 1
nop
nop
nop
nop
clr E ;EN = 0
ret
;-----------------------------------------------------------------------------------------------------------
; This routin will provide command to LCD module
;--------------------------------------------------------------------------------------------------------------------
-