| ??? 04/17/02 20:23 Read: times |
#21859 - help with memory mappind and LCD´s msg |
Hello! I'm a newbie with 8051 programming and need some help to send send a text to a LCD. A little background: I used a development kit at college last year and made a simple program that read a DC voltage trough a DAC and presented it (in decimal, like this e.g. "3,25 V"). Then I improved the program, including a tacometer and a temperature alarm (the "high temp", "normal temp" message kind). That kit used a funny memory mapping, so all my programs were running in the external RAM so I could use MOVX and MOV DPTR as in the same memory workspace, very easy. my code looked like this:
===================== begin: MOV A, #00h ; ADC address LCALL ADC ; ADC routine, ADC value stored in A MOV B, #33H ; store 33h (51d) in B DIV AB ; divide A/B ADD A, #30H ; add A and #30h, obtains digit's ASCII MOV DPTR, #VOLTIMETRO; store message pointer in DPTR MOVX @DPTR, A ; write A to 1st meter digit MOV A, B ; rest of A/B stored in A MOV B, #05H ; store 05h in B DIV AB ; divide A/B ADD A, #30H ; add A and #30h, obtains digit's ASCII INC DPTR; INC DPTR; MOVX @DPTR, A ; write A to 2nd meter digit MOV A, B ; rest of A/B stored in A RL A ; multiplies A*2 (so A = 0, 2, 4, 6 or 8) INC DPTR; MOVX @DPTR, A ; write A to 3rd meter digit VOLTIMETRO : DB ' , V normal', 00h ; message "X,XX V normal" MOV DPTR, #VOLTIMETRO; LCALL lcdmens ; LCD message routine lcall begin end; ================ As you can see (I hope :-) ...) in the code, I wrote a standard message that has some characters overwriten each time that the ADC is read... I did this to every message that was displayed... at the colleges kit it worked fine, but I bought a development kit to myself that use a "standard" memory mapping, so when I do a "MOVX @DPTR, A" I'm not overwriting my message text, I'm writing at the external memory (of course, but quite a surprise to me)... I spent 3 days just to figure this... since I only had programmed the 8051 with the college kit I didn't had understood it's peculiarities, I was thinking of it like a Z80 or a 8080 in terms of memory space and due to this I just can't figure how to do this now... how can I overwrite a memory position if I don't have 16 bits MOV instructions? MOVC moves from a 16 bit address to Accumulator, but I want to move from Acc to a 16 bit address. I became so "proficient" with the school's kit that I'm having a hard time to re-learn how to do things right... I think that I downloaded every .pdf from phillips and intel recommended for the 8051 family and still having a hard time... any help/advice is welcome! TIA orlando |
| Topic | Author | Date |
| help with memory mappind and LCD´s msg | 01/01/70 00:00 | |
| RE: help with memory mappind and LCD´s m | 01/01/70 00:00 | |
| RE: help with memory mappind and LCD´s m | 01/01/70 00:00 | |
| RE: help with memory mappind and LCD´s m | 01/01/70 00:00 | |
| RE: help with memory mappind and LCD´s m | 01/01/70 00:00 | |
| RE: help with memory mappind and LCD´s m | 01/01/70 00:00 | |
| RE: help with memory mappind and LCD´s m | 01/01/70 00:00 | |
| RE: help with memory mappind and LCD´s m | 01/01/70 00:00 | |
| RE: help with memory mappind and LCD´s m | 01/01/70 00:00 | |
| RE: help with memory mappind and LCD´s m | 01/01/70 00:00 | |
| RE: help with memory mappind and LCD´s m | 01/01/70 00:00 | |
| RE: help with memory mappind and LCD´s m | 01/01/70 00:00 | |
RE: help with memory mappind and LCD´s m | 01/01/70 00:00 |



