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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/13/08 18:19
Read: times


 
#158251 - indentation
Responding to: ???'s previous message
Vijay Singh said:
PLZ help i m a begineer.I wanted to know in below code what will come in left nibble and right nibble say we put value #12h in the hours as shown in complete code given below .. i also wanted to know why are we ANDing it. Is it to convert HEX code 12h.

Portion i m finding difficult to understand
        mov	a,hrs		
        anl     a,#0f0h                  	        
        swap    a		        	
        mov     a,hrs
        anl     a,#0fh                         
        call    segdisplay
_____________________________________________________
COMPLETE PROGRAM
$MOD51	
Display prog to display Hrs Min Secs 12:30:45


clk_pin_4094    bit     p1.4	
shift register Clock pulse
data_pin_4094   bit     p1.5	
shift register	Data pin

SECS      	DATA   	08H      
MINS      	DATA   	09H      
HRS       	DATA   	0aH      

delayreg              data              0bh
delayreg100us   data               0ch
delayreg1ms      data               0dh


		org     0			
		MOV         SP,#50H                     
		mov	secs,#45h	;Moves value 45 in secs
		mov	mins,#30h	;Moves value 30 in mins
		mov	hrs,#12h	;Moves value 12 in hrs
	
start:		call	displaytime
		jmp	start


displaytime:

        clr     data_pin_4094          ; make input-data-pin low
        call	clock_pulse	
        setb    data_pin_4094

        mov	a,hrs		;hours
        anl     a,#0f0h                  	
        swap    a		
        call    segdisplay	
        mov     a,hrs
        anl     a,#0fh                         
        call    segdisplay

        mov	a,mins        	 ;minuits;
        anl     a,#0f0h		 
        swap    a
        call    segdisplay
        mov     a,mins
        anl     a,#0fh
        call    segdisplay

        mov	a,secs        	;seconds
        anl     a,#0f0h
        swap    a
        call    segdisplay
        mov     a,secs
        anl     a,#0fh
        call    segdisplay

        ret


clock_pulse:
	setb	clk_pin_4094
	clr	clk_pin_4094
	ret
;--------------------------------------------------------
segdisplay:
        mov     dptr,#lookup	;now dptr=1st location of lookup table
	movc    a,@a+dptr	;fatches code from lookup table;gets next byte
        cpl     a
	mov     p0,a
        call    delay1ms
	mov	p0,#0ffh	;disable all segments
        call    clock_pulse	;to shift common of digit(FND Display)
        ret


delay100us:
        mov     delayreg100us,#48        ;11.05mhz
        djnz    delayreg100us,$
        ret
        
delay1ms:
        mov     delayreg1ms,#10
d1ms:     call    delay100us
        djnz    delayreg1ms,d1ms
        ret
;------------------------------------------------------

lookup:
	db	11111100b, 01100000b, 11011010b, 11110010b	;0  1  2  3
	db	01100110b, 10110110b, 10111110b, 11100000b	;4  5  6  7
	db	11111110b, 11110110b, 00010010b, 11000010b	;8  9  A  b
	db	01100011b, 10000110b, 00100010b, 00000010b	;C  d  E  F

	end             






List of 7 messages in thread
TopicAuthorDate
8051 led display            01/01/70 00:00      
   Err            01/01/70 00:00      
      Extracting high nibble            01/01/70 00:00      
   HELP ME            01/01/70 00:00      
      Did you read my post?            01/01/70 00:00      
      without kwledge of the hardware            01/01/70 00:00      
      indentation            01/01/70 00:00      

Back to Subject List