PIC16F1827 Voltage Level Indicator

Thread Starter

mcmsat

Joined Dec 28, 2012
4
I am new in embedded System. I want to use PIC16F1827 to indicate the voltage level of my self made high voltage DC variable Power supply.

I have done all I could to make this work well but it turns the LED on for example >= 0.47 and could not wait until it gets to <= 0.40 before it turns the LED off. It suppose to wait until it decreases to <= 0.40 before it turns off.

Attached are the source file and the Proteus simulation circuit .

Thanks.
Michael.
 

Attachments

Thread Starter

mcmsat

Joined Dec 28, 2012
4
@AlbertHall, You are just a CCS C master!

It works right now but there is this error I get, it counts up to 10,000! Though is does not stop the circuit from running well but to me an error is an error! Is there anything that I write or selected wrongly that can cause this error? The snapshot of the error is attached
 

Attachments

AlbertHall

Joined Jun 4, 2014
12,347
In init() you need to add lines like this:
ANSELA = 0x0F; // Set A3:A0 as analogue
TRISA = 0x0F; // Set A3:A0 as inputs
TRISB = 0; // Set port B as output

Note that I don't use CCS and it may use different register names.
 

Thread Starter

mcmsat

Joined Dec 28, 2012
4
In init() you need to add lines like this:
ANSELA = 0x0F; // Set A3:A0 as analogue
TRISA = 0x0F; // Set A3:A0 as inputs
TRISB = 0; // Set port B as output

Note that I don't use CCS and it may use different register names.
OK I'll try it Sir.
In init() you need to add lines like this:
ANSELA = 0x0F; // Set A3:A0 as analogue
TRISA = 0x0F; // Set A3:A0 as inputs
TRISB = 0; // Set port B as output

Note that I don't use CCS and it may use different register names.
 
Top