文章目錄
在main.c中添加下面的代碼
#include <stdio.h> // 包含頭文件
int fputc(int ch, FILE *f) //STM8 printf函數重定向
{
while ( (USART2->SR&0x80) == 0 );
USART2->DR = (uint8_t)ch;
return ch;
}
#include <stdio.h> // 包含頭文件
int fputc(int ch, FILE *f) //STM8 printf函數重定向
{
while ( (USART2->SR&0x80) == 0 );
USART2->DR = (uint8_t)ch;
return ch;
}
最近做了一款產品,使用STM8S003F3的片子,產品要求使用TIM2,在PD2引腳輸出PWM波形。 安裝了STM8專用版的IAR,下載了STM8的庫文件,新建了工程,開始編寫功能。 由於沒
C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.3\common\bin\IarIdePm.exe