As long as there's a large enough resistor feeding the pin from a large voltage then the pin protection diodes will "protect" it. You can even feed 230VAC into a pin via a suitable resistor.
Yes, the main issue is how much current can flow through the resistor - as it's shunted to Vdd by the protection diodes if you're not careful the PIC is powered by it when it's supposedly switched off.
the reason I am using a 18f2221 is I have a quanity on hand. On page 236 (18f2221) in the data sheet it mentions
CVR (control voltage reference) which I interpid as similar to FVR (page 289 data sheet 18f43k22). I have a quanity of these as well.
Are these two FVR and CVR basically the same?
As long as there's a large enough resistor feeding the pin from a large voltage then the pin protection diodes will "protect" it. You can even feed 230VAC into a pin via a suitable resistor.
That may keep the chip from blowing up, but it can cause all sorts of issues with the analog circuitry inside the chip, OSC operation, resets, etc. They pulled that app note a long time ago and it's no longer "recommended" doing it that way.
... and I wouldn't worry too much about being able to change the ADC reference. Here's a rough estimate of the battery vs ADC_IN voltages:
Code:
BAT ADC_IN
48V 4.36V
36V 3.27V
24V 2.18V
With the 10-bit ADC @ 5V, you have approx 4.8mV/bit. It's not all that accurate, but it'll probably be fine for what you're doing.
You can get rid of that zener now too.
At one point you were switching voltage dividers into the ADC_IN pin and it was possible to do an "oops", select the wrong setting, and over-voltage the uC pin by a LOT.
With the 10K/1K divider on the ADC_IN you should be ok with a CART_BATTERY voltage up to almost 58V.
I left the zener in just in case there were transients when charging or during motor switching. Seems like cheap insurance to prevent possible damage.
Regarding powering the micro through the ADC input & having voltage on an unpowered micro's pins, the Vbat measurement point should be downsteam of the master power switch. This also prevents a power drain when the cart is off.
Well here is cleaned up edited schematic. curious if P channel over N channel? perferred
Added 2 leds so driver has a better indication if battery is gettting low.
Plan to have 2_48v lipo4 batteries in parelle but only one is in use (have a battery selector switch mounted on cart)
hope this schematic passes mustard?
A. I don't know the current draw of your lights and "misc"
and
B. I don't see any coins in my pocket to do your design work
Perhaps you should be happy (and maybe the slightest bit appreciative) for a clear schematic and all the help numerous people have tried to give you. You can put out some effort, figure out the load currents and make as MOSFET selection.
Or use relays - the current draw of a relay will be next to nothing compared to the load.
Or use N-channel FETs. Much simpler, but then you'd have to understand the difference between a low-side switch and a high-side switch.
Or, easier still, use two toggle switches to control your lights and "misc" and a less than $10 DC voltmeter module to monitor battery voltage.
No LCD power connection: post #42 and elsewhere. Note, a power connection appeared in one schematic and disappeared in the next.
MOSFETs incorrectly wired: posts #22, #32, #34, #46, #47. MOSFETs have alternated between P-channel and N-channel without explanation. The P-channel versions have reversed DRAIN and SOuRCE connections.
"New" problems:
100uF cap C4 is duplicated as C7. The DC-DC converter doesn't want to drive more than 100uF.
The resistors around the gates of the MOSFETs are probably wrong.
MrDEB, your schematic is much better and easier to understand. But you didn't fix the already-addressed problems. If you continue making one correction at a time (and "un-fixing" something else), you'll never get done and nobody will continue trying to help.
C4 is 100nf not 100nf
yes I forgot to create a trace from +5v-corrected thanks
The mosfets are connected as per your schematic.
the switches SW1 and SW2 are tactil switches, not as you have drawen
Thanks "Jon" for pointing out my mistakes
Oh and I forgot to include a connection for the hall effect switch.
If you look at the direction of the mosfet body diode in
what you have drawn, the diode will always be forward biased so you won't be able to turn off the lights (at least not until the body diode blows up).
The point of a schematic is to show how components are connected. Your 6 pin "black box" switches don't show which pins are the switch contacts, and which are the LED contacts. Maybe you do have the connections correctly made.
In as much as I don't know what switches you're using (if you even know), I have shown the "Illuminated Control Switches" as their essential elements of switch contacts and LEDs. I have shown clearly the connections that must be made, no matter what particular switches you end up using.
That way, it doesn't matter what switches you finally plop down in whatever version of the schematic you end up with. But my preference for schematic symbols is for symbols that show the function of each pin. This can be symbols in the schematic component itself, labels on the pins, or, in the worst case, labels placed next the the symbol. At any rate, there should be more than pin numbers or you can't tell squat from the schematic. "There's a resistor going to pin x – is that the LED? The switch?" You shouldn't have to dig out a datasheet to know.
I agree with you about the illuminated tactil switches.
I made the part using Diptrace several years ago and it works as is.
I don't want to upset my schematic etc by changing the pattern or other.
I have LOTS of red and white illuminated switches but never had a data sheet so I made part etc that works.
Been side tracked on this project as the resistor arrays I received from LCSC are wrong package. Trying to locate a resistor array that has a 5.1 x 3mm footprint. I ordered from Digikey or Mouser but??