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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Hal Albach
02/26/13 07:44
Read: 828 times
Seminole, Florida
USA


 
#189481 - Clarification & Suggestions
Responding to: James Brzycki'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      James Brzycki      02/24/13 09:46      
   Comments, please      Hal Albach      02/24/13 17:25      
      Comments      James Brzycki      02/24/13 17:56      
         Code Fragments      Hal Albach      02/24/13 21:01      
            Commenst added, reply to hal      James Brzycki      02/24/13 21:11      
               comments      Hal Albach      02/24/13 22:46      
                  comments      James Brzycki      02/25/13 06:33      
                     Program flow      Hal Albach      02/25/13 11:40      
                        comments      James Brzycki      02/25/13 21:45      
                           Clarification & Suggestions      Hal Albach      02/26/13 07:44      
                              GREAT HELP      James Brzycki      02/26/13 11:39      
                                 Data Display loop      Hal Albach      02/26/13 12:24      
                                    Worked sorta      James Brzycki      02/27/13 06:57      
                                       The output      Hal Albach      02/27/13 15:29      
                                          I looked at it wrong      James Brzycki      02/27/13 17:19      
                                             Works      James Brzycki      02/27/13 20:35      
                                                Great news!      Hal Albach      02/28/13 07:05      
                                                   Thank you      James Brzycki      02/28/13 07:15      
                                                      You're Welcome      Hal Albach      02/28/13 08:33      
                                                      A couple of questions      Hal Albach      02/28/13 11:06      
                                                         Answers and questions      James Brzycki      02/28/13 11:54      
                                                            Thanks      Hal Albach      02/28/13 12:36      

Back to Subject List