mcutofpga.h

来自「msp430驱动340*240程序 包括显示图片 文字 以及一些改变字体颜色功能」· C头文件 代码 · 共 47 行

H
47
字号
#include <AT89X52.H>
#ifndef _MCUTOFPGA_H
#define _MCUTOFPGA_H

sbit EN = P2^1;
sbit McuData = P2^0;
sbit McuClk = P2^2;

 void Delay50us(unsigned char count)
 {
   unsigned char i,j;
   for(i=0;i<count;i++)
      for(j=0;j<6;j++);
 }

void InitialMcu()
{
	EN=0;
	McuClk=1;
	McuData=0;
}

void SentByte(unsigned int x,unsigned char count)
{
	unsigned char i;
	for(i=0;i<count;i++)
	{
		McuClk = 0;
 		McuData = (x&(0x01<<i)) ? 1:0;
		Delay50us(1);
		McuClk =1;
		Delay50us(1);
	}
}

void sentData(unsigned int freq,unsigned int phase)
{
	EN=1;
	Delay50us(1);

	SentByte(freq,15);
	SentByte(phase,9);	
	Delay50us(1);
	EN=0;
}
#endif

⌨️ 快捷键说明

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