Answer to Question #275635 in C for Mr Z

Question #275635

8.3) write a program for the development board that repeatedly counts:

• from 0 to 9 in 1-second increments


1
Expert's answer
2021-12-05T02:15:14-0500
#include "main.h"

unsigned int Count = 0;

void Events()
{
  EXTI_PR = 1;
  Count++;
}

void SetupInt()
{
  SYSCFG_EXTICR1 = 0;
  EXTI_FTSR = 0;
  EXTI_RTSR = 1;
  EXTI_IMP = 1;
  EXTI_PR = 1;
  NVIC_IntEnable(IVT_INT_EXTI0);
}

void main()
{
  unsigned int CountOld;
  unsigned char Txt[7];

  CPIO_Config(&CPIOA_BASE, _CPIO_PINMASK_0, _CPIO_CFG_MODE_INPUT);
  UART3_Init_advanced(9600, _UART_8_BIT_DATA, _UART_NOPARITY, 
                  _UART_ONE_STOPBIT, &_GPIO_MODULE_USART3_PD90);
  UART3_Write_Text("EVENT COUNTER\n\r");
  SetupInt();
  CountOld = Count;

  while (1)
  {
    if (CountOld != Count)
    {
      IntToStr(Count, Txt);
      UART3_Write_Text(Txt);
      UART3_Write_Text("\n\r");
      CountOld = Count;
    }
  }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS