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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/30/11 10:18
Read: times


 
#182122 - PLEASE SEE THIS AND HELP !!
Responding to: ???'s previous message
I wrote this code below. This has not comments yet. Is trying to give a message on dot matrix and in lcd screen. This, I manage to do it, but it runs consecutive and I can;t find what is the the bad thing which prevent the program to stop. Please see the code.


	ORG	000H
	CLR	P1.7
START:
	MOV	DPTR,#INFO
	MOV	R0,#70
NEXTC:
	MOV	R3,#7
REPEAT:
	MOV	R2,#10000000B	;COLUMN
	MOV	R1,#0
NEXT:
	MOV	A,R1		;DATA POINTER
	MOVC	A,@A+DPTR
	MOV	P2,A
	MOV	A,R2
	MOV	P0,A
	CALL	DELAY
	RR	A
	MOV	R2,A
	MOV	P0,#00H		;TURN OFF LED
	INC	R1
	CJNE	R1,#8,NEXT
	DJNZ	R3,REPEAT
	INC	DPTR
	DJNZ	R0,NEXTC
	CALL	MINIMA
	JMP	FIN
MINIMA:
	CALL	LCD_INIT
	CALL	MESSAGE
	RET
LCD_INIT:	
	MOV	A,#38h           	;8-bit data bus, 5x8 character font
        CALL	LCD_COMMAND 
	MOV	A,#0Eh			;turn LCD on, turn cursor on
        CALL	LCD_COMMAND 
	MOV	A,#06h			;turn on cursor auto-advance
	CALL	LCD_COMMAND 
	MOV	A, #01H
	LCALL	LCD_COMMAND
	RET
MESSAGE:
	MOV 	A,#'V'
        CALL 	WRITE_LCD_TEXT		;sent letter "V" to the LCD
        MOV 	A,#'A'
        CALL 	WRITE_LCD_TEXT		;sent letter "A" to the LCD
        MOV 	A,#'G'
        CALL 	WRITE_LCD_TEXT		;sent letter "G" to the LCD
        MOV 	A,#'.'
	CALL	WRITE_LCD_TEXT		;sent letter "." to the LCD
	MOV	A,#84h           	
        CALL	LCD_COMMAND             
	MOV 	A,#'T'
        CALL	WRITE_LCD_TEXT		;sent letter "T" to the LCD
        MOV 	A,#'R'
        CALL	WRITE_LCD_TEXT		;sent letter "R" to the LCD
        MOV 	A,#'I'
        CALL	WRITE_LCD_TEXT		;sent letter "I" to the LCD
        MOV 	A,#'A'
        CALL	WRITE_LCD_TEXT		;sent letter "A" to the LCD
        MOV 	A,#'N'
        CALL	WRITE_LCD_TEXT		;sent letter "N" to the LCD
        MOV 	A,#'T'
        CALL 	WRITE_LCD_TEXT		;sent letter "T" to the LCD
        MOV 	A,#'A'
        CALL	WRITE_LCD_TEXT		;sent letter "A" to the LCD
        MOV 	A,#'F'
        CALL	WRITE_LCD_TEXT		;sent letter "F" to the LCD
        MOV 	A,#'I'
        CALL 	WRITE_LCD_TEXT		;sent letter "I" to the LCD
        MOV 	A,#'L'
        CALL 	WRITE_LCD_TEXT		;sent letter "L" to the LCD
        MOV 	A,#'O'
        CALL	WRITE_LCD_TEXT		;sent letter "O" to the LCD
        MOV 	A,#'U'
        CALL	WRITE_LCD_TEXT		;sent letter "U" to the LCD
	MOV 	A,#' '
        CALL	WRITE_LCD_TEXT		;sent SPACE to the LCD
	MOV 	A,#'3'
        CALL	WRITE_LCD_TEXT		;sent 3 to the LCD
	MOV 	A,#'4'
        CALL	WRITE_LCD_TEXT		;sent 4 to the LCD
	MOV 	A,#'7'
        CALL	WRITE_LCD_TEXT		;sent 7 to the LCD
	MOV	A,#C1h           	
        CALL	LCD_COMMAND             ;change line
	MOV 	A,#'F'
        CALL    WRITE_LCD_TEXT		;sent letter "F" to the LCD
        MOV 	A,#'I'
        CALL    WRITE_LCD_TEXT		;sent letter "I" to the LCD
        MOV 	A,#'N'
        CALL    WRITE_LCD_TEXT		;sent letter "N" to the LCD
        MOV 	A,#'G'
        CALL    WRITE_LCD_TEXT		;sent letter "G" to the LCD
        MOV 	A,#'E'
        CALL    WRITE_LCD_TEXT		;sent letter "E" to the LCD
        MOV 	A,#'R'
        CALL    WRITE_LCD_TEXT		;sent letter "R" to the LCD
        MOV 	A,#'P'
        CALL    WRITE_LCD_TEXT		;sent letter "P" to the LCD
        MOV 	A,#'R'
        CALL    WRITE_LCD_TEXT		;sent letter "R" to the LCD
        MOV 	A,#'I'
        CALL    WRITE_LCD_TEXT		;sent letter "I" to the LCD
        MOV 	A,#'N'
        CALL    WRITE_LCD_TEXT		;sent letter "N" to the LCD
        MOV 	A,#'T'
        CALL    WRITE_LCD_TEXT		;sent letter "T" to the LCD
        MOV 	A,#' '
        CALL	WRITE_LCD_TEXT		;sent SPACE to the LCD
	MOV 	A,#'S'
        CALL	WRITE_LCD_TEXT		;sent letter "S" to the LCD
	MOV 	A,#'E'
        CALL	WRITE_LCD_TEXT		;sent letter "E" to the LCD
	MOV 	A,#'N'
        CALL	WRITE_LCD_TEXT		;sent letter "N" to the LCD
	MOV 	A,#'S'
        CALL	WRITE_LCD_TEXT		;sent letter "S" to the LCD
	MOV 	A,#'O'
        CALL	WRITE_LCD_TEXT		;sent letter "O" to the LCD
	MOV 	A,#'R'
        CALL	WRITE_LCD_TEXT		;sent letter "R" to the LCD
	RET
;==============================================================
LCD_COMMAND:
	CLR	P1.5			;RS low to indicate a command
	CLR	P1.6			;RW low to indicate write
	MOV	P0,A			;write command in ACC to data port
	SETB	P1.7
	NOP
	NOP	
	CLR	P1.7                    ;LATCH data onto LCD
	LCALL	WAIT_LCD
	RET 
;==============================================================
WRITE_LCD_TEXT:
	SETB	P1.5                    ;Data we are sending is a command so RS=0
	CLR	P1.6                    ;we are writing to LCD so RW=0
	MOV	P0,A
	SETB	P1.7
	NOP				;wait 4 cycles to give LCD time to process
	NOP
	CLR	P1.7                    ;LATCH data onto LCD
	LCALL	WAIT_LCD
	RET
;=============================================================
WAIT_LCD:
	CLR	P1.5
	SETB	P1.6
	SETB	P1.7
	MOV	P0,#0FFH
	MOV	A,P0
	JB	ACC.7,WAIT_LCD
	CLR	P1.7
	CLR	P1.6
	RET
;==============================================
; DELAY 1mS
;==============================================
DELAY:
	MOV	R6,#2
DL1:
	MOV	R7,#249
	DJNZ	R7,$
	DJNZ	R6,DL1
	RET
;==============================================
INFO:
	DB	00H,00H,00H,00H,00H
	DB	FEH,90H,90H,90H,80H		;F
	DB	00H,82H,FEH,82H,00H		;I
	DB	FEH,40H,30H,40H,FEH		;M
	DB	00H,00H,00H,00H,00H
	DB	E4H,A2H,A2H,A2H,9CH		;5
	DB	00H,42H,FEH,02H,00H		;1
	DB	00H,42H,FEH,02H,00H		;1
	DB	7CH,8AH,92H,A2H,7CH		;0
	DB	00H,00H,00H,00H,00H
	DB	F8H,04H,02H,04H,F8H		;V
	DB	00H,42H,FEH,02H,00H		;1
	DB	7CH,8AH,92H,A2H,7CH		;0
	DB	84H,82H,A2H,D2H,8CH		;3
	DB	00H,00H,00H,00H,00H
	DB	00H,00H,00H,00H,00H
;=================================================	
FIN:
	END
 



List of 77 messages in thread
TopicAuthorDate
Intel 8051 RS-232 Interface and fingerprint module !!            01/01/70 00:00      
   I want to see the packet            01/01/70 00:00      
   Comments            01/01/70 00:00      
      MTS-51 8051 Microcomputer Trainer            01/01/70 00:00      
         A what?            01/01/70 00:00      
            please help !!            01/01/70 00:00      
               Never wait until "it works"            01/01/70 00:00      
                  I do it            01/01/70 00:00      
                     RE: "must work to continue writing code"            01/01/70 00:00      
                     you got a very positive reply            01/01/70 00:00      
               You need to provide the information!            01/01/70 00:00      
               P2            01/01/70 00:00      
   that old?            01/01/70 00:00      
      No - not that old!            01/01/70 00:00      
         80C51RD+            01/01/70 00:00      
            But what about those displays??            01/01/70 00:00      
               7-Segment LED displays            01/01/70 00:00      
                  That raises further questions            01/01/70 00:00      
                     BCD to 7-segment decoder            01/01/70 00:00      
                        But still no answer - repeated identical values?            01/01/70 00:00      
                           DELAY            01/01/70 00:00      
                              And you're surprised that you miss characters?!            01/01/70 00:00      
                                 Yes you are right but            01/01/70 00:00      
                                    Think about it            01/01/70 00:00      
                                       too busy to think ?            01/01/70 00:00      
                                          Coding is the LAST thing you should do!            01/01/70 00:00      
   Interesting article about fingerprint recognition            01/01/70 00:00      
      Thank you very much            01/01/70 00:00      
         Nothing to do with nitgen            01/01/70 00:00      
            yes I have read...            01/01/70 00:00      
               Again,            01/01/70 00:00      
                  ok, I am listenig to you..            01/01/70 00:00      
                     Serial Comms            01/01/70 00:00      
                        Σας ευχαριστώ κύριε Αγγελή για την            01/01/70 00:00      
                           BEFORE you start coding...            01/01/70 00:00      
                           Thinking before coding            01/01/70 00:00      
   Thank you very much..            01/01/70 00:00      
      Standard byte-by-byte loop            01/01/70 00:00      
         is this ok ?            01/01/70 00:00      
            Table bytes comparison            01/01/70 00:00      
               Does 8051 has two DPTR ??            01/01/70 00:00      
                  Same DPTR if you don't have two            01/01/70 00:00      
                  Please crarify settings of board/device            01/01/70 00:00      
                     for the moment...            01/01/70 00:00      
                  WHY ON EARTH            01/01/70 00:00      
                     Yes I know what they are...            01/01/70 00:00      
                        Why even keep the received data in an array?            01/01/70 00:00      
                           Please read....            01/01/70 00:00      
                              I have - have you?            01/01/70 00:00      
                                 Yes please            01/01/70 00:00      
                                    you can't store in code memory            01/01/70 00:00      
   Is this code ok ??            01/01/70 00:00      
      Wrong focus for comments - and untested code            01/01/70 00:00      
         I have tested !!            01/01/70 00:00      
            do you have that much external RAM?            01/01/70 00:00      
            No. You think you have tested but not multiple turns            01/01/70 00:00      
            Experimenting with 8051 embedded            01/01/70 00:00      
               thank you...            01/01/70 00:00      
                  Here we are again....            01/01/70 00:00      
                     take a look !!            01/01/70 00:00      
                        Baudrate            01/01/70 00:00      
                           thanks            01/01/70 00:00      
                           yes, but better            01/01/70 00:00      
                              Question            01/01/70 00:00      
                                 difference between ORG 000H and ORG 113H            01/01/70 00:00      
                                    usually.....            01/01/70 00:00      
                                       Now do you understand...            01/01/70 00:00      
                                 ORG is not an instruction, it is ...            01/01/70 00:00      
                                    PLEASE SEE THIS AND HELP !!            01/01/70 00:00      
                                       Copied "END" without first reading what it meant?            01/01/70 00:00      
                                       step-by-step mode            01/01/70 00:00      
                                          thank you            01/01/70 00:00      
                                             Assembler way is difficult            01/01/70 00:00      
                                                Thank you.....            01/01/70 00:00      
                                                   Step through the examples            01/01/70 00:00      
                                                      Of course            01/01/70 00:00      
                                                         THANK YOU ALL            01/01/70 00:00      

Back to Subject List