Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/25/07 08:49
Read: times


 
#144964 - much better view
Responding to: ???'s previous message
Andy Neil said:
John Papas said:
...replace this with your code...

When it says, "...replace this with your code...", it means that you should delete the text "...replace this with your code..." and insert the text of your source code in its place - leaving the 'pre' and '/pre' tags in place!

Then use the 'Preview' button to preview your post and make sure that it looks good.

For full details, read http://www.8052.com/faqs.phtml?FAQ=120199



KBE	EQU		9Dh
KBLS	EQU		9Ch
KBF	EQU		9Eh
IEN0	EQU		0A8h
IEN1	EQU		0B1h

MAXTH	EQU		37h		;maximum temperature  seted
MINTH		EQU		1Eh		;minimum 	"			"

LCD     DATA     P2          ;define LCD data port on port 1
BUSY    BIT      LCD.7       ;define LCD busy flag
;*************************************************************
DATA_SEG	SEGMENT 	DATA
MAIN_SEG	SEGMENT 	CODE
BITS_SEG    SEGMENT     BIT

RSEG	DATA_SEG
Temp:	DS		1
BitCnt: DS 		1
Thermk:	DS		1

RSEG	BITS_SEG
FLAG1:		DBIT	1
Buncb_7:	DBIT	1
Buncb_6:	DBIT	1		
;***************************************************
; INTERRUPT VECTOR DEFINITIONS
;---------------------------------------------------

CSEG    AT      0000H               ; reset vector
        JMP     POWER_UP            ; power-on entry point

CSEG    AT      0003H               ; intr 0 vector
        RETI                        ; not used

CSEG    AT      000BH               ; timer 0 vector
        RETI                        ; not used

CSEG    AT      0013H               ; intr 1 vector
        CLR     EX1                 ; external int 1
        RETI                        ; not used

CSEG    AT      001BH               ; timer 1 vector
        RETI                  		;  NOT used

CSEG    AT      003BH               ; Kyeboard vector
        JMP		SCANK               ; used
;***************************************************
; MAIN PROGRAM INITIALIZATION
;---------------------------------------------------
RSEG	MAIN_SEG
	USING   0                   ; use register block 0

POWER_UP:
        MOV     SP,#7Fh        ; set stack pointer

	CALL  	Keyb_Init
	mov		Temp,#3Ch	;a number which i make some 		                 
	MOV		IEN0,#80h	;EA=1 and ET1=1 
	MOV		IEN1,#01h          ;KBD=1 Keyboard enable bit
		
AgainSc:
		MOV		A,KBF
		ANL		A,#0A0h
		JZ		Nokey
		MOV		IEN1,#00h	;disable key inderrupt
		MOV		A,#03h		;start delay
ly3:		DEC		A
		JNZ		ly3
		MOV		A,#0FFh
ly4:		DEC		A
		JNZ		ly4		;end  delay
		CLR		A
		MOV		KBF,A	;enable detection
		MOV		IEN1,#01h			
Nokey:		JMP     AgainSc
;*****************************************************************************
Keyb_Init:
		MOV		KBE,#0E0h		;enable interrupt only by the last 3 bits
		MOV		KBLS,#00h		;enable bit only by low level (zero)
		MOV		KBF,#00h
RET
;===============================================================
;ISR routine for scanning and showing on the dispaly the user preferences and the 
;actual temperature
;===============================================================
SCANK:	  
		
DISPLAY:push	acc
		MOV      A,#80h	
        		CALL    COMMAND	;where to be schowed
        		MOV      DPTR,#TEST
        		ACALL    DISP_STRING
		MOV	A,#85h
		CALL    COMMAND
		
		CALL	Show
		MOV      A,#0C1h
        		CALL    COMMAND		
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;the following assemby code is for subtraction of the stored number
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
		MOV	A,KBF	;check which key used ,only the key Number 5	
		ANL	A,#20h
		JZ	Next_Key

		MOV	A,Temp
		CJNE	A,#MINTH,KNex1		;the set value can not be smaller than the MINTH
KNex1:		JC		KExod		
		
		CLR 	C
		SUBB	A,#01				;decriment 1
		MOV	Temp,A		
		CALL	Hex_to_Dec			;reform the data to decimal
		CALL	Show
KExod:		
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;the following assemby code is for addition the stored number
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Next_Key:
	
		MOV	A,KBF			;check which key used ,only the key Number 7	
		ANL	A,#80h
		JZ	Out
		
		MOV	A,Temp
		CJNE	A,#MAXTH,Nex1		;the set value can not be biger than the MAXTH
Nex1:		JNC	Out		
		
		CLR 	C
		ADDC	A,#01				;increment 1
		MOV	Temp,A		
		CALL	Hex_to_Dec			;reform the data to decimal
		CALL	Show	
Out: 		POP		acc
RETI

		END   


List of 6 messages in thread
TopicAuthorDate
ISR Keyboard            01/01/70 00:00      
   How to use the 'Insert Code' button            01/01/70 00:00      
      much better view            01/01/70 00:00      
         Debouncing            01/01/70 00:00      
   Debouncing etc is far easier handled            01/01/70 00:00      
   see the FAQ            01/01/70 00:00      

Back to Subject List