I need help with this HW. This code must be used in Keil uVision 5 in C file Con
ID: 3723269 • Letter: I
Question
I need help with this HW. This code must be used in Keil uVision 5 in C file
Consider the delay function based on timers below that is used in the skeleton code for the LCD Lab. Tvoid tim6-delay(void){ // enable APB1 bus clock RCC->APBIENRI=RCCAPBIENR TTM6EN ; ITIM6 prescaler set at default to 0 for novw TTM6-)PSC=(); // prescalar TIM6->ARR= 21000; //auto reload register TIM6->CNT-0//clear counter register - //WHEN COUNTER IS DONE THE TIM6 SR REG UIF FLAG IS SET while (TIM6->SR) TLM6S R=0; //CLEAR ulFFLAG You are asked to figure outthe actual delay from the above function. Upload a detailedExplanation / Answer
#include "EventRecorder.h" // Keil::Compiler:Event Messaging
int some_error = 0; // error flag
char string[10] = "MyTest"; // some test string
void MyFunction (int parameter) {
EventRecord2 (1+EventLevelAPI, parameter, 0); // Event at Start
;
if (some_error) {
EventRecord2 (2+EventLevelError, 0, 0); // Event at Error
return;
}
EventRecordData (3+EventLevelOp, string, sizeof(string)); // Event at Finish
return;
}
int main (void) {
EventRecorderInitialize (EventRecordAll, 1); // initialize and start Event Recorder
MyFunction (0x10);
some_error = 1; // set error flag
MyFunction (0x60);
}