User manual
Firmware
2010 Microchip Technology Inc. DS51845B-page 19
FIGURE 2-3: Serial Transmission Flowchart.
UART TX Interrupt
contrd<=512?
Get CH0 sample from current[contrd];
Change Long into 8 digit string;
write character “,” to val[8];
Get CH1 samples from voltage[contrd];
Change the value in 8 digit string;
Write char CR to val[17]
YES
contrd=513?
NO
YES
Send char “D”;
Increment contrd
NO
contrd2<=17?
Send val[contrd2];
Increment contrd2
contrd2=0;
Increment contrd
YES
NO
contrd=514?
Transform MODr from
byte in 3 chars;
Transform PHASEr
from byte in 3 chars;
Transform GAINr from
byte in 3 chars;
Transform STATUSr
form byte in 3 chars
Transform CONFIGHr
from byte in 3 chars;
Transform CONFIGLr
from byte in 3 chars;
Transform Timer8
from int in 5 chars;
Transform Timer9
form int in 5 chars
YES
Contrd2<=35?
Send one char to PC
Increment contrd2
YESContrd2=36?
NO
Reset contrd2;
Increment contrd
contrd=515?
NO
Sent to PC char “;”;
Increment contrd
YES
Contrd<=515+REAL_N?
Transform the FFT result of
the voltage channel from
5 chars;
Transform the FFT result of
the current channel from
5 chars;
(IN CURRENT FIRMWARE
FFT IS NOT COMPUTED)
Contrd2<=11?
Sent char to PC;
Increment contrd2
NO
YES
YES
Reset contrd2;
Increment contrd
NO
Contrd==515+
REAL_N+1?
NO
Disable UART TX interrupt;
Contrd=515+REAL_N+2;
Enable UART RX interrupt
YES
Exit UART TX Interrupt
NO
int to
int to