在线时间1 小时
UID110416
ST金币0
蝴蝶豆0
注册时间2009-2-18
初级会员
- 最后登录
- 1970-1-1
|
a0a.1 0b0c
本人刚接触单片机,现在想用自带蜂鸣器的功能,附件是我的代码,请各位帮我看看,谢谢!
错误提示:clnk -l"C:\Program Files\COSMIC\CXSTM8\Lib" -o Debug\led.sm8 -mDebug\led.map Debug\led.lkf
#error clnk Debug\led.lkf:1 symbol _FLASH_Unlock not defined (Debug\main.o )
#error clnk Debug\led.lkf:1 symbol _FLASH_ReadOptionByte not defined (Debug\main.o )
#error clnk Debug\led.lkf:1 symbol _FLASH_ProgramOptionByte not defined (Debug\main.o )
#error clnk Debug\led.lkf:1 symbol _FLASH_DeInit not defined (Debug\main.o )
#error clnk Debug\led.lkf:1 symbol _BEEP_Init not defined (Debug\main.o )
#error clnk Debug\led.lkf:1 symbol _BEEP_Cmd not defined (Debug\main.o )
#error clnk Debug\led.lkf:1 symbol _BEEP_LSICalibrationConfig not defined (Debug\main.o )
#error clnk Debug\led.lkf:1 symbol _FLASH_SetProgrammingTime not defined (Debug\main.o )
The command: "clnk -l"C:\Program Files\COSMIC\CXSTM8\Lib" -o Debug\led.sm8 -mDebug\led.map Debug\led.lkf " has failed, the returned value is: 1
exit code=1.
led.elf - 10 error(s), 0 warning(s)
代码部分:
//头文件
#include "stm8s.h"
#include "stm8s105C6.h"
#include "stm8s_beep.h"
#include "stm8s_flash.h"
#include "stm8s_clk.h"
#include "stm8s_gpio.h"
#define BEEP_PORT GPIOD
#define BEEP_PIN GPIO_PIN_4
//注意,使用本程序前需要使用
//st visual programmer 把 Option Bytes里
//AFR7改为"ort D4 Alternate Function = Beep" ,否则没有声音
//由于新增了在程序里修改AFR7改为"ort D4 Alternate Function =Beep" //Fcpu = 4MHz/1 = 4MHz
//函数声明
void delay_ms(u16 time)
{
u16 i;
for(;time>0;time--)
for(i=0;iCR = 0x80;//复位stm8
} //BEEP_LSICalibrationConfig(128000);
BEEP_LSICalibrationConfig(95000); //此处修改输入参数**************************************************
//BEEP_Init(BEEP_Frequency_TypeDef BEEP_Frequency);
BEEP_Init(BEEP_FREQUENCY_2KHZ);
BEEP_Cmd(ENABLE);
while(1)
{
//delay(1000);
delay_ms(500);
BEEP_Cmd(ENABLE);
//delay(1000);
delay_ms(500);
BEEP_Cmd(DISABLE);
}
}
|
-
-
92.94 KB, 下载次数: 15, 下载积分: ST金币 -1
|