mcutofpga.c

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

C
43
字号
#include <at89x52.H>
#include "mcutofpga.h"
sbit EN = P2^7;
sbit McuData = P2^6;
sbit McuClk = P2^5;

 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;
}

⌨️ 快捷键说明

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