[原创] 【基于KW41Z的智能电力监测仪的设计】第七贴:电力测量仪软件编程既测量仪调试篇

传媒学子   2017-7-22 01:18 楼主
【基于KW41Z的智能电力监测仪的设计】第七贴:电力测量仪软件编程既测量仪调试篇 由于本人对于操作系统不太熟悉, 处于学习阶段,因此这里直接采用bare-metal程序进行设计。请采用KDS3.2.0软件,按照提示新建一个空的带drivers的工程,然后添加或者修改如下文件即可。串口115200 8N1,显示程序根据自己的需要进行修改,显示屏具体资料可见我的《【基于KW41Z的智能电力监测仪的设计】第六贴:LCD显示设计篇》https://bbs.eeworld.com.cn/thread-545078-1-1.html;为了让大家能有兴趣,先介绍整机调试图,这里调试的是本项目的电力测量仪部分,下一贴就直接交作业了,就BLE 和 IEEE 802.15.4 测量节点通信进行接介绍。 1.电力测量仪调试 测量节点初始界面 402714873165510963.jpg 测量节点二级界面 427858328661498010.jpg 三级界面(三相不平衡度显示,图中为模拟数据) 367153385083471083.jpg 2.程序设计 电力测量仪采用NXP-KW41Z来驱动ADE7758,ADE7758.h中包含了底层驱动程序,采用的是I/0口模拟SPI协议的写法,主要是为了移植方便。
  1. /*
  2. * ADE7758.h
  3. *
  4. * Created on: 2017年7月19日
  5. * Author: zhujingjie
  6. */
  7. /*
  8. * Copyright (c) 2017, Janet ZHU.
  9. * All rights reserved.
  10. */
  11. #ifndef ADE7758_H_
  12. #define ADE7758_H_
  13. #include "board.h"
  14. #include "pin_mux.h"
  15. #include "clock_config.h"
  16. #include "LCD.h"
  17. //在pin_mux.c中开启端口使能,初始化端口
  18. #define CS_0 GPIO_WritePinOutput(GPIOB, 18U, 0)//CS
  19. #define CS_1 GPIO_WritePinOutput(GPIOB, 18U, 1)
  20. #define DIN_0 GPIO_WritePinOutput(GPIOB, 2U, 0)//DIN
  21. #define DIN_1 GPIO_WritePinOutput(GPIOB, 2U, 1)
  22. #define CLK_0 GPIO_WritePinOutput(GPIOB, 3U, 0)//CLK
  23. #define CLK_1 GPIO_WritePinOutput(GPIOB, 3U, 1)
  24. #define DOUT GPIO_ReadPinInput(GPIOB,1U) //DOUT
  25. #define Addr_AWATTHR 0x01 //A相有功电能
  26. #define Addr_BWATTHR 0x02 //B相
  27. #define Addr_CWATTHR 0x03 //C相
  28. #define Addr_AVARHR 0x04 //A相无功电能
  29. #define Addr_BVARHR 0x05 //B相
  30. #define Addr_CVARHR 0x06 //C相
  31. #define Addr_AVAHR 0x07 //A相视在电能
  32. #define Addr_BVAHR 0x08 //B相
  33. #define Addr_CVAHR 0x09 //C相
  34. #define Addr_AIRMS 0x0a //A相电流有效值
  35. #define Addr_BIRMS 0x0b //B相
  36. #define Addr_CIRMS 0x0c //C相
  37. #define Addr_AVRMS 0x0d //A相电压有效值
  38. #define Addr_BVRMS 0x0e //B相
  39. #define Addr_CVRMS 0x0f //C相
  40. #define Addr_FREQ 0x10
  41. #define Addr_TEMP 0x11 //片内温度
  42. #define Addr_WFORM 0x12 //波形寄存器 ,与WAVMODE相关
  43. #define Addr_OPMODE 0x13 //运行模式控制寄存器 都设定为0x00即可
  44. #define Addr_MMODE 0x14 //测量模式控制寄存器 只选择A B C三相
  45. #define Addr_WAVMODE 0x15 //波形模式选择寄存器
  46. #define Addr_COMPMODE 0x16 //计算方式 //设置输出脉冲累计的是单相还是三相
  47. #define Addr_LCYCMODE 0x17
  48. #define Addr_MASK 0x18
  49. #define Addr_STATUS 0x19
  50. #define Addr_RSTATUS 0x1a
  51. #define Addr_ZXTOUT 0x1b
  52. #define Addr_LINCYC 0x1c
  53. #define Addr_SAGCYC 0x1d
  54. #define Addr_SAGLVL 0x1e
  55. #define Addr_VPINTLVL 0x1f
  56. #define Addr_IPINTLVL 0x20
  57. #define Addr_VPEAK 0x21
  58. #define Addr_IPEAK 0x22
  59. #define Addr_GAIN 0x23
  60. #define Addr_AVRMSGAIN 0x24 //A相电压增益 线电压:两相之间 =1.732*相电压
  61. #define Addr_BVRMSGAIN 0x25 //B相电压增益 相电压:相 地 之间
  62. #define Addr_CVRMSGAIN 0x26 //C相电压增益
  63. #define Addr_AIGAIN 0x27 //A线电流增益 在星形接法中线电流=相电流
  64. #define Addr_BIGAIN 0x28 //B线电流增益 在三角形接法中线电流=1.730*相电流
  65. #define Addr_CIGAIN 0x29 //C线电流增益
  66. #define Addr_AWG 0x2a //A相有功功率增益寄存器
  67. #define Addr_BWG 0x2b //B相
  68. #define Addr_CWG 0x2c //C相
  69. #define Addr_AVARG 0x2d //A相无功功率增益寄存器
  70. #define Addr_BVARG 0x2e //B相
  71. #define Addr_CVARG 0x2f //C相
  72. #define Addr_AVAG 0x30 //A相视在功率增益寄存器
  73. #define Addr_BVAG 0x31 //B相
  74. #define Addr_CVAG 0x32 //C相
  75. #define Addr_AVRMSOS 0x33 //A相电压偏移量的补偿寄存器
  76. #define Addr_BVRMSOS 0x34 //B相
  77. #define Addr_CVRMSOS 0x35 //C相
  78. #define Addr_AIRMSOS 0x36 //A相电流偏移量的补偿寄存器
  79. #define Addr_BIRMSOS 0x37 //B相
  80. #define Addr_CIRMSOS 0x38 //C相
  81. #define Addr_AWATTOS 0x39 //A相有功功率偏移量的补偿寄存器
  82. #define Addr_BWATTOS 0x3a //B相
  83. #define Addr_CWATTOS 0x3b //C相
  84. #define Addr_AVAROS 0x3c //A相无功功率偏移量的补偿寄存器
  85. #define Addr_BVAROS 0x3d //B相
  86. #define Addr_CVAROS 0x3e //C相
  87. #define Addr_APHCAL 0x3f //A相相位寄存器
  88. #define Addr_BPHCAL 0x40 //B相相位寄存器
  89. #define Addr_CPHCAL 0x41 //C相相位寄存器
  90. #define Addr_WDIV 0x42 //有功电能寄存器除法位
  91. #define Addr_VARDIV 0x43 //无功电能寄存器除法位
  92. #define Addr_VADIV 0x44 //视在电能寄存器除法位
  93. #define Addr_APCFNUM 0x45
  94. #define Addr_APCFDEN 0x46
  95. #define Addr_VARCFNUM 0x47
  96. #define Addr_VARCFDEN 0x48
  97. #define Addr_CHKSUM 0x7e
  98. #define Addr_VERSION 0x7f
  99. unsigned int p_v[3]={100,100,199};
  100. unsigned long int A_V=220,B_V=0x33U,C_V=219;
  101. unsigned char show1 =0x1CU;
  102. unsigned char show2 =0x78U;
  103. unsigned char current_unbalance = 100;
  104. unsigned char voltage_unbalance = 100;
  105. //模拟三相不平衡度
  106. unsigned char current_unbalanceSimulate[256] = {
  107. 0x00,0x03,0x06,0x09,0x0c,0x0f,0x12,0x15,0x19,0x1c,0x1f,0x22,0x25,0x28,0x2b,0x2e,
  108. 0x31,0x34,0x38,0x3b,0x3e,0x41,0x44,0x47,0x4a,0x4d,0x50,0x53,0x56,0x59,0x5c,0x5f,
  109. 0x61,0x64,0x67,0x6a,0x6d,0x70,0x73,0x75,0x78,0x7b,0x7e,0x80,0x83,0x86,0x88,0x8b,
  110. 0x8e,0x90,0x93,0x95,0x98,0x9a,0x9d,0x9f,0xa2,0xa4,0xa7,0xa9,0xab,0xae,0xb0,0xb2,
  111. 0xb4,0xb7,0xb9,0xbb,0xbd,0xbf,0xc1,0xc3,0xc5,0xc7,0xc9,0xcb,0xcd,0xcf,0xd1,0xd3,
  112. 0xd4,0xd6,0xd8,0xd9,0xdb,0xdd,0xde,0xe0,0xe1,0xe3,0xe4,0xe5,0xe7,0xe8,0xe9,0xeb,
  113. 0xec,0xed,0xee,0xef,0xf0,0xf2,0xf3,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xf9,0xfa,
  114. 0xfb,0xfb,0xfc,0xfc,0xfd,0xfd,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  115. 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfe,0xfe,0xfd,0xfd,0xfc,0xfc,0xfb,
  116. 0xfb,0xfa,0xf9,0xf9,0xf8,0xf7,0xf6,0xf5,0xf5,0xf4,0xf3,0xf2,0xf1,0xf0,0xee,0xed,
  117. 0xec,0xeb,0xea,0xe8,0xe7,0xe6,0xe4,0xe3,0xe1,0xe0,0xde,0xdd,0xdb,0xda,0xd8,0xd6,
  118. 0xd5,0xd3,0xd1,0xcf,0xcd,0xcb,0xc9,0xc8,0xc6,0xc4,0xc2,0xbf,0xbd,0xbb,0xb9,0xb7,
  119. 0xb5,0xb3,0xb0,0xae,0xac,0xa9,0xa7,0xa5,0xa2,0xa0,0x9d,0x9b,0x98,0x96,0x93,0x91,
  120. 0x8e,0x8b,0x89,0x86,0x83,0x81,0x7e,0x7b,0x78,0x76,0x73,0x70,0x6d,0x6a,0x68,0x65,
  121. 0x62,0x5f,0x5c,0x59,0x56,0x53,0x50,0x4d,0x4a,0x47,0x44,0x41,0x3e,0x3b,0x38,0x35,
  122. 0x32,0x2f,0x2c,0x29,0x25,0x22,0x1f,0x1c,0x19,0x16,0x13,0x10,0x0c,0x09,0x06,0x03
  123. };
  124. void delay(unsigned int t1) //延时
  125. { unsigned int i,j;
  126. for(i=0;i<t1;i++);
  127. {
  128. for(j=0;j<200;j++);
  129. }
  130. }
  131. void write_byte(unsigned char indata)
  132. {
  133. unsigned char x,c;
  134. x=indata;
  135. CLK_0;//P2OUT &=~CLK; //P2.1
  136. for(c=0;c<8;c++)
  137. {
  138. if(x & 0x80) {DIN_1;}
  139. else {DIN_0;}
  140. CLK_1; //下降沿写数据
  141. CLK_0;
  142. x<<=1;
  143. }
  144. }
  145. unsigned char read_byte()
  146. {
  147. unsigned char data=0;
  148. //CS_0; 在read8中有
  149. CLK_0;CLK_1;delay(5); if(0x01&DOUT) {data+=128;} //上升沿读数据
  150. CLK_0;CLK_1;delay(5); if(0x01&DOUT) {data+=64;}
  151. CLK_0;CLK_1;delay(5); if(0x01&DOUT) {data+=32;}
  152. CLK_0;CLK_1;delay(5); if(0x01&DOUT) {data+=16;}
  153. CLK_0;CLK_1;delay(5); if(0x01&DOUT) {data+=8;}
  154. CLK_0;CLK_1;delay(5); if(0x01&DOUT) {data+=4;}
  155. CLK_0;CLK_1;delay(5); if(0x01&DOUT) {data+=2;}
  156. CLK_0;CLK_1;delay(5); if(0x01&DOUT) {data+=1;}
  157. //CS_1;
  158. return (data);
  159. }
  160. void write8_ADE7758(unsigned char addr,unsigned char data)
  161. {
  162. CLK_0;
  163. CS_0;
  164. addr=addr&0x7F;
  165. //addr=addr|0x80;
  166. addr+=0x80; //向寄存器中写时,要将地址值加上0x80
  167. write_byte(addr);//先写入地址
  168. delay(5);
  169. write_byte(data);//再写入数据
  170. CLK_0;
  171. CS_1;
  172. }
  173. void write16_ADE7758(unsigned char addr,unsigned int data)
  174. {
  175. CLK_0;
  176. CS_0;
  177. addr=addr&0x7F;
  178. addr=addr|0x80; //向寄存器中写时,要将地址值加上0x80
  179. write_byte(addr);//先写入地址
  180. delay(5);
  181. write_byte(data/256);//再写入数据高八位
  182. delay(5);
  183. write_byte(data%256);//再写入数据低八位
  184. CLK_0;
  185. CS_1;
  186. }
  187. void write24_ADE7758(unsigned char addr,unsigned long int data)
  188. {
  189. CLK_0;
  190. CS_0;
  191. addr=addr&0x7F;
  192. addr=addr|0x80; //向寄存器中写时,要将地址值加上0x80
  193. write_byte(addr);//先写入地址
  194. delay(5);
  195. write_byte(data/65536);//再写入数据高八位
  196. delay(5);
  197. write_byte((data%65536)/256);//再写入数据中八位
  198. delay(5);
  199. write_byte((data%65536)%256);//再写入数据低八位
  200. CLK_0;
  201. CS_1;
  202. }
  203. //***************************************************************
  204. unsigned char read8_ADE7758(unsigned char addr)
  205. {
  206. unsigned char data;
  207. CLK_0;
  208. CS_0;
  209. addr=addr&0x7F;//读取地址首位为0
  210. write_byte(addr);//先写入地址
  211. delay(5);
  212. data=read_byte();//读出数据
  213. CLK_0;
  214. CS_1;
  215. return(data);
  216. }
  217. unsigned int read16_ADE7758(unsigned char addr)
  218. {
  219. unsigned char data1,data2;
  220. CLK_0;
  221. CS_0;
  222. addr=addr&0x7F;
  223. write_byte(addr);//先写入地址
  224. delay(5);
  225. data1=read_byte();//读出高八位
  226. delay(5);
  227. data2=read_byte();//读出低八位
  228. CLK_0;
  229. CS_1;
  230. return(data1*256+data2);
  231. }
  232. unsigned long int read24_ADE7758(unsigned char addr)
  233. {
  234. unsigned char data1,data2,data3;
  235. CLK_0;
  236. CS_0;
  237. addr=addr&0x7F;
  238. write_byte(addr);//先写入地址
  239. delay(5);
  240. data1=read_byte();//读出高八位
  241. delay(5);
  242. data2=read_byte();//读出中八位
  243. delay(5);
  244. data3=read_byte();//读出低八位
  245. CLK_0;
  246. CS_1;
  247. return((unsigned long int)(data1*65536+data2*256+data3));
  248. }
  249. void ADE7758_Init()
  250. {
  251. /* Define the init structure for the ADE7758 controller's OUT and IN pin (for MCU) */
  252. gpio_pin_config_t ADE7758_config_OUT = { kGPIO_DigitalOutput, 1, };
  253. gpio_pin_config_t ADE7758_config_IN = { kGPIO_DigitalInput, 0, };
  254. /* Init output ADE7758 GPIO. */
  255. GPIO_PinInit(GPIOB, 18U, &ADE7758_config_OUT);
  256. GPIO_PinInit(GPIOB, 2U, &ADE7758_config_OUT);
  257. GPIO_PinInit(GPIOB, 3U, &ADE7758_config_OUT);
  258. GPIO_PinInit(GPIOB, 1U, &ADE7758_config_IN);
  259. //write8_ADE7758(Addr_OPMODE,0x40);//器件复位
  260. //Software Chip Reset. A data transfer to the ADE7758 should not take place for at least 166 μs after a software reset.
  261. write8_ADE7758(Addr_OPMODE,0x00);//使能输出脉冲
  262. write24_ADE7758(Addr_MASK,0x000007);//置位低三位 将标志写入中断寄存器 ,允许能量寄存器容量超出一半时产生中断
  263. }
  264. //************************************************ **************************
  265. void V_RMS() //三相四线 相电压
  266. {
  267. A_V=read24_ADE7758(Addr_AVRMS);
  268. B_V=read8_ADE7758(Addr_COMPMODE);
  269. C_V=read8_ADE7758(Addr_LCYCMODE);
  270. p_v[0]=(unsigned int)(0.5*A_V*1000/279701);//0.5V 50HZ 对应的是1678210
  271. //p_v[1]=B_V; p_v[2]=C_V;
  272. // p_v[1]=(unsigned int)(0.5*B_V*1000/1678210);
  273. // p_v[2]=(unsigned int)(0.5*C_V*1000/1678210);
  274. show_figure4(p_v[0]);
  275. //voltage_unbalance = max(p_v[1], p_v[2],p_v[3]) - min(p_v[1], p_v[2],p_v[3])/max(p_v[1], p_v[2],p_v[3]) ;
  276. //show_curve(voltage_unbalance);
  277. }
  278. #endif /* ADE7758_H_*/
需要修改pin_mux.c
  1. /* Copyright (c) 2015, Freescale Semiconductor, Inc.*/
  2. #include "fsl_common.h"
  3. #include "fsl_port.h"
  4. #include "pin_mux.h"
  5. /*******************************************************************************
  6. * Code
  7. ******************************************************************************/
  8. void BOARD_InitPins(void)
  9. {
  10. /* Initialize LPUART0 pins below */
  11. /* Ungate the port clock */
  12. CLOCK_EnableClock(kCLOCK_PortC);
  13. CLOCK_EnableClock(kCLOCK_PortA);
  14. CLOCK_EnableClock(kCLOCK_PortB);
  15. port_pin_config_t config0;
  16. config0.pullSelect = kPORT_PullUp;
  17. config0.mux = kPORT_MuxAlt4;
  18. PORT_SetPinConfig(PORTC, 6U, &config0);
  19. PORT_SetPinConfig(PORTC, 7U, &config0);
  20. /* Affects PORTC_PCR4 register *///输入
  21. port_pin_config_t config;
  22. config.pullSelect = kPORT_PullUp;
  23. config.mux = kPORT_MuxAsGpio;
  24. PORT_SetPinConfig(PORTC, 4U, &config); //PTC4设置为上拉
  25. // port_pin_config_t config1;
  26. // config1.pullSelect = kPORT_PullDisable;
  27. // config1.mux = kPORT_MuxAsGpio;
  28. /* LED PIN_MUX Configuration */ //输出
  29. PORT_SetPinMux(PORTC, 1U, kPORT_MuxAsGpio);
  30. PORT_SetPinMux(PORTA, 19U, kPORT_MuxAsGpio);
  31. PORT_SetPinMux(PORTB, 0U, kPORT_MuxAsGpio);
  32. //设置上拉
  33. PORT_SetPinConfig(PORTB, 18U, &config); //PTC19 //由于杜邦线的接口不匹配,造成接触不良,使得调试遇阻
  34. PORT_SetPinConfig(PORTB, 2U, &config); //PTC16 //由此得到一个教训,以后必须选用合适的接插口进行设计
  35. PORT_SetPinConfig(PORTB, 3U, &config); //PTC3 //必须买合格的产品
  36. PORT_SetPinConfig(PORTB, 1U, &config); //PTC2 //最后发现应当是9V电池电量不足。。。
  37. //设为I/O
  38. PORT_SetPinMux(PORTB, 18U, kPORT_MuxAsGpio); //CS
  39. PORT_SetPinMux(PORTB, 2U, kPORT_MuxAsGpio); //DOUT SO -- MI
  40. PORT_SetPinMux(PORTB, 3U, kPORT_MuxAsGpio); //CLK
  41. PORT_SetPinMux(PORTB, 1U, kPORT_MuxAsGpio); //DIN SI -- MO
  42. }
main.c 主函数如下:
  1. /**
  2. * This is template for main module created by New Kinetis SDK 2.x Project Wizard. Enjoy!
  3. **/
  4. #include "fsl_debug_console.h"
  5. #include "fsl_port.h"
  6. #include "fsl_gpio.h"
  7. #include "fsl_common.h"
  8. #include "board.h"
  9. #include "pin_mux.h"
  10. #include "clock_config.h"
  11. #include "ADE7758.h"
  12. #include "LCD.h"
  13. /*******************************************************************************
  14. * Definitions
  15. ******************************************************************************/
  16. //#define BOARD_LED_GPIO BOARD_LED_RED_GPIO
  17. //#define BOARD_LED_GPIO_PIN BOARD_LED_RED_GPIO_PIN
  18. #define BOARD_LED_GPIO BOARD_LED_GREEN_GPIO
  19. #define BOARD_LED_GPIO_PIN BOARD_LED_GREEN_GPIO_PIN
  20. #define BOARD_SW_GPIO BOARD_SW3_GPIO
  21. #define BOARD_SW_PORT BOARD_SW3_PORT
  22. #define BOARD_SW_GPIO_PIN BOARD_SW3_GPIO_PIN
  23. #define BOARD_SW_IRQ BOARD_SW3_IRQ
  24. #define BOARD_SW_IRQ_HANDLER BOARD_SW3_IRQ_HANDLER
  25. #define BOARD_SW_NAME BOARD_SW3_NAME
  26. unsigned int i=0;
  27. /*******************************************************************************
  28. * Prototypes
  29. ******************************************************************************/
  30. /*******************************************************************************
  31. * Variables
  32. ******************************************************************************/
  33. /* Whether the SW button is pressed */
  34. volatile bool g_ButtonPress = false;
  35. /*******************************************************************************
  36. * Code
  37. ******************************************************************************/
  38. /*!
  39. * [url=home.php?mod=space&uid=159083]@brief[/url] Interrupt service fuction of switch.
  40. *
  41. * This function toggles the LED
  42. */
  43. void BOARD_SW_IRQ_HANDLER(void)
  44. {
  45. /* Clear external interrupt flag. */
  46. GPIO_ClearPinsInterruptFlags(BOARD_SW_GPIO, 1U << BOARD_SW_GPIO_PIN);//1右移四位0x10
  47. /* Change state of button. */
  48. g_ButtonPress = true;
  49. /* Toggle LED. */
  50. GPIO_TogglePinsOutput(BOARD_LED_GPIO, 1U << BOARD_LED_GPIO_PIN);
  51. // GPIO_TogglePinsOutput(BOARD_LED3_GPIO, 1U << BOARD_LED3_GPIO_PIN);
  52. GPIO_WritePinOutput(GPIOB, 0U, 0);
  53. }
  54. /*!
  55. * @brief Main function
  56. */
  57. int main(void)
  58. {
  59. //配置结构体 设置输入,输出(输入/输出,输出1或者0),当在输入状态下,输出没有效果
  60. /* Define the init structure for the input or output pin */
  61. gpio_pin_config_t sw_config = { kGPIO_DigitalInput, 0, };
  62. gpio_pin_config_t led_config = { kGPIO_DigitalOutput, 0, };
  63. gpio_pin_config_t led3_config = { kGPIO_DigitalOutput, 1, };
  64. BOARD_InitPins();
  65. BOARD_BootClockRUN();
  66. BOARD_InitDebugConsole();
  67. /* Print a note to terminal. */
  68. PRINTF("\r\n GPIO Driver example\r\n");
  69. PRINTF("\r\n Press %s to turn on/off a LED \r\n", BOARD_SW_NAME);
  70. /* Init input switch GPIO. */
  71. PORT_SetPinInterruptConfig(BOARD_SW_PORT, BOARD_SW_GPIO_PIN, kPORT_InterruptFallingEdge);
  72. EnableIRQ(BOARD_SW_IRQ);
  73. GPIO_PinInit(BOARD_SW_GPIO, BOARD_SW_GPIO_PIN, &sw_config);
  74. /* Init output LED GPIO. */
  75. GPIO_PinInit(BOARD_LED_GPIO, BOARD_LED_GPIO_PIN, &led_config);
  76. GPIO_PinInit(BOARD_LED3_GPIO, BOARD_LED3_GPIO_PIN, &led3_config);
  77. ADE7758_Init();
  78. while (1)
  79. {
  80. for( i = 0; i <= 255; i = i + 4 )
  81. {
  82. current_unbalanceSimulate[i] = current_unbalanceSimulate - i/3;[/i]
  83. [i] show_curve(current_unbalanceSimulate[/i][i]);
  84. }
  85. [/i] //show_curve(current_unbalance);
  86. if (g_ButtonPress)
  87. {
  88. /*show1=read8_ADE7758(0x16);//0X1C
  89. show2=read8_ADE7758(0x17);//0X78
  90. PRINTF(" %02X", show1); PRINTF(" %02X", show2);
  91. PUTCHAR(0xff);PUTCHAR(0xff); PUTCHAR(0xff);
  92. PRINTF("t7.txt="211.7V"");
  93. PUTCHAR(0xff);PUTCHAR(0xff); PUTCHAR(0xff);
  94. PRINTF("t8.txt=");
  95. PUTCHAR(0x22);
  96. PRINTF(" %02X", show1);
  97. PUTCHAR(0x22);
  98. PUTCHAR(0xff);PUTCHAR(0xff); PUTCHAR(0xff);
  99. PRINTF("t9.txt=");
  100. PUTCHAR(0x22);
  101. PRINTF(" %02d", show2);
  102. PUTCHAR(0x22);
  103. PUTCHAR(0xff);PUTCHAR(0xff); PUTCHAR(0xff);*/
  104. V_RMS();
  105. PRINTF("\r\n");
  106. g_ButtonPress = false;
  107. }
  108. }
  109. }
3.调试感悟 经过近一个多月的努力,学习到了很多东西,感觉自己本科四年,硕士三年都白上了。在电子领域,学校教的东西已经无法用落后来形容了,本科阶段教授一些基础性东西,尚可理解,但硕士阶段就真的很不理解了。 虽然,电赛也拿了好名次,但当时做的都是模拟电路设计(放大电路设计),可当我接触FPGA,接触arm,接触NXP单片机时,以及高层次嵌入式编程时,真的受到了巨大的打击。 且不说,我们能否造出这款单片机,就是好的东西给我用,我都要自学很长时间。我很佩服TI,ADI,NXP等公司,这些公司真的了不起,不仅能设计芯片,还能推出适配与这款芯片的整个开发链工具。 对于我个人,通过这个比赛,发现自己什么都不会,什么都不懂,我觉得自己必须要踏实学习了,在工作中学习,不断自学,才能适应这个社会,才能胜任自己的工作,才能养家糊口,生活下去。 感谢EEWORLD论坛,nmg管理员和NXP,以及我自己,让我能够在职业生涯开始之时,清醒的认识到未来的坎坷,我将怀着敬畏之心去探索,去适应,奋斗为了明天更美好! 好了,侨情的话不多说,直接上视频,晚上照的不清,大家多多见谅。 测试视频: ------------------------------------------------------------------------- 此内容由EEWORLD论坛网友传媒学子原创,如需转载或用于商业用途需征得作者同意并注明出处 本帖最后由 传媒学子 于 2017-7-22 01:23 编辑

回复评论 (2)

牛X!
点赞  2017-7-22 19:52
厉害,老师把板子扔给我们这些学生学习,真的感谢这个论坛上的大神,正是因为有你们的贴子我们才能慢慢入门
点赞  2017-7-25 16:11
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复