Solved MPLAB:How do I simulate measuring a battery voltage?

May 9, 2017 at 00:42:31
Specs: Windows 10, i5 2320 3GHz 8GB
MPLAB:How does one simulate measuring a battery voltage?

I'm working on a battery NiMH project where you have to measure the voltage rise as the charging proceeds or in the other direction fall as the discharge proceeds.

Using C18 , with the MPLAB IDE V 8.87 I have all the code written and is good enough to go to a PCB....
BUT the whole basis of the project is measuring a DC voltage level

My ADCON 0,1,2 activation constantly gives errors on TADpoles and frogs false all of them only a cad would flaunt the data pdf so blatantly

Example messages
ADC-W0001: Tad time is less than 0.700us .... I have settings for really slow slow 400us

ADC-W0011: The Go/Done bit must not be set in the same cycle as the Enable bit. ... once again between the two actions SET and start measuring... I put another 400us

ADC-W0008: No stimulus file attached to ADRESL for A/D.... my brick wall on searching for a DC stimulation...

As I step through the code to where a cell voltage has to be simulated MPLAB starts screaming, warnings there is no stimulus file.

My web search for examples of simulating a battery voltage produce NOTHING.

I hope my conclusion that ADC 0 through 5V DC measurements cannot be simulated with MPLAB is wrong.

But if confirmed could someone offer an alternative way to use the 18Fseies 12 bit ADC converters.
many thanks
Fred
Madrid.


See More: MPLAB:How do I simulate measuring a battery voltage?

Report •

#1
June 16, 2017 at 10:20:36
✔ Best Answer
Dear Moderator, best close the thread as the answer would seem to be, it is not possible to simulate a DC voltage applied to an analogue port.

My own thoughts are that the stimulus program was designed to measure 0 to 5V zero five waveforms, the times but not a steady DC level.

I looked briefly into sending a series of pulses varying the duty cycle * PWM" filtering each pulse train but yes,stimulus possibly could handle this, But my maths getting the train into a DC level with 12 bit resolution frightens me and left me wondering exactly what microchip has in mind when it claims 12 bit resolution ..

Most voltmeters do this with no fuss>>> but 5V, exact 5V might be difficult to get 12 bit resolution.

Bye and thanks to others who may have tried to give an answer
Fred
Madrid Spain

message edited by Fredf


Report •
Related Solutions


Ask Question