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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/26/13 14:44
Read: times


 
#189481 - Clarification & Suggestions
Responding to: ???'s previous message
Register R1 is being used by the conversion blocks as an INDIRECT POINTER, which means that the contents of R1 is the actual address of the data, not R1 itself. Both R0 and R1 have this feature. When they are preceeded with the @ symbol then the indirect feature is utilized. For example, the instruction MOV A,@R1 will look at R1 and use whatever is there as the address of the data byte. If R1 contains 50H then whatever is in location 50H will be copied into the Accumulator.
What is happening in your program is when the COMNWRT: and DATAWRT: are called the first thing they do is copy the Accumulator into R1, wiping out the pointer that had been there.

BACK1:
	MOV	A,@R0			;get dec digit
	ORL	A,#30H			;make it an ascii digit
	MOV	@R1,A	      ;save it TO WHERE R1 is POINTING
	INC	R0			;next digit
	INC	R1			;next
	DJNZ	R2,BACK1		;repeat until the last one
	RET

DATA_DISPLAY:				; since my lcd init is not whats in my book i have to change the data display from whats in it
	ACALL	DELAY
	MOV	A,#91H			; place cursor at thso position
	ACALL	COMNWRT       ; R1 WILL BE CHANGED TO 91H !!!
	ACALL	DELAY
	MOV	A,@R1	      ; Whatever is in location 91H is copied to A 
	ACALL	DATAWRT
	ACALL	DELAY
	RET

 

When the DATA_DISPLAY block executes R1 is currently pointing to the most significant byte of the 3 bytes that are the ASCII codes of the converted temperature reading. You need to loop the last half of DATA_DISPLAY 3 times, decrementing R1 each time in order to display all three digits. Also, in blocks COMNWRT: and DATAWRT: change the R1 referances to R6, which is unsed. This will preserve R1 as a pointer to the ASCII data.

Hal

List of 22 messages in thread
TopicAuthorDate
How to display data from a ADC0808 to a LCD            01/01/70 00:00      
   Comments, please            01/01/70 00:00      
      Comments            01/01/70 00:00      
         Code Fragments            01/01/70 00:00      
            Commenst added, reply to hal            01/01/70 00:00      
               comments            01/01/70 00:00      
                  comments            01/01/70 00:00      
                     Program flow            01/01/70 00:00      
                        comments            01/01/70 00:00      
                           Clarification & Suggestions            01/01/70 00:00      
                              GREAT HELP            01/01/70 00:00      
                                 Data Display loop            01/01/70 00:00      
                                    Worked sorta            01/01/70 00:00      
                                       The output            01/01/70 00:00      
                                          I looked at it wrong            01/01/70 00:00      
                                             Works            01/01/70 00:00      
                                                Great news!            01/01/70 00:00      
                                                   Thank you            01/01/70 00:00      
                                                      You're Welcome            01/01/70 00:00      
                                                      A couple of questions            01/01/70 00:00      
                                                         Answers and questions            01/01/70 00:00      
                                                            Thanks            01/01/70 00:00      

Back to Subject List