久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费
標(biāo)題:
Msp430f5529跟FDC2214源碼與資料下載
[打印本頁(yè)]
作者:
1106998808
時(shí)間:
2018-7-21 12:57
標(biāo)題:
Msp430f5529跟FDC2214源碼與資料下載
例程跟2018ti杯d題
全部資料51hei下載地址:
FDC2214_F5529_Good程序.rar
(66.03 KB, 下載次數(shù): 70)
2018-7-21 12:56 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
MSP430F5529 TI官方開(kāi)發(fā)板的實(shí)例程序(非常好).rar
(611.21 KB, 下載次數(shù): 56)
2018-7-21 12:56 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
0.png
(7.47 KB, 下載次數(shù): 63)
下載附件
2018-7-21 18:45 上傳
Msp430f5529單片機(jī)驅(qū)動(dòng)fdc2214的源碼:
#include <msp430F5529.h>
#include "IIC_Soft.h"
#include "FDC2214.h"
#include "delay.h"
#define uint8_t unsigned char
#define UCA1_OS 1 // 1 = oversampling mode, 0 = low-freq mode
#define UCA1_BR0 17 // Value of UCA1BR0 register
#define UCA1_BR1 0 // Value of UCA1BR1 register
#define UCA1_BRS 0 // Value of UCBRS field in UCA1MCTL register
#define UCA1_BRF 6 // Value of UCBRF field in UCA1MCTL register
void bcUartSend(uint8_t * buf, uint8_t len);
void delay_ms(unsigned int count);
void UartSend(uint8_t * buf);
void sys_clk_config(void);
void uart_config(void);
unsigned char HexToChar(unsigned char bHex);
/*
* main.c
*/
int main(void) {
unsigned long ch0_value = 0;
unsigned char dat[8]=0;
WDTCTL = WDTPW + WDTHOLD;
sys_clk_config();
uart_config();
__bis_SR_register(GIE);
FDC2214_Init();
// __bis_SR_register(LPM0_bits + GIE); // Enter LPM0, interrupts enabled
// __no_operation(); // For debugger
while(1)
{
ch0_value = FDC2214_GetResult(0); //讀取通道0,發(fā)送到串口,轉(zhuǎn)為字符型方便觀察。
UartSend("Ch0_value is:");
dat[0] = (unsigned char)(((ch0_value>>24)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>24)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>16)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>16)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>8)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>8)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>0)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>0)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
UartSend("\n");delay_ms(100);
ch0_value = FDC2214_GetResult(1);
UartSend("Ch1_value is:");
dat[0] = (unsigned char)(((ch0_value>>24)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>24)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>16)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>16)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>8)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>8)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>0)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>0)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
UartSend("\n");delay_ms(100);
ch0_value = FDC2214_GetResult(2);
UartSend("Ch2_value is:");
dat[0] = (unsigned char)(((ch0_value>>24)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>24)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>16)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>16)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>8)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>8)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>0)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>0)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
UartSend("\n");delay_ms(100);
ch0_value = FDC2214_GetResult(3);
UartSend("Ch3_value is:");
dat[0] = (unsigned char)(((ch0_value>>24)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>24)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>16)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>16)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>8)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>8)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>0)>>4)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
dat[0] = (unsigned char)(((ch0_value>>0)>>0)&0X0F);
dat[0] = HexToChar(dat[0]);
Uart_Send_Char(dat[0]);
UartSend("\n");delay_ms(100);
UartSend("\n"); //換行,延時(shí),方便觀察數(shù)據(jù)
delay_ms(10000);delay_ms(10000);
}
// return 0;
}
/************USCI_A1中斷*************/
#pragma vector=USCI_A1_VECTOR
__interrupt void USCI_A1_ISR(void)
{ switch(__even_in_range(UCA1IV,4))
{
case 0:break;
case 2:
while (!(UCA1IFG&UCTXIFG));
UCA1TXBUF = UCA1RXBUF; // 將接收到的數(shù)據(jù)發(fā)送出去
break;
case 4:break;
default: break;
}
}
// Sends 'len' bytes, starting at 'buf'
void bcUartSend(uint8_t * buf, uint8_t len)
{
uint8_t i = 0;
// Write each byte in buf to USCI TX buffer, which sends it out
while (i < len)
{
UCA1TXBUF = *(buf+(i++));
// while (!(UCA1IFG&UCTXIFG));
// delay_ms(20);
// Wait until each bit has been clocked out...
while(!(UCTXIFG==(UCTXIFG & UCA1IFG))&&((UCA1STAT & UCBUSY)==UCBUSY));
}
}
void UartSend(uint8_t * buf)
{
while(*buf !='\0')
{
while (!(UCA1IFG&UCTXIFG));
UCA1TXBUF=*buf;
*buf++;
delay_ms(2);
}
}
void Uart_Send_Char(uint8_t dat)
{
while (!(UCA1IFG&UCTXIFG));
UCA1TXBUF=dat;
}
void delay_ms(unsigned int count)
{
unsigned int i,j;
for(i=0;i<count;i++)
for(j=0;j<10;j++)
delay_us();
}
void sys_clk_config(void) //外部晶振4M
{
P5SEL |= BIT2|BIT3;
UCSCTL6 &= ~XT2OFF;
UCSCTL4 = UCSCTL4&(~(SELA_7))|SELA_1;
UCSCTL3 |= SELREF_2;
while (SFRIFG1 & OFIFG)
{
UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG);
SFRIFG1 &= ~OFIFG;
}
UCSCTL4 = UCSCTL4&(~(SELS_7|SELM_7))|SELS_5|SELM_5;
}
void uart_config(void)
{
P4SEL |= BIT4+BIT5;
UCA1CTL1 |= UCSWRST;
UCA1CTL1 |= UCSSEL_2;
UCA1BR0 = 34;//115200,外部4M
UCA1BR1 = 0;
UCA1MCTL |= UCBRS_6+UCBRF_0;
UCA1CTL1 &= ~UCSWRST;
UCA1IE |= UCRXIE;
}
unsigned char HexToChar(unsigned char bHex)
{
if((bHex>=0)&&(bHex<=9))
{
bHex += 0x30;
}
else if((bHex>=10)&&(bHex<=15))//Capital
{
bHex += 0x37;
}
else
{
bHex = 0xff;
}
return bHex;
}
復(fù)制代碼
作者:
從何說(shuō)起
時(shí)間:
2018-7-22 00:32
232021045.248是什么。。。
歡迎光臨 (http://www.zg4o1577.cn/bbs/)
Powered by Discuz! X3.1
主站蜘蛛池模板:
一级a性色生活片久久毛片波多野
|
99久久久久久
|
91在线资源
|
国产一区二区三区
|
中国一级大黄大片
|
日韩精品专区在线影院重磅
|
国产精品美女www爽爽爽视频
|
黄色一级毛片免费看
|
国产精品毛片一区二区三区
|
久久亚洲精品久久国产一区二区
|
欧美专区在线
|
中文字幕国产精品
|
久久久精品视频免费看
|
久久久久国产一区二区三区四区
|
男女羞羞视频在线
|
成人h视频在线
|
欧美精品一区二区三区四区 在线
|
欧美 日韩 中文
|
三级成人在线
|
亚洲欧美日韩久久
|
精品国产一区二区三区四区在线
|
久久蜜桃av一区二区天堂
|
欧美一级久久精品
|
请别相信他免费喜剧电影在线观看
|
性一爱一乱一交一视频
|
9色网站
|
精品国产精品国产偷麻豆
|
电影91久久久
|
亚洲在线中文字幕
|
国产免费看
|
人成久久
|
国产一区二区在线免费观看
|
农夫在线精品视频免费观看
|
超碰人人91
|
日一区二区
|
国产精品亚洲视频
|
中文字幕视频在线免费
|
国产精品一区二区三
|
成人二区
|
久久精品免费一区二区三
|
国产露脸对白88av
|