单片机解密LPC2148的ADC多通道数据采集程序
- 单片机解密#include "config.h"
- 单片机解密#include "stdio.h"
- 单片机解密#define GPIOSET(PIN) IO0SET = PIN // 方便修改置位端口
- 单片机解密#define GPIOCLR(PIN) IO0CLR = PIN // 方便修改清位端口
- #define LCD_CON 0x00000250 // 液晶显示控制字
- #define E_CLK (1<<4) //clock input 同步时钟输入端 P0.4
- const uint32 RW_SID= (1<<6); //data input/output 串行数据输入、输出端 P0.6
- const uint32 CS = (1<<9); //P0.9
- unsigned char IC_DAT1[] = "多通道数据采集系统";
- /*************************************************************
- * 名称:delay()
- * 功能:延时程序
- **************************************************************/
- void delay(uint32 dly)
- {
- uint32 i;
-
- for ( ; dly>0; dly--)
- for (i=0; i<10; i++);
- }
-
- /******************************************************************
- * 名称:SeddByte()
- * 功能:发送1字节数据
- *******************************************************************/
- void SendByte(uint8 data)
- {
- uint8 i;
- IO0SET=CS;
- for(i=0;i<8;i++)
- {
- IO0CLR=E_CLK ;delay(5);
- if(data&0x80)
- {
- IO0SET=RW_SID;delay(5);
- }
- else IO0CLR=RW_SID;
- {
- IO0SET=E_CLK;delay(5);
- }
- data=data<<1;
- }
- IO0CLR=CS;
- }
-
- /******************************************************************
- * 名称:ReceieveByte()
- * 功能:接收1字节数据
- *******************************************************************/
- unsigned char ReceieveByte(void)
- {
- uint8 i,d1,d2;
- for(i=0;i<8;i++)
- {
- IO0CLR=E_CLK;delay(5);
- IO0SET=E_CLK;delay(5);
- if(RW_SID)d1++;
- d1=d1<<1;
- }
- for(i=0;i<8;i++)
- {
- IO0CLR=E_CLK;delay(5);
- IO0SET=E_CLK;delay(5);
- if(RW_SID)d2++;
- d2=d2<<1;
- }
- return (d1&0xF0+d2&0x0F);
- }
上一篇:单片机解密嵌入式微处理器选型

芯片解密