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

📄 busio.src

📁 采用台湾MRT晶捷公司的MRT4方案的液晶电视的程序
💻 SRC
📖 第 1 页 / 共 5 页
字号:
			; SOURCE LINE # 162
	MOV  	R7,byteCnt?249+01H
	LCALL	_RcvI2CByte
	MOV  	R0,#s?247
	CLR  	A
	MOV  	B,#01H
	LCALL	?C?PLDIIDATA
	MOV  	A,R7
	LCALL	?C?CSTPTR
; 	}
			; SOURCE LINE # 163
	MOV  	A,byteCnt?249+01H
	DEC  	byteCnt?249+01H
	JNZ  	?C0119
	DEC  	byteCnt?249
?C0119:
	SJMP 	?C0016
; 	
; endi2c:
			; SOURCE LINE # 165
?_RegDataIn?endi2c:
; 	/* Finish transmition */
; 	SendI2CStop();
			; SOURCE LINE # 167
	LCALL	SendI2CStop
; #endif
; 
; #if USE_SPIBUS
; 	/* Start SPI and set to WRITE mode */
;    SPIStart(SPI_WRITE);
; 	if(BusFault) goto buserror;
; 
; 	/* Send comm */
; 	SendSPIByte(READ_AUTOINC);
; 
; 	/* Send index */
; 	SendSPIByte(index);
; 
; 	/* Stop SPI bus temperally */
;    SPIStop();
; 
; 	/* Start SPI and set to READ mode */
;    SPIStart(SPI_READ);
; 	if(BusFault) goto buserror;
; 
; 	/* data transmit */
; 	for(byteCnt = cnt; byteCnt > 0; byteCnt--) {
; 		*s++ = RcvSPIByte();
; 	}
; 	
; buserror:
; 	/* Finish the transmition */
;    SPIStop();
; #endif
; 
; #if USE_PARALBUS
; 	/* Send comm */
; 	PARALPORT = READ_AUTOINC;
; 
; 	/* Send index */
; 	PARALPORT = index;
; 
; 	/* data transmit */
; 	for(byteCnt = cnt; byteCnt > 0; byteCnt--) {
; 		*s++ = PARALPORT;
; 	}
; #endif
; 
; #if DISABLEINT0
; 	/* restove interrupt 0 flag */
; 	EX0 =	IntFlag;
			; SOURCE LINE # 213
	MOV  	C,IntFlag?250
	MOV  	EX0,C
; #endif
;     return;
; 
; buserror:
			; SOURCE LINE # 217
; #if DEBUGMSG
;    printf("    BUS error (RegDataIn) !!!!\n");
; #endif   
;     goto endi2c;
			; SOURCE LINE # 221
; }
			; SOURCE LINE # 222
?C0020:
	RET  	
; END OF _RegDataIn

; 
; /**********************************************
; * Write byte of data to MOSAIC regs           *
; ***********************************************/
; void RegByteOut(unsigned char index, unsigned char val)

	RSEG  ?PR?_RegByteOut?BUSIO
	USING	0
_RegByteOut:
	MOV  	index?351,R7
	MOV  	val?352,R5
			; SOURCE LINE # 227
; {
			; SOURCE LINE # 228
; #if DISABLEINT0
; 	bit IntFlag;
; 
; 	/* disable interrupt 0 */
; 	IntFlag = EX0;
			; SOURCE LINE # 233
	MOV  	C,EX0
	MOV  	IntFlag?353,C
; 	EX0 = 0;
			; SOURCE LINE # 234
	CLR  	EX0
; #endif
; 
; #if USE_I2CBUS
; 	/* I2C Start and send slave address */
;  	GoI2CMaster(SLAVEADDR_REGW);
			; SOURCE LINE # 239
	MOV  	R7,#030H
	LCALL	_GoI2CMaster
; 	if (NoAck | BusFault) goto buserror;
			; SOURCE LINE # 240
	MOV  	C,BusFault
	ORL  	C,NoAck
	JC   	?_RegByteOut?endi2c
?C0021:
; 
; 	/* Send comm */
; 	SendI2CByte(WRITE_BYTE);
			; SOURCE LINE # 243
	CLR  	A
	MOV  	R7,A
	LCALL	_SendI2CByte
; 	if (NoAck) goto buserror;
			; SOURCE LINE # 244
	JB   	NoAck,?_RegByteOut?endi2c
?C0023:
; 
; 	/* Send index */
; 	SendI2CByte(index);
			; SOURCE LINE # 247
	MOV  	R7,index?351
	LCALL	_SendI2CByte
; 	if (NoAck) goto buserror;
			; SOURCE LINE # 248
	JB   	NoAck,?_RegByteOut?endi2c
?C0024:
; 
; 	/* data transmit */
; 	SendI2CByte(val);
			; SOURCE LINE # 251
	MOV  	R7,val?352
	LCALL	_SendI2CByte
;  
; endi2c:
			; SOURCE LINE # 253
?_RegByteOut?endi2c:
; 	/* Finish transmition */
; 	SendI2CStop();
			; SOURCE LINE # 255
	LCALL	SendI2CStop
; #endif
; 
; #if USE_SPIBUS
; 	/* Start SPI and set to WRITE mode */
;    SPIStart(SPI_WRITE);
; 	if(BusFault) goto buserror;
; 
; 	/* Send comm */
; 	SendSPIByte(WRITE_BYTE);
; 
; 	/* Send index */
; 	SendSPIByte(index);
; 
; 	/* data transmit */
; 	SendSPIByte(val);
; 	
; buserror:
; 	/* Finish the transmition */
;    SPIStop();
; #endif
; 
; #if USE_PARALBUS
; 	/* Send comm */
; 	PARALPORT = WRITE_BYTE;
; 
; 	/* Send index */
; 	PARALPORT = index;
; 
; 	/* data transmit */
; 	PARALPORT = val;
; #endif
; 
; #if DISABLEINT0
; 	/* restove interrupt 0 flag */
; 	EX0 =	IntFlag;
			; SOURCE LINE # 290
	MOV  	C,IntFlag?353
	MOV  	EX0,C
; #endif
;     return;
; 
; buserror:
			; SOURCE LINE # 294
; #if DEBUGMSG
;    printf("    BUS error (RegByteOut) !!!!\n");
; #endif   
;     goto endi2c;
			; SOURCE LINE # 298
; }
			; SOURCE LINE # 299
?C0026:
	RET  	
; END OF _RegByteOut

; 
; #if 1 //ENABLE_TCON
; /**********************************************
; * Write byte of data to MOSAIC regs           *
; ***********************************************/
; void RegWordOut(unsigned char index, unsigned int val)

	RSEG  ?PR?_RegWordOut?BUSIO
	USING	0
_RegWordOut:
;---- Variable 'index?454' assigned to Register 'R3' ----
	XCH  	A,R3
	MOV  	A,R7
	XCH  	A,R3
;---- Variable 'val?455' assigned to Register 'R4/R5' ----
			; SOURCE LINE # 305
; {
			; SOURCE LINE # 306
;     unsigned char b[2];
; 
;     b[0] = val;
			; SOURCE LINE # 309
	XCH  	A,R7
	MOV  	A,R5
	XCH  	A,R7
	MOV  	b?456,R7
;     b[1] = val>>8;
			; SOURCE LINE # 310
	MOV  	A,R4
	MOV  	b?456+01H,A
;     RegDataOut(index, b, 2);
			; SOURCE LINE # 311
	XCH  	A,R7
	MOV  	A,R3
	XCH  	A,R7
	MOV  	R3,#00H
	MOV  	R2,#HIGH (b?456)
	MOV  	R1,#LOW (b?456)
	MOV  	?_RegDataOut?BYTE+04H,#00H
	MOV  	?_RegDataOut?BYTE+05H,#02H
	LCALL	_RegDataOut
; }
			; SOURCE LINE # 312
	RET  	
; END OF _RegWordOut

; #endif
; 
; /**********************************************
; * Write bit(s) of data to MOSAIC reg          *
; ***********************************************/
; void RegBitOut(unsigned char index, unsigned char val, unsigned char mask)

	RSEG  ?PR?_RegBitOut?BUSIO
	USING	0
_RegBitOut:
	MOV  	index?557,R7
	MOV  	val?558,R5
	MOV  	mask?559,R3
			; SOURCE LINE # 318
; {
			; SOURCE LINE # 319
; 	unsigned char b;
; 	
;     b = RegByteIn(index);
			; SOURCE LINE # 322
	LCALL	_RegByteIn
;---- Variable 'b?560' assigned to Register 'R5' ----
	XCH  	A,R5
	MOV  	A,R7
	XCH  	A,R5
; 	b = (b & ~mask) | val;
			; SOURCE LINE # 323
	MOV  	A,mask?559
	CPL  	A
	ANL  	A,R5
	ORL  	A,val?558
	MOV  	R5,A
; 	RegByteOut(index, b);
			; SOURCE LINE # 324
	MOV  	R7,index?557
	LCALL	_RegByteOut
; }
			; SOURCE LINE # 325
	RET  	
; END OF _RegBitOut

; 
; /**********************************************
; * Write bytes of data to MOSAIC regs          *
; ***********************************************/
; void RegDataOut(unsigned char index, unsigned char *s, int cnt)

	RSEG  ?PR?_RegDataOut?BUSIO
	USING	0
_RegDataOut:
	MOV  	index?661,R7
	MOV  	s?662,R3
	MOV  	s?662+01H,R2
	MOV  	s?662+02H,R1
			; SOURCE LINE # 330
; {
			; SOURCE LINE # 331
; 	int data byteCnt;
; 
; #if DISABLEINT0
; 	bit IntFlag;
; 
; 	/* disable interrupt 0 */
; 	IntFlag = EX0;
			; SOURCE LINE # 338
	MOV  	C,EX0
	MOV  	IntFlag?665,C
; 	EX0 = 0;
			; SOURCE LINE # 339
	CLR  	EX0
; #endif
; 
; #if USE_I2CBUS
; 	/* I2C Start and send slave address */
;  	GoI2CMaster(SLAVEADDR_REGW);
			; SOURCE LINE # 344
	MOV  	R7,#030H
	LCALL	_GoI2CMaster
; 	if (NoAck | BusFault) goto buserror;
			; SOURCE LINE # 345
	MOV  	C,BusFault
	ORL  	C,NoAck
	JC   	?_RegDataOut?endi2c
?C0029:
; 
; 	/* Send comm */
; 	SendI2CByte(WRITE_AUTOINC);
			; SOURCE LINE # 348
	MOV  	R7,#040H
	LCALL	_SendI2CByte
; 	if (NoAck) goto buserror;
			; SOURCE LINE # 349
	JB   	NoAck,?_RegDataOut?endi2c
?C0031:
; 
; 	/* Send index */
; 	SendI2CByte(index);
			; SOURCE LINE # 352
	MOV  	R7,index?661
	LCALL	_SendI2CByte
; 	if (NoAck) goto buserror;
			; SOURCE LINE # 353
	JB   	NoAck,?_RegDataOut?endi2c
?C0032:
; 
; 	/* data transmit */
; 	for(byteCnt = cnt; byteCnt > 0; byteCnt--) {
			; SOURCE LINE # 356
	MOV  	byteCnt?664,cnt?663
	MOV  	byteCnt?664+01H,cnt?663+01H
?C0033:
	SETB 	C
	MOV  	A,byteCnt?664+01H
	SUBB 	A,#00H
	MOV  	A,byteCnt?664
	XRL  	A,#080H
	SUBB 	A,#080H
	JC   	?_RegDataOut?endi2c
; 		SendI2CByte(*s++);
			; SOURCE LINE # 357
	MOV  	R0,#s?662
	CLR  	A
	MOV  	B,#01H
	LCALL	?C?PLDIIDATA
	LCALL	?C?CLDPTR
	MOV  	R7,A
	LCALL	_SendI2CByte
; 		if (NoAck) goto buserror;
			; SOURCE LINE # 358
	JB   	NoAck,?_RegDataOut?endi2c
; 	}
			; SOURCE LINE # 359
?C0035:
	MOV  	A,byteCnt?664+01H
	DEC  	byteCnt?664+01H
	JNZ  	?C0120
	DEC  	byteCnt?664
?C0120:
	SJMP 	?C0033
; 
; endi2c:   
			; SOURCE LINE # 361
?_RegDataOut?endi2c:
; 	/* Finish transmition */
; 	SendI2CStop();
			; SOURCE LINE # 363
	LCALL	SendI2CStop
; #endif
; 
; #if USE_SPIBUS
; 	/* Start SPI and set to WRITE mode */
;    SPIStart(SPI_WRITE);
; 	if(BusFault) goto buserror;
; 
; 	/* Send comm */
; 	SendSPIByte(WRITE_AUTOINC);
; 
; 	/* Send index */
; 	SendSPIByte(index);
; 
; 	/* data transmit */
; 	for(byteCnt = cnt; byteCnt > 0; byteCnt--) {
; 		SendSPIByte(*s++);
; 	}
; 	
; buserror:
; 	/* Finish transmition */
;    SPIStop();
; #endif
; 
; #if USE_PARALBUS
; 	/* Send comm */
; 	PARALPORT = WRITE_AUTOINC;
; 
; 	/* Send index */
; 	PARALPORT = index;
; 
; 	/* data transmit */
; 	for(byteCnt = cnt; byteCnt > 0; byteCnt--) {
; 		PARALPORT = *s++;
; 	}
; #endif
; 
; #if DISABLEINT0
; 	/* restove interrupt 0 flag */
; 	EX0 =	IntFlag;
			; SOURCE LINE # 402
	MOV  	C,IntFlag?665
	MOV  	EX0,C
; #endif
;     return;
; 
; buserror:
			; SOURCE LINE # 406
; #if DEBUGMSG
;     printf("    BUS error (RegDataOut) !!!!\n");
; #endif
; 	goto endi2c;
			; SOURCE LINE # 410
; }
			; SOURCE LINE # 411
?C0038:
	RET  	
; END OF _RegDataOut

; 
; #if ENABLE_TCON
; void TconByteOut(unsigned char index, unsigned char val)

	RSEG  ?PR?_TconByteOut?BUSIO
	USING	0
_TconByteOut:
	MOV  	index?766,R7
	MOV  	val?767,R5
			; SOURCE LINE # 414
; {
			; SOURCE LINE # 415
;     RegByteOut(0xC0, 0x20);
			; SOURCE LINE # 416
	MOV  	R7,#0C0H
	MOV  	R5,#020H
	LCALL	_RegByteOut
;     RegByteOut(index, val);
			; SOURCE LINE # 417
	MOV  	R7,index?766
	MOV  	R5,val?767
	LCALL	_RegByteOut
;     RegByteOut(0xC0, 0x00);
			; SOURCE LINE # 418
	MOV  	R7,#0C0H
	CLR  	A
	MOV  	R5,A
	LCALL	_RegByteOut
; }
			; SOURCE LINE # 419
	RET  	
; END OF _TconByteOut

; #endif 
; 
; /*********************************************
; * Send bytes of data to an MOSAIC device     *
; **********************************************/
; void PortDataOut(unsigned char index, unsigned char c0, unsigned char *s, int cnt)

	RSEG  ?PR?_PortDataOut?BUSIO
	USING	0
_PortDataOut:
	MOV  	index?868,R7
	MOV  	c0?869,R5
	MOV  	s?870,R3
	MOV  	s?870+01H,R2
	MOV  	s?870+02H,R1
			; SOURCE LINE # 425
; {
			; SOURCE LINE # 426
; 	int data byteCnt;
; 
; #if DISABLEINT0
; 	bit IntFlag;
; 
; 	/* disable interrupt 0 */
; 	IntFlag = EX0;
			; SOURCE LINE # 433
	MOV  	C,EX0
	MOV  	IntFlag?873,C
; 	EX0 = 0;
			; SOURCE LINE # 434
	CLR  	EX0
; #endif
; 
; 
; #if USE_I2CBUS
; 	/* ---- I2C Start and send slave address for C0 ---- */
;  	GoI2CMaster(SLAVEADDR_REGW);
			; SOURCE LINE # 440
	MOV  	R7,#030H
	LCALL	_GoI2CMaster
; 	if(NoAck | BusFault) goto buserror;
			; SOURCE LINE # 441
	MOV  	C,BusFault
	ORL  	C,NoAck
	JNC  	$ + 5H
	LJMP 	?_PortDataOut?endi2c
?C0040:
; 
; 	/* Send command */
; 	SendI2CByte(WRITE_BYTE);
			; SOURCE LINE # 444
	CLR  	A
	MOV  	R7,A
	LCALL	_SendI2CByte
; 	if(NoAck) goto buserror;
			; SOURCE LINE # 445
	JNB  	NoAck,$ + 6H
	LJMP 	?_PortDataOut?endi2c
?C0042:
; 
; 	/* Send C0 */
; 	SendI2CByte(0xC0);
			; SOURCE LINE # 448
	MOV  	R7,#0C0H
	LCALL	_SendI2CByte
; 	if(NoAck) goto buserror;
			; SOURCE LINE # 449
	JNB  	NoAck,$ + 6H
	LJMP 	?_PortDataOut?endi2c
?C0043:
; 
; 	/* Send the contest of C0 */
; 	SendI2CByte(c0);
			; SOURCE LINE # 452
	MOV  	R7,c0?869
	LCALL	_SendI2CByte
; 	if(NoAck) goto buserror;
			; SOURCE LINE # 453
	JB   	NoAck,?_PortDataOut?endi2c
?C0044:
; 
; 	SendI2CStop();
			; SOURCE LINE # 455
	LCALL	SendI2CStop
; 	/* ------------- Finish C0 -------------- */
; 
; 	/* ---- I2C Start and send slave address for C1 ---- */
;  	GoI2CMaster(SLAVEADDR_REGW);
			; SOURCE LINE # 459
	MOV  	R7,#030H
	LCALL	_GoI2CMaster
; 	if(NoAck | BusFault) goto buserror;
			; SOURCE LINE # 460
	MOV  	C,BusFault
	ORL  	C,NoAck
	JC   	?_PortDataOut?endi2c
?C0045:

⌨️ 快捷键说明

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