#include "adc.h"
#include "debug_printf.h"
//more code in here
void ADCBar(int32_t Channel, uint32_t Counts)
{
uint32_t ValueBarLen = ((Counts * (MAX_BAR_LENGTH+1)) - (ADC_COUNT_MAX/2 - 1)) / ADC_COUNT_MAX;
char ValueBarBuf[BAR_OUTPUT_LENGTH+1];
double ValueVolts = Counts*SUPPLY_VOLTAGE/ADC_COUNT_MAX;
if(Channel >= 0)
{
if(ValueBarLen > MAX_BAR_LENGTH) ValueBarLen = MAX_BAR_LENGTH;
FillString(ValueBarBuf, '#', ValueBarLen);
debug_printf("%2d %d.%02dV |%s%*s|\n", (int)Channel,
(int)ValueVolts, (int)((ValueVolts-(int)ValueVolts)*100),
ValueBarBuf, (int)(MAX_BAR_LENGTH-ValueBarLen), "");
}
else
{
FillString(ValueBarBuf, '-', MAX_BAR_LENGTH+2);
debug_printf("%-9s%s\n", "", ValueBarBuf);
}
}
|
#include "driver_config.h"
#include "target_config.h"
#include "adc.h"
#include "gpio.h"
#include "timer32.h"
#include "i2c.h"
#include "debug_printf.h"
/* Main Program */
int main (void) {
debug_printf("POV Firmware running!"); |
Original Attachment has been moved to: pov-workspace-debugdependfiles.zip