Using Timer

main.c

#include "stm32f1xx.h"
#include "LCDFunctions.h"

int main(void)
{
InitializePortsForLCD();
LCDDisplaySetup();

RCC->APB2ENR |= RCC_APB2ENR_TIM1EN; // Supply clock to TIM1
TIM1->CR1 |= TIM_CR1_CEN;  //Enable Timer
TIM1->PSC |= 655; //Prescalar value

LCDSendStringsIn2Lines("Counter: ", "Prescalar:");
LCDsendAnInteger(TIM1->PSC, 5);

    while(1)
    {
    LCDSetCursorPosition(9,0);
    LCDsendAnInteger(TIM1->CNT,6); //Timer Count
    }

}

Comments

Popular posts from this blog

HackRF with srsLTE and openlte

Blinking a LED in STM32F103C8T6 (Blue Pill) Board

Read Continuously from Serial Port in QT