Still not having much luck.
I forgot to mention that I am a 63 year old newbie, using MPLAB.
I have a couple of units working.
One running the code I have supplied in the OP at the top.
This has a PIC16F877A and is the one I want to incorporate into the power supply.
The other is a PIC16F84A project, both with 1602 LCD displays..
why do we say LCD Displays.
LIQUID CRYSTAL DISPLAY DISPLAY???As suggested by IAN.M I have revised my plans to be 1 decimal place.
I also think my description of output was a little misleading
SUPPLY IMBALANCE
+15.1V -14.8V
OR
D.C. VOLTS = +15.0V
D.C. VOLTS = -14.9V
these were just numbers out of my head.The power supply I am building is actually 30 volts 3 amps per rail.
The display should be more like---
SUPPLY IMBALANCE
+25.0V -24.6V
OR
D.C. VOLTS = +25.0V
D.C. VOLTS = -24.6VI think I prefer the latter version.
I want the Micro Processor to monitor the voltages on each rail and display a message if there is a difference of more than say 0.3v
I know I will have to invert the neg rail to be able to read it or would the comparators be able to do this job without inverting the Neg rail?
If so how would I do this.
I have added to my code
//************************* START ADC ***************************************
void ADC_Init()
{
ADCON0 = 0x41; //ADC Module Turned ON and Clock is selected
ADCON1 = 0xC0; //All pins as Analog Input
//With reference voltages VDD and VSS
}
unsigned int ADC_Read(unsigned char channel)
{
if(channel > 7) //If Invalid channel selected
return 0; //Return 0
ADCON0 &= 0xC5; //Clearing the Channel Selection Bits
ADCON0 |= channel<<3; //Setting the required Bits
DelayMs(2); //Acquisition time to charge hold capacitor
GO_nDONE = 1; //Initializes A/D Conversion
while(GO_nDONE); //Wait for A/D Conversion to complete
return ((ADRESH<<
+ADRESL); //Returns Result
}
//******************************* END ADC *********************************
that smiley face should be 8 close bracket with no spaceand inside the void main(void) // MAIN PROCESSING HERE //
else if (FAULT_7==0)
{
unsigned int V, DisplayVolt, i;
char Volt = "00.0"; // has error 358
char buf[10];
V = ADC_Read(0); //Read Analog Channel 0
DisplayVolt = V * 2;
Volt[0] = (DisplayVolt/1000) + 48; // has error 981
Volt[1] = (DisplayVolt/100)%10 + 48; // has error 981
Volt[3] = (DisplayVolt/10)%10 + 48; // has error 981
Lcd_Init(); // initialize LCD
Lcd_Clear(); // clear LCD
Lcd_Set_Cursor(1,1);
Lcd_Write_String ("test");
Lcd_Set_Cursor(2,1);
sprintf (buf, "volts = : %a",i); // has error 975
Lcd_Write_String(2,5,Volt); // has error 186 & 357
DelayMs(500); // Hold for 500 ms
while(1); //Infinite Loop
}
this section has several errors
I am using mplab compiler
Product Version: MPLAB X IDE v2.10
Java: 1.7.0_25; Java HotSpot(TM) 64-Bit Server VM 23.25-b01
System: Windows 8 version 6.2 running on amd64; Cp1252; en_AU (mplab)
Userdir: C:\Users\BILL\AppData\Roaming\.mplab_ide\dev\v2.10
taken from HELP\ABOUT
actually using Windows 10
I await your any help I can get
Thank you
BILL.