STMS005K6T6 如何采集内部参考电压。
stm8s003 adc中断和通道切换的问题
adc施密特触发器stm8
stm8l051f3 TSSOP20 封装,待机模式下,2天后,电流突然增加到140UA
STM8S用STVP烧录怎么加密?
如何使用ST官网例程_LIN总线通讯_STM8AF
STM8 LIN
IAR代码编辑太费劲了,想问一下有没有好的方法,试了VScode但是头文件老是报错,调了很久也没调好,想换个方法了。
想问一下各位大佬,IAR下载调试代码时出现 warning: is an illegal data sample expression IAR是什么意思啊?
STM8S标准库TIM1编码器功能不计数,请大师帮我看看
没有复位脚
评分
查看全部评分
1.檢查板子上的電源是否正常。
2.再確認SWIM的腳PIN有無接錯。
3.重新Power Off 再 Power On板子上的電源。
4.ST Link重PC上先拔除再連接。
以上, FYI。
/* MAIN.C file */
#include "stm8l10x.h"
#include "stm8l101_eval.h"
#include "stm8l10x_gpio.h"
#ifdef _COSMIC_
#define ASM _asm
#endif
#ifdef _IAR_
#define ASM asm
#endif
/* This delay should be added just after reset to have access to SWIM pin
and to be able to reprogram the device after power on (otherwise the
device will be locked) */
#define STARTUP_SWIM_DELAY_5S \
{ \
ASM(" PUSHW X \n" \
" PUSH A \n" \
" LDW X, #0xFFFF \n" \
"loop1: LD A, #50 \n" \
\
"loop2: DEC A \n" \
" JRNE loop2 \n" \
\
" DECW X \n" \
" JRNE loop1 \n" \
\
" POP A \n" \
" POPW X " );\
}
/* not connected pins as output low state (the best EMC immunity)
(PA1, PA3, PA5, PB0, PB1, PB2, PB4, PC5, PC6, PD1, PD2, PD3, PD4, PD5,
PD6, PD7)*/
#define CONFIG_UNUSED_PINS_STM8L001 \
{ \
GPIOA->DDR |= GPIO_Pin_1 | GPIO_Pin_3 | GPIO_Pin_5; \
GPIOB->DDR |= GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_4; \
GPIOC->DDR |= GPIO_Pin_5 | GPIO_Pin_6; \
GPIOD->DDR |= GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | \
GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7; \
}
/* not connected pins as output low state (the best EMC immunity)
(PA1, PA3, PA5, PB0, PB1, PB2, PB4, PC5, PC6, PD1, PD2, PD3, PD4, PD5,
PD6, PD7)*/
#define CONFIG_UNUSED_PINS_STM8L001 \
{ \
GPIOA->DDR |= GPIO_Pin_1 | GPIO_Pin_3 | GPIO_Pin_5; \
GPIOB->DDR |= GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_4; \
GPIOC->DDR |= GPIO_Pin_5 | GPIO_Pin_6; \
GPIOD->DDR |= GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | \
GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7; \
}
main()
{
/* -------------STM8L001 startup-------------- */
/* configure unbonded pins */
CONFIG_UNUSED_PINS_STM8L001;
/* delay for SWIM connection: ~5seconds */
STARTUP_SWIM_DELAY_5S;
/* ------------------------------------------- */
/* configure all STM8L001 pins as input with pull up */
GPIO_Init(GPIOA, GPIO_Pin_0, GPIO_Mode_In_PU_No_IT); // pin 1
GPIO_Init(GPIOA, GPIO_Pin_2, GPIO_Mode_In_PU_No_IT); // pin 2
GPIO_Init(GPIOD, GPIO_Pin_0, GPIO_Mode_In_PU_No_IT); // pin 5
GPIO_Init(GPIOB, GPIO_Pin_6, GPIO_Mode_In_PU_No_IT); // pin 6
GPIO_Init(GPIOB, GPIO_Pin_7, GPIO_Mode_In_PU_No_IT); // pin 7
GPIO_Init(GPIOC, GPIO_Pin_2, GPIO_Mode_In_PU_No_IT); // pin 8
}