UART2 RX TX initialization-how to use?
Hello, I have problem with initialization UART2 in my project(STM8S105). Below you can see part of my code, what am i doing wrong?
I'm trying to send sign to LCD display.
Code:
void UART2_Cmd(FunctionalState ENABLE);
void UART2_InitGPS()
{
UART2_DeInit();
UART2_Init( (u32)9600, UART2_WORDLENGTH_8D, UART2_STOPBITS_1, UART2_PARITY_NO, UART2_SYNCMODE_CLOCK_DISABLE, UART2_MODE_TXRX_ENABLE);
}
void UART2_SendData8(u8 Data);
u8 UART2_ReceiveData8(void);
void main(void)
{
char tmp;
LCD5110_init(); //function which initialize LCD
LCD5110_set_XY(0,0); //function which set rows and columns in LCD
UART2_SendData8(36);//
UART2_ReceiveData8();
tmp = UART2_ReceiveData8();
LCD5110_write_char(tmp); //function which send characters to LCD
}
I have to mention that i have no errors after compiling code and if I use function like this everything works fine(but I need UART to racive data from GPS and send it to LCD) :
Code:
void main(void)
{
char tmp=33; //33 -> "!" sign in my matrix(table or haw to name it)
LCD5110_init(); //function which initialize LCD
LCD5110_set_XY(0,0); //function which set rows and columns in LCD
LCD5110_write_char(tmp); //function which send characters to LCD
}
BR,
Oklem
P.S. If somebody wants to see whole code let me know :) |