Question: Need the flowchart for this code, this code is in c language #include NuMicro.h #include ADCAgent.h #include TempSensor.h #include system _ init.h
Need the flowchart for this code, this code is in c language
#include "NuMicro.h
#include "ADCAgent.h
#include "TempSensor.h
#include "systeminit.h
#include "display.h
#include tmrh
#include "GUI.h
#include sysh
#include BNCTLh
#include "StepMotorAgent.h
#include "UARTh
#include
define max and mini speed
#define MaxSpeed
#define MinSpeed
global variable define
uintt timecount ;
uintt speed;
uintt dir;
char c;
char sendbuf;
unsigned int baudrate;
char baudratebuf;
void Selectmode void;
void BTNspeedcontrol void;
void ADCspeedcontrol void;
void UARTspeedcontrol void;
int mainvoid
local variable define
char ADCvaluebuf;
char Msensortempvaluebuf;
char thermistortempvaluebuf;
char speedbuf;
char modebuf;
char receivebuf;
uintt mode ;
uintt btnpressedonce ;
Init System, peripheral clock
SYSInit;
Init temputer sensor
TempSensorEnable;
Init TMR for timecount
TMRInitial;
Opem GUI display
DisplayInit;
Init ADC
ADCInitial;
Init Button
BTNinit;
Init UART
UARTInitial;
Init Step Motor
StepMtrInitial;
dir ;
speed ;
baudrate ;
while
if BtnIsDownx && BtnIsDownx && btnpressedonce
mode mode : mode ;
btnpressedonce ;
else if BtnIsDownx && BtnIsDownx
btnpressedonce ;
switch mode
case :
BTNspeedcontrol;
break;
case :
ADCspeedcontrol;
break;
case :
UARTspeedcontrol;
break;
default:
BTNspeedcontrol;
break;
Print ADC value
sprintfADCvaluebuf, "ADC value : d ADCGetVR;
DisplaybufADCvaluebuf, ;
Print Sensor temperature
sprintfMsensortempvaluebuf, Msensortemp : f ADCGetMTemperature;
DisplaybufMsensortempvaluebuf, ;
Print Thermistor temperature
sprintfthermistortempvaluebuf, "ThermistorTemp : d ADCConvThermistorTempToReal;
Displaybufthermistortempvaluebuf, ;
write motor state buffer
sprintfspeedbuf,"Speed : d rpm speed;~
Displaybufspeedbuf, ;
sprintfmodebuf, "Mode d mode;
Displaybufmodebuf,;
sprintfbaudratebuf, "baudrate: d baudrate;
Displaybufbaudratebuf, ;
sprintfreceivebuf, "received: c c;
Displaybufreceivebuf, ;
Drivers
Motor Task
StepMtrTaskdir speed;
Get ADC value
ADCTask;
Scan button
BTNtask;
void UARTspeedcontrol void
ifUARTIsRxDataReady
c UARTReadByte;
GUIClear;
switchc
case :
ifspeed MaxSpeed
StrPushMax Speedr
;
else
speed;
StrPushSpeed upr
;
break;
case :
ifspeed MinSpeed speed
StrPushMin Speedr
;
else
speed;
StrPushSpeed downr
;
break;
case s:
speed ;
StrPushStopr
;
break;
case r:
ifdir
dir;
StrPushreverser
;
else
dir;
StrPushreverser
;
break;
case p:
sprintfsendbuf "Speed: dr
rmp: d r
Direction: s r
speed, speeddir "Clockwise" : "Counterclockwise";
StrPushsendbuf;
break;
case i:
baudrate ;
ChangeBaudRate baudrate;
break;
default:
StrPushUnknownr
;
break;
UARTTxTask;
void BTNspeedcontrol void
ifBtnIsOneShotxx
speed control
speed ;
clear the GUI display
GUIClear;
clear oneshot flag
BtnOneShotClearx;
ifBtnIsOneShotxx
dir x;
clear the GUI display
GUIClear;
BtnOneShotClearx;
ifBtnIsOneShotxx
ifspeed MaxSpeed
speed ;
else
speed MaxSpeed;
GUIClear;
BtnOneShotClearx;
ifBtnIsOneShotxx
ifspeed MinSpeed
speed ;
else
speed MinSpeed;
GUI
