??? 01/18/06 17:52 Modified: 01/18/06 17:53 Read: times |
#107726 - routine runs multiple times, why?? |
hello all of you!
I hope you can help me out. I've written a small program accordeing to the LCD tutorial. somehow it runs the main routine multiple times. #include 8051.H DATA .equ 080H ;P0 DB0 .equ 080H ;P0.0 DB1 .equ 081H ;P0.1 DB2 .equ 082H ;P0.2 DB3 .equ 083H ;P0.3 DB4 .equ 084H ;P0.4 DB5 .equ 085H ;P0.5 DB6 .equ 086H ;P0.6 DB7 .equ 087H ;P0.7 RS .equ 0A2H ;P2.2 RW .equ 0A1H ;P2.1 EN .equ 0A0H ;P2.0 .org 0000H Main acall Init ; initialise aCALL CLEAR_LCD MOV A, #'H' aCALL WRITE_TEXT MOV A, #'E' aCALL WRITE_TEXT MOV A, #'L' aCALL WRITE_TEXT MOV A, #'L' aCALL WRITE_TEXT MOV A, #'O' aCALL WRITE_TEXT aCALL MOVE_CURS MOV A, #'W' aCALL WRITE_TEXT MOV A, #'O' aCALL WRITE_TEXT MOV A, #'R' aCALL WRITE_TEXT MOV A, #'L' aCALL WRITE_TEXT MOV A, #'D' aCALL WRITE_TEXT Cpl P3.5 .end Init SETB EN CLR RS MOV DATA,#38h ; hhhh CLR EN aCALL WAIT_LCD SETB EN CLR RS MOV DATA,#0Ch ; Display on, cursor off, blinking off CLR EN aCALL WAIT_LCD SETB EN CLR RS MOV DATA,#06h ; jjjj CLR EN aCALL WAIT_LCD ret ; return MOVE_CURS CLR RS MOV DATA, #040H+080H ;Adress+command SETB EN CLR EN aCALL WAIT_LCD ret WRITE_TEXT SETB EN SETB RS MOV DATA,A CLR EN aCALL WAIT_LCD RET CLEAR_LCD: SETB EN CLR RS MOV DATA,#01h CLR EN aCALL WAIT_LCD RET WAIT_LCD: SETB EN ;Start LCD command CLR RS ;It's a command SETB RW ;It's a read command MOV DATA,#0FFh ;Set all pins to FF initially MOV A,DATA ;Read the return value JB ACC.7,WAIT_LCD ;If bit 7 high, LCD still busy CLR EN ;Finish the command CLR RW ;Turn off RW for future commands RET on P3.5 a led is atached and it flickers multiple times (a bit to fast to count) does anyone have an idea how this can happen? I think it causes other problems in other programs Regards Jeroen |
Topic | Author | Date |
routine runs multiple times, why?? | 01/01/70 00:00 | |
Main does not stop | 01/01/70 00:00 | |
how do I stop? | 01/01/70 00:00 | |
you cant | 01/01/70 00:00 | |
'51 CAN be stopped!![]() | 01/01/70 00:00 | |
which assembler, it has a bug | 01/01/70 00:00 | |
assembler | 01/01/70 00:00 | |
no need to change, all have idiosynchazi | 01/01/70 00:00 | |
A suggestion | 01/01/70 00:00 | |
i prefer | 01/01/70 00:00 |