| ??? 11/21/07 22:32 Modified: 11/21/07 22:37 Read: times |
#147320 - Clobbering your data Responding to: ???'s previous message |
Jeroen Wilbers said:
Oops
I rewrote the routine so that it should write as it is supposed to do. No, actually you didn't. You really need a simulator so you can see what is happening to your data. Read Hal's post again. http://www.8052.com/forum/read.phtml?id=147287 You want something like this
WRITE_CMD:
PUSH B
MOV B,A
ANL A,#00001111B ;MASK OFF UPPER 4 BITS
XCH A,B ;B IS READY
ANL A,#11110000B ;MASK OFF LOWER 4 BITS
SWAP A ;SWAP UPPER AND LOWER NIBBLES
ACALL SNDLCD ;A IS READY - SEND IT
MOV A,B
ACALL SNDLCD ;SEND B
POP B
RET
SNDLCD:
MOV P1,A ;SEND IT OUT
setb en
PUSH 01
MOV R1,#255 ;Delay
DJNZ R1,$
POP 01
clr en
RET
I also don't think that you have enough delay between setting and clearing EBIT. Jon PS try this simulator if you don't have one http://www.vaultbbs.com/pinnacle/ |
| Topic | Author | Date |
| 4 bit LCD trouble | 01/01/70 00:00 | |
| Possible Error | 01/01/70 00:00 | |
| DATA is port EN is pin | 01/01/70 00:00 | |
| Initialization | 01/01/70 00:00 | |
| I think I did initialize correct | 01/01/70 00:00 | |
| Logical operations | 01/01/70 00:00 | |
| Oops, should have been ANL BA | 01/01/70 00:00 | |
| Clobbering your data | 01/01/70 00:00 | |
| topic gone?? | 01/01/70 00:00 | |
| code library | 01/01/70 00:00 | |
| Try LCD Tutorial in tutorials section | 01/01/70 00:00 | |
| Tutorial uses 2 ports | 01/01/70 00:00 | |
| previous comments... | 01/01/70 00:00 | |
| All tested an nailed the problem | 01/01/70 00:00 | |
| yes, timing | 01/01/70 00:00 | |
Some code shortening: | 01/01/70 00:00 |



