2020-10-23 12:27 PM
It updates if I manually reset the board. I'm setting my baudrate as 11400, but it works only if I select the baudrate as 115200 on hyperterminal. Here is a snippet of what Im working on. (EDIT) It even works when I step through the code, not when I run it
void main(void)
{
Serial_begin(14400);
CLK_Config();
GPIO_Setting();
SYS_EXTI_Setting();
ADC_Setting();
PWM_Setting();
/* Infinite loop */
while (1)
{
if(!adc_start){
adc_start = FALSE ;
ADC1_ScanModeCmd(ENABLE);
ADC1_StartConversion();
while(ADC1_GetFlagStatus(ADC1_FLAG_EOC) == 0);
ADC1_ClearFlag(ADC1_FLAG_EOC);
// Battery voltage calculation
uint16_t adc_recorded = ADC1_GetBufferValue(7);
Serial_print_int(adc_recorded);
}
void Serial_print_int (int number) //Funtion to print int
{
char count = 0;
char digit[5] = {0};
while (number != 0) //split the int to char array
{
digit[count] = number%10;
count++;
number = number/10;
}
while (count !=0) //print char array in correct direction
{
UART1_SendData8(digit[count-1] + 0x30);
while (UART1_GetFlagStatus(UART1_FLAG_TXE) == RESET); //wait for sending
count--;
}
count = 0;
}