HelloI wrote a program in IAR. The program has an error when executing the following line.
UART1_SendData8("A");
The complete program file is available below.I would be grateful if you could tell me the mistakes of my code.
2.zip
#include "stm8s.h" #include "stm8s_gpio.c" #include "stm8s_uart1.h" #include "stm8s_uart1.c" #include "stm8s_clk.h" #include "stm8s_gpio.h" #include "stm8s_conf.h" #include "stm8s_clk.c" void Clk_Config(void){ CLK_DeInit(); CLK_HSECmd(ENABLE); CLK_ClockSwitchConfig(CLK_SWITCHMODE_AUTO,CLK_SOURCE_HSE,DISABLE,CLK_CURRENTCLOCKSTATE_DISABLE); CLK_SYSCLKConfig(CLK_PRESCALER_CPUDIV1); CLK_ClockSecuritySystemEnable(); CLK_PeripheralClockConfig(CLK_PERIPHERAL_UART1,ENABLE); } void UART1_setup(void) { UART1_DeInit(); UART1_Init(9600, UART1_WORDLENGTH_8D, UART1_STOPBITS_1, UART1_PARITY_NO, UART1_SYNCMODE_CLOCK_DISABLE, UART1_MODE_TXRX_ENABLE); UART1_Cmd(ENABLE); UART1_ITConfig(UART1_IT_RXNE_OR, ENABLE); } int main( void ) { char var; Clk_Config(); UART1_setup(); GPIO_DeInit(GPIOD); GPIO_Init(GPIOD, GPIO_PIN_5, GPIO_MODE_OUT_PP_HIGH_FAST); GPIO_Init(GPIOD, GPIO_PIN_6, GPIO_MODE_IN_PU_NO_IT); enableInterrupts(); UART1_SendData8("A"); var = UART1_ReceiveData8(); }
the error occurs in line 52 and error massage is : Error while running C/C++ Compiler
Hi STP,
Thanks for your post in Arm forum but as you are using the compiler from IAR, I would suggest you contact IAR.
Kind regards
Toshi