標(biāo)題: FDC2214的STM32單片機(jī)和K60源程序 OLED顯示 [打印本頁]

作者: lzh6868    時(shí)間: 2018-7-15 11:55
標(biāo)題: FDC2214的STM32單片機(jī)和K60源程序 OLED顯示
電賽FDC2214程序,原理圖包含STM32和K60
全部資料51hei下載地址:
FDC2214_K60測試代碼IAR8_1.zip (9.8 MB, 下載次數(shù): 98)
FDC2214-1.1原理圖.pdf (11.01 KB, 下載次數(shù): 51)
FDC2214_STM32OLED.rar (305.87 KB, 下載次數(shù): 133)

STM32單片機(jī)源程序如下:
  1. #include "sys.h"
  2. #include "delay.h"
  3. #include "usart.h"
  4. #include "timer.h"
  5. #include "led.h"
  6. #include "oled.h"
  7. #include "fdc2214.h"
  8. #include "McuDataSend.h"

  9. void Sys_Init(void);

  10. float res0,res1,res2,res3;
  11. float temp0,temp1,temp2,temp3;
  12. int main(void)
  13. {
  14.   Sys_Init();
  15.         while(1)
  16.         {
  17.                 Oled_Printf_Float(0,1,res0-temp0,0);
  18.                 Oled_Printf_Float(0,3,res1-temp1,0);
  19.                 Oled_Printf_Float(0,5,res2-temp2,0);
  20.                 Oled_Printf_Float(0,7,res3-temp3,0);
  21.                 printf("CH0;%3.3f CH1;%3.3f CH2;%3.3f CH3;%3.3f\r\n",res0-temp0,res1-temp1,res2-temp2,res3-temp3);
  22.                 while(USART_GetFlagStatus(USART1,USART_FLAG_TC)==RESET);
  23. //                delay_ms(20);
  24.         }
  25. }

  26. void Sys_Init(void)
  27. {
  28.         delay_init();                     //延時(shí)函數(shù)初始化          
  29.         NVIC_Configuration();//設(shè)置NVIC中斷分組2:2;2位搶占優(yōu)先級,2位響應(yīng)優(yōu)先級
  30.         uart_init(115200);         //串口初始化為115200
  31.         LED_Init();
  32.         OLED_Init();
  33.         while(FDC2214_Init());
  34.         led=0;
  35.         delay_ms(100);
  36.         temp0 = Cap_Calculate(0);//讀取初始值
  37.         temp1 = Cap_Calculate(1);
  38.         temp2 = Cap_Calculate(2);
  39.         temp3 = Cap_Calculate(3);
  40.         TIM5_Ctrl_Init(2000-1,720-1);
  41. }

  42. //定時(shí)器5中斷服務(wù)程序
  43. void TIM5_IRQHandler(void)   //TIM5中斷
  44. {
  45.         if(TIM5->SR&0X0001)//20ms定時(shí)中斷
  46. {
  47.         res0 = Cap_Calculate(0);//采集數(shù)據(jù)
  48.         res1 = Cap_Calculate(1);
  49.         res2 = Cap_Calculate(2);
  50.         res3 = Cap_Calculate(3);
  51. //        Data_Send_Status(res,0,0);
  52. //        printf("%5d : %5d : %5d\r\n",res0,res1,res2);
  53.          led=~led;
  54. }
  55. TIM5->SR&=~(1<<0);  //中斷標(biāo)志位清0,等待下一次中斷
  56. }
復(fù)制代碼



作者: 大神最牛逼    時(shí)間: 2018-7-18 14:49
我吧除了sda、scl外其他線都接地,可是數(shù)據(jù)一直是128,這是怎么回事,求解答?
作者: 失心戀2015    時(shí)間: 2018-7-21 01:16
大神最牛逼 發(fā)表于 2018-7-18 14:49
我吧除了sda、scl外其他線都接地,可是數(shù)據(jù)一直是128,這是怎么回事,求解答?

我和你一樣,,,你現(xiàn)在搞出來了嗎

作者: 夢里人    時(shí)間: 2018-7-21 11:01
失心戀2015 發(fā)表于 2018-7-21 01:16
我和你一樣,,,你現(xiàn)在搞出來了嗎

這個(gè)程序里面OLED上的6個(gè)引腳應(yīng)該分別怎么接線呀
作者: 1311638554    時(shí)間: 2018-7-21 17:35
有沒有MSP430的程序?
作者: hahaqinyou    時(shí)間: 2018-7-22 17:55
看看各位大神

作者: suee    時(shí)間: 2019-8-7 19:38
謝謝大佬
作者: 阿峰丶    時(shí)間: 2019-8-7 19:48
代碼能用嗎
作者: RKs    時(shí)間: 2019-8-8 13:05
k66的程序有嗎?





歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1