Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] problem with IAR code

Status
Not open for further replies.

Mr.eyni

Newbie level 5
Joined
Jan 12, 2014
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,333
Hello
I 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.
--- Updated ---

Hello
I 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.
it is very short code and the error occurs in the last line
and microcontroller modell is STM8S003F3
--- Updated ---

this is the code and error is in line 52
--- Updated ---

this is the code and error is in line 52


Code:
#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();


    
}
 

Attachments

  • 2.zip
    612.7 KB · Views: 81
Last edited:

Is it a guessing game? You don't even mention the error message.

Also, why are declaring .rar files as .zip?

I guess, it's a simple fault. UART1_SendData8() is expecting uint8 argument, "A" is a string, you probably want to write 'A' instead.
 

Is it a guessing game? You don't even mention the error message.

Also, why are declaring .rar files as .zip?

I guess, it's a simple fault. UART1_SendData8() is expecting uint8 argument, "A" is a string, you probably want to write 'A' instead.
thanks for your help. the problem solved.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top