d58a5fc2f80153c528a1fc7846c0c9cb
前面测试了adc,以及实现了标准输出打印,我们就可以通过串口打印adc的值, Pc端通过上位机可视化实现虚拟示波器的功能。 这里上位机使用的是SerialPlot
代码如下,其他adc的代码见前面adc的测试
- void main(void)
- {
- uart_init(0,115200);
- Global_Interrupt_En(0x00000008ul);
- xdev_out(xprintf_out);
- xprintf("HelloWorld\r\n");
- adc_init();
- while (1)
- {
- shell_set_itf(shell_read, shell_write, (shell_cmd_cfg*)g_shell_cmd_list_ast, 1);
- while(1){
- shell_exec();
- //cordic_test();
- xprintf("%d\r\n",AD_GetValue(ADC_Channel_0));
- //xprintf("%d\r\n",Get_Temperature());
- cf_delay_ms(1);
- }
- }
- }
复制代码
详见视频
|