8.3) write a program for the development board that repeatedly counts:
• from 0 to 9 in 1-second increments
#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;
}
}
}
Comments
Leave a comment