⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hexdec-lcd.a51.lst

📁 Library for the 8051 microcontroller. such as math routine, hexBCD, LCD, Keyboard, I2C, Remote, Ke
💻 LST
📖 第 1 页 / 共 5 页
字号:
  174:
  175:				;Initializing of lcd (8 bit體)
  176:	    08			InitLCD:			CALL		LPause
								^
			  @@@@@ only allowed in CODE segment @@@@@

  177:	    08								CLR		lcdreg
									^
			  @@@@@ only allowed in CODE segment @@@@@

  178:	    08								CLR		lcdread
									^
			  @@@@@ only allowed in CODE segment @@@@@

  179:	    08								CLR		lcdenable
									^
			  @@@@@ only allowed in CODE segment @@@@@

  180:	    08								SETB		lcdenable			;enable H, t
									^
			  @@@@@ only allowed in CODE segment @@@@@

				hen L
  181:	    08								MOV		P2,#30H
									^
			  @@@@@ only allowed in CODE segment @@@@@

ASEM-51 V1.3                                         Copyright (c) 2002 by W.W. Heinz                                         PAGE 9



 Line  I  Addr  Code            Source


  182:	    08								CLR		lcdenable
									^
			  @@@@@ only allowed in CODE segment @@@@@

  183:	    08								CALL		Pause
									^
			  @@@@@ only allowed in CODE segment @@@@@

  184:	    08								SETB		lcdenable			;enable H, t
									^
			  @@@@@ only allowed in CODE segment @@@@@

				hen L
  185:	    08								MOV		P2,#30H
									^
			  @@@@@ only allowed in CODE segment @@@@@

  186:	    08								CLR		lcdenable
									^
			  @@@@@ only allowed in CODE segment @@@@@

  187:	    08								CALL		Pause
									^
			  @@@@@ only allowed in CODE segment @@@@@

  188:	    08								SETB		lcdenable			;enable H, t
									^
			  @@@@@ only allowed in CODE segment @@@@@

				hen L
  189:	    08								MOV		P2,#30H
									^
			  @@@@@ only allowed in CODE segment @@@@@

  190:	    08								CLR		lcdenable
									^
			  @@@@@ only allowed in CODE segment @@@@@

  191:	    08								CALL		Pause
									^
			  @@@@@ only allowed in CODE segment @@@@@

  192:	    08								MOV		A,#3CH
									^
			  @@@@@ only allowed in CODE segment @@@@@

  193:	    08								CALL		OutStatRegLCD
									^
			  @@@@@ only allowed in CODE segment @@@@@

  194:	    08								MOV		A,#08H
									^
			  @@@@@ only allowed in CODE segment @@@@@

  195:	    08								CALL		OutStatRegLCD

ASEM-51 V1.3                                        Copyright (c) 2002 by W.W. Heinz                                         PAGE 10



 Line  I  Addr  Code            Source

									^
			  @@@@@ only allowed in CODE segment @@@@@

  196:	    08								MOV		A,#01H
									^
			  @@@@@ only allowed in CODE segment @@@@@

  197:	    08								CALL		OutStatRegLCD
									^
			  @@@@@ only allowed in CODE segment @@@@@

  198:	    08								MOV		A,#06H
									^
			  @@@@@ only allowed in CODE segment @@@@@

  199:	    08								CALL		OutStatRegLCD
									^
			  @@@@@ only allowed in CODE segment @@@@@

  200:	    08								MOV		A,#0CH				;lcd "on dis
									^
			  @@@@@ only allowed in CODE segment @@@@@

				play"
  201:	    08								CALL		OutStatRegLCD
									^
			  @@@@@ only allowed in CODE segment @@@@@

  202:	    08								RET
									^
			  @@@@@ only allowed in CODE segment @@@@@

  203:
  204:
  205:				;Own char definitioning - definitions are in CHAR table at the ROM memory (program segment)
  206:				;at the end of the table you have to put byte 0 - this is the end of definition table
  207:				;at this version of lcd display you can define 10 your own characters
  208:				;please read the lcd's programming manual for details.
  209:	    08			DefChars:		CLR		A							;sta
							^
			  @@@@@ only allowed in CODE segment @@@@@

				rt address of CGRAM
  210:	    08								ORL		A,#40H					;cgr
									^
			  @@@@@ only allowed in CODE segment @@@@@

				am definition mode (b6=1)
  211:	    08								CALL		OutStatRegLCD
									^
			  @@@@@ only allowed in CODE segment @@@@@

  212:	    08								MOV		DPTR,#Char				;sta
									^
			  @@@@@ only allowed in CODE segment @@@@@


ASEM-51 V1.3                                        Copyright (c) 2002 by W.W. Heinz                                         PAGE 11



 Line  I  Addr  Code            Source

				rt address of definition to dptr
  213:	    08			DefChars1:		CLR		A
							^
			  @@@@@ only allowed in CODE segment @@@@@

  214:	    08								MOVC		A,@A+DPTR				;byt
									^
			  @@@@@ only allowed in CODE segment @@@@@

				e from def.table to acc.
  215:	    08								CJNE		A,#0,DefCharsSkip1	;is it the end of ta
									^
			  @@@@@ only allowed in CODE segment @@@@@

				ble?
  216:	    08								JMP		DefCharsSkip2
									^
			  @@@@@ only allowed in CODE segment @@@@@

  217:	    08			DefCharsSkip1:	CALL		OutLCD					;send a byte
						^
			  @@@@@ only allowed in CODE segment @@@@@

  218:	    08								INC		DPTR
									^
			  @@@@@ only allowed in CODE segment @@@@@

					;next position
  219:	    08								JMP		DefChars1
									^
			  @@@@@ only allowed in CODE segment @@@@@

  220:	    08			DefCharsSkip2:	MOV		A,#80H					;display mode
						^
			  @@@@@ only allowed in CODE segment @@@@@

  221:	    08								CALL		OutStatRegLCD
									^
			  @@@@@ only allowed in CODE segment @@@@@

  222:	    08								RET
									^
			  @@@@@ only allowed in CODE segment @@@@@

  223:
  224:
  225:				;Delays
  226:				;very short delay (about 2 ms)
  227:	    08			Pause:			MOV		R7,#10H
							^
			  @@@@@ only allowed in CODE segment @@@@@

  228:	    08								MOV		R6,#0FFH
									^
			  @@@@@ only allowed in CODE segment @@@@@


ASEM-51 V1.3                                        Copyright (c) 2002 by W.W. Heinz                                         PAGE 12



 Line  I  Addr  Code            Source

  229:	    08			Pause1:			DJNZ		R6,Pause1
							^
			  @@@@@ only allowed in CODE segment @@@@@

  230:	    08								DJNZ		R7,Pause1
									^
			  @@@@@ only allowed in CODE segment @@@@@

  231:	    08								RET
									^
			  @@@@@ only allowed in CODE segment @@@@@

  232:
  233:				;about a few seconds
  234:	    08			LongPause:		MOV		R5,#0FFH
							^
			  @@@@@ only allowed in CODE segment @@@@@

  235:	    08			LongPause1:		CALL		Pause
							^
			  @@@@@ only allowed in CODE segment @@@@@

  236:	    08								DJNZ		R5,LongPause1
									^
			  @@@@@ only allowed in CODE segment @@@@@

  237:	    08								RET
									^
			  @@@@@ only allowed in CODE segment @@@@@

  238:
  239:				;about one second
  240:	    08			LPause:			MOV		R5,#21
							^
			  @@@@@ only allowed in CODE segment @@@@@

  241:	    08			LPause1:			CALL		Pause
								^
			  @@@@@ only allowed in CODE segment @@@@@

  242:	    08								DJNZ		R5,LPause1
									^
			  @@@@@ only allowed in CODE segment @@@@@

  243:	    08								RET
									^
			  @@@@@ only allowed in CODE segment @@@@@

  244:
  245:				;Clear screen
  246:	    08			ClearLCD:		MOV		A,#ClrScr				;"clear screen" code
							^
			  @@@@@ only allowed in CODE segment @@@@@

  247:	    08								CALL		OutStatRegLCD
									^

ASEM-51 V1.3                                        Copyright (c) 2002 by W.W. Heinz                                         PAGE 13



 Line  I  Addr  Code            Source

			  @@@@@ only allowed in CODE segment @@@@@

  248:	    08								RET
									^
			  @@@@@ only allowed in CODE segment @@@@@

  249:
  250:
  251:				;display char on lcd
  252:				;R1 <- row number (0 - n)
  253:				;R2 <- column number (0 - n)
  254:				;R3 <- ascii char code (code of character from rom char.generator of lcd)
  255:	    08			PutCharOnLCD:	PUSH		ACC
						^
			  @@@@@ only allowed in CODE segment @@@@@

  256:	    08								MOV		A,R1
									^
			  @@@@@ only allowed in CODE segment @@@@@

					;save r1
  257:	    08								MOV		R7,A
									^
			  @@@@@ only allowed in CODE segment @@@@@

  258:	    08								CJNE		R1,#1,PutCharOn1		;is row=1?
									^
			  @@@@@ only allowed in CODE segment @@@@@

  259:	    08								MOV		A,#64
									^
			  @@@@@ only allowed in CODE segment @@@@@

					;yes,ddram start position=64
  260:	    08								JMP		PutCharOffset
									^
			  @@@@@ only allowed in CODE segment @@@@@

  261:	    08			PutCharOn1:		CJNE		R1,#2,PutCharOn2		;is row=2?
							^
			  @@@@@ only allowed in CODE segment @@@@@

  262:	    08								MOV		A,#20
									^
			  @@@@@ only allowed in CODE segment @@@@@

					;yes,ddram start pos.=20
  263:	    08								JMP		PutCharOffset
									^
			  @@@@@ only allowed in CODE segment @@@@@

  264:	    08			PutCharOn2:		CJNE		R1,#3,PutCharOn3		;is row=3?
							^
			  @@@@@ only allowed in CODE segment @@@@@

  265:	    08								MOV		A,#84

ASEM-51 V1.3                                        Copyright (c) 2002 by W.W. Heinz                                         PAGE 14



 Line  I  Addr  Code            Source

									^
			  @@@@@ only allowed in CODE segment @@@@@

					;yes,ddram start pos.=84
  266:	    08								AJMP		PutCharOffset
									^
			  @@@@@ only allowed in CODE segment @@@@@

  267:	    08			PutCharOn3:		CLR		A							;if
							^
			  @@@@@ only allowed in CODE segment @@@@@

				row=0 then ddram start pos.=0
  268:	    08			PutCharOffset:	ADD		A,R2						;offset for x coordi
						^
			  @@@@@ only allowed in CODE segment @@@@@

				n.
  269:	    08								ORL		A,#SetDDRam			 	;set
									^
			  @@@@@ only allowed in CODE segment @@@@@

				 ddram
  270:	    08								CALL		OutStatRegLCD
									^
			  @@@@@ only allowed in CODE segment @@@@@

  271:	    08			PutCharOffSkip:
  272:	    08								MOV		A,R3
									^
			  @@@@@ only allowed in CODE segment @@@@@

  273:	    08								CALL		OutLCD					;Out
									^
			  @@@@@ only allowed in CODE segment @@@@@

				 char on screen
  274:	    08								MOV		A,R7
									^
			  @@@@@ only allowed in CODE segment @@@@@

					;R1 recall
  275:	    08								MOV		R1,A
									^
			  @@@@@ only allowed in CODE segment @@@@@

  276:	    08								POP		ACC
									^
			  @@@@@ only allowed in CODE segment @@@@@

  277:	    08								RET
									^
			  @@@@@ only allowed in CODE segment @@@@@

  278:
  279:				;write a string from rom memory

ASEM-51 V1.3                                        Copyright (c) 2002 by W.W. Heinz                                         PAGE 15



 Line  I  Addr  Code            Source

  280:				;r1= row number
  281:				;r2=column number
  282:				;dptr=string address
  283:	    08			WriteCString:	CLR		A
						^
			  @@@@@ only allowed in CODE segment @@@@@

  284:	    08								MOVC		A,@A+DPTR				;cha
									^
			  @@@@@ only allowed in CODE segment @@@@@

				cter code from rom to acc.
  285:	    08								CJNE		A,#0,WriteCSkip1		;is it the e
									^
			  @@@@@ only allowed in CODE segment @@@@@

				nd of string
  286:	    08								RET
									^
			  @@@@@ only allowed in CODE segment @@@@@

  287:	    08			WriteCSkip1:	MOV		R3,A
						^
			  @@@@@ only allowed in CODE segment @@@@@

  288:	    08								CALL		PutCharOnLCD			;put char on
									^
			  @@@@@ only allowed in CODE segment @@@@@

				 lcd
  289:	    08								INC		R2
									^
			  @@@@@ only allowed in CODE segment @@@@@

						;next column
  290:	    08								CJNE		R2,#LCDLineLength,CStringSkip2	;is it max c
									^
			  @@@@@ only allowed in CODE segment @@@@@

				olumn?
  291:	    08								MOV		R2,#0
									^
			  @@@@@ only allowed in CODE segment @@@@@

					;yes,clear column number
  292:	    08								INC		R1
									^
			  @@@@@ only allowed in CODE segment @@@@@

						;next row
  293:	    08								CJNE		A,#LCDRowsNum,CStringSkip2	;is max row
									^
			  @@@@@ only allowed in CODE segment @@@@@

				number?
  294:	    08								MOV		R1,#0

ASEM-51 V1.3                                        Copyright (c) 2002 by W.W. Heinz                                         PAGE 16



 Line  I  Addr  Code            Source

									^
			  @@@@@ only allowed in CODE segment @@@@@

					;yes-clear row number

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -