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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/22/05 20:18
Read: times


 
#92206 - Commented code
Responding to: ???'s previous message
Juan,

I formatted your code and added few comments to it. Can you understand it now?

Your display seems like a shift register. You will have to do little experimentation with it in order to use this display. However the sample code had used UART as shift register but if in your actual project the UART is occupied, you can bit bang to send data to display.

PS: I didn't try to find logical or syntax errors in the code. This effort is just to give you an idea about what the code is actually doing.


DATA INPUT FORMAT:

1. DATA BIT = 0 --> DISPLAY ON
   DATA BIT = 1 --> DISPLAY OFF.

2. THE STATIC DISPLAY MEMORY(RAM) IS ORGANIZDE INTO DIS1--DIS4 RAM,
   WHEN SERIAL CLOCK SEND DATA,FIRST SEND THE LOWEST BITS OF DIS1,
   AND THEN SEND THE HIGH BITS OF DIS4 

PROGRAMME EXAMPLE: 

	
;******************************************************************
;This part of code transfers first 8 bytes from look-up table
; (pointed to by TAB) to locations 30H-onwards
;******************************************************************

        ORG 0 
BGIN: 
	MOV SCON,#00H		; configure serial port as shift register 
	MOV R1,#30H 		; start data transfer as stated above
	MOV R2,#08H 
	MOV DPTR, #TAB 
TR1:
	MOV A,#0H 
	MOVC A,@A+DPTR 
	MOV @R1,A 
	INC DPTR 
	INC R1 
	DJNZ R2,TR1 		; data transfer ends when R2=0



;************************************************************
; This part of code actually transfers data to display which
; is connected to TXD and RXD pins of micro
; R1=base address of data to be transfered
; R2=No of bytes to be transfered
;************************************************************
;BGIN: 
	MOV R2,#08H 
	MOV R1,#30H 
TR3: 
	ACALL DE		; delay 
				; MOV R3,#01H 
;TR2: 
	MOV A,@R1 
	MOV SBUF,A 
	ACALL DE2 
				; ACALL DE2 
				; ACALL DE2 
				; DJNZ R3,TR2 
				; ACALL DE 
	INC R1 
				; ACALL DE 
				; ACALL DE 
	DJNZ R2,TR3 
	AJMP BGIN 

;**************************************************************
; DE is delay routine
;**************************************************************

DE:
	MOV R6,#0FFH 
DE1:
	NOP 
	ACALL DE2 
	DJNZ R6,DE1 
	RET 
DE2:
	MOV R7,#0FFH 
DE3:
	NOP 
	DJNZ R7,DE3 

	RET


 
TAB: DB 7FH,0BFH,0DFH,0EFH,0F7H,0FBH,0FDH,0FEH,00H,0FFH ;401.LOOP 
TAB: DB 03H,9FH,25H,0DH,99H,49H,41H,1FH,00H,09H,0FFH    ;401.DATA 


List of 15 messages in thread
TopicAuthorDate
4 Digit LCD            01/01/70 00:00      
   Prediction!            01/01/70 00:00      
      I tried            01/01/70 00:00      
   4 digit LCD            01/01/70 00:00      
   Shift Register ??            01/01/70 00:00      
   7-seg? 5x7 Matrix?            01/01/70 00:00      
   Custom Made            01/01/70 00:00      
   Commented code            01/01/70 00:00      
      Can you help me more?            01/01/70 00:00      
         why, oh why            01/01/70 00:00      
            Thanks            01/01/70 00:00      
               an opportunity            01/01/70 00:00      
                  I agree            01/01/70 00:00      
   Writing to SBUF            01/01/70 00:00      
      you are asking me            01/01/70 00:00      

Back to Subject List