📄 main.c
字号:
/**********************************************************************************
程序说明:本程序完成人形机器人脚掌传感系统的采样,并通过串口将数据传出
作者:xiaocai_cqu
开始时间:2008/10/9
完成时间:
**********************************************************************************/
#include <stm32f10x_lib.h> /* STM32F10x Library Definitions */
#include <stdio.h>
/* Import functions from Setup.c */
extern void SetupClock (void);
extern void SetupADC (void);
extern void SetupUART (void);
extern int SendChar(int ch);
//extern void lcd_init (void);
//extern void lcd_clear (void);
//extern void lcd_putchar (char c);
//extern void set_cursor (int column, int line);
//extern void lcd_print (char *string);
//extern void lcd_bargraph (int pos_x, int pos_y, int value);;
extern unsigned short int ADC_ConvertedValue[16];
extern unsigned char Clock1s;
int main (void)
{
int i,temp16;
char temp8;
SetupClock();//设置系统时钟
SetupADC ();//设置ADC
SetupUART ();
/* Loop forever */
while (1)
{
if(Clock1s) //每一秒发送一次数据,调试用
{
Clock1s=0;
for(i=0;i<16;i++)
{
temp16=ADC_ConvertedValue[i];
temp16=temp16>>8;
temp8=(char)temp16;
SendChar(temp8);
temp8=(char)(ADC_ConvertedValue[i]&0x00FF);
SendChar(temp8);
//SendChar(ADC_ConvertedValue[i]);
//printf("%04X\r\n", ADC_ConvertedValue[i]);
}
if(i==16)i=0;//复位通道
}
}
/* Printf message with AD value to serial port every 1 second */
// if (Clock1s)
// {
// Clock1s = 0;
// printf("AD value = 0x%04X\r\n", AD_value);
// }
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -