Return to SDK Examples for Microchip Studio
30#define SerialPort ConnectorUsb
37 SerialPort.Mode(Connector::USB_CDC);
38 SerialPort.Speed(baudRate);
39 uint32_t timeout = 5000;
41 SerialPort.PortOpen();
42 while (!SerialPort &&
Milliseconds() - startTime < timeout) {
48 StatusManager::StatusRegister statusReg = StatusMgr.
StatusRT();
50 SerialPort.SendLine(
"Status Register:");
52 SerialPort.Send(
"Vsupply over-voltage:\t\t");
53 if (statusReg.bit.VSupplyOverVoltage) {
54 SerialPort.SendLine(
'1');
57 SerialPort.SendLine(
'0');
60 SerialPort.Send(
"Vsupply under-voltage:\t\t");
61 if (statusReg.bit.VSupplyUnderVoltage) {
62 SerialPort.SendLine(
'1');
65 SerialPort.SendLine(
'0');
68 SerialPort.Send(
"H-Bridge output overloaded:\t");
69 if (statusReg.bit.HBridgeOverloaded) {
70 SerialPort.SendLine(
'1');
73 SerialPort.SendLine(
'0');
76 SerialPort.Send(
"H-Bridge resetting:\t\t");
77 if (statusReg.bit.HBridgeReset) {
78 SerialPort.SendLine(
'1');
81 SerialPort.SendLine(
'0');
86 SerialPort.Send(
"Offboard 5V overloaded:\t\t");
87 if (statusReg.bit.Overloaded5V) {
88 SerialPort.SendLine(
'1');
91 SerialPort.SendLine(
'0');
94 SerialPort.Send(
"Output overloaded:\t\t");
95 if (statusReg.bit.OutputOverloaded) {
96 SerialPort.SendLine(
'1');
99 SerialPort.SendLine(
'0');
102 SerialPort.Send(
"CCIO-8 output overloaded:\t");
103 if (statusReg.bit.CcioOverloaded) {
104 SerialPort.SendLine(
'1');
107 SerialPort.SendLine(
'0');
110 SerialPort.Send(
"CCIO-8 link broken:\t\t");
111 if (statusReg.bit.CcioLinkBroken) {
112 SerialPort.SendLine(
'1');
115 SerialPort.SendLine(
'0');
118 SerialPort.Send(
"ADC in timeout:\t\t\t");
119 if (statusReg.bit.AdcTimeout) {
120 SerialPort.SendLine(
'1');
123 SerialPort.SendLine(
'0');
126 SerialPort.Send(
"Ethernet disconnect:\t\t");
127 if (statusReg.bit.EthernetDisconnect) {
128 SerialPort.SendLine(
'1');
131 SerialPort.SendLine(
'0');
134 SerialPort.Send(
"Ethernet remote fault:\t\t");
135 if (statusReg.bit.EthernetRemoteFault) {
136 SerialPort.SendLine(
'1');
139 SerialPort.SendLine(
'0');
142 SerialPort.Send(
"SD card error:\t\t\t");
143 if (statusReg.bit.SdCardError) {
144 SerialPort.SendLine(
'1');
147 SerialPort.SendLine(
'0');
150 SerialPort.SendLine(
"------------------------");
void Delay_ms(uint32_t ms)
Blocks operations for ms milliseconds.
Definition SysTiming.h:287
uint32_t Milliseconds(void)
Number of milliseconds since the ClearCore was initialized.
StatusRegister StatusRT(StatusRegister mask=UINT32_MAX)
The real time status register.