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

📄 io_drv.c

📁 PLL的资料文档,包括资料
💻 C
字号:
/*C**************************************************************************
* NAME:         io_drv.c
*----------------------------------------------------------------------------
* Copyright (c) 2006 Atmel.
*----------------------------------------------------------------------------
* RELEASE:      C51 Sample      
* REVISION:     1.00     
*----------------------------------------------------------------------------
*
*****************************************************************************/
#include "system\reg51.h"
#include "system\compiler.h"
#include "system\config.h"
#include "driver\io_def.h"
#include "driver\kbd_drv.h"                      /* scheduler definition */

/*F**************************************************************************
* NAME: getByteLSB
*----------------------------------------------------------------------------
* PARAMS:
* 写入一个字节数据info
* return:
*----------------------------------------------------------------------------
* PURPOSE: 
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/

void getByteLSB(Byte bByte)
{
	Byte i; 

	for (i=0; i<8; i++) 
	{
		DTS_CLK = 0;
        if (bByte & 0x01) DTS_DOUT = 1;
        else DTS_DOUT = 0;
        bByte >>= 1;
      	DTS_CLK = 1;
	}
}

/*F**************************************************************************
* NAME: getByteLSB
*----------------------------------------------------------------------------
* PARAMS:
* 写入一个字节数据info
* return:
*----------------------------------------------------------------------------
* PURPOSE: 
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/

int dts_scanByte(void)
{
	Byte i; 
	char bByte= 11,temp;

	for (i=0; i<8; i++){
		DTS_CLK = Low;
       	if (DTS_DIN){
			temp = 0x80;
   			temp >>= i;
       		bByte |= temp;
			}
		DTS_CLK = High;
		}
	return (bByte);
}

/*F**************************************************************************
* NAME: HT1621_getMSB
*----------------------------------------------------------------------------
* PARAMS:
* 写入一个字节数据info
* return:
*----------------------------------------------------------------------------
* PURPOSE: 
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/

void HT1621_getMSB(Byte bByte)
{
	Byte i; 

	for (i=0; i<8; i++) 
	{
		LCD_RW = 0;
        if (bByte & 0x80) LCD_DA = 1;
        else LCD_DA = 0;
        bByte <<= 1;
      	LCD_RW = 1;
	}
}

/*F**************************************************************************
* NAME: HT1621_getLSB
*----------------------------------------------------------------------------
* PARAMS:
* 写入一个字节数据info
* return:
*----------------------------------------------------------------------------
* PURPOSE: 
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/

void HT1621_getLSB(Byte bByte)
{
	Byte i; 

	for (i=0; i<8; i++) 
	{
		LCD_RW = 0;
        if (bByte & 0x01) LCD_DA = 1;
        else LCD_DA = 0;
        bByte >>= 1;
      	LCD_RW = 1;
	}
}

⌨️ 快捷键说明

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