Re: Old BMS Hardware Thread
Posted: Tue Feb 08, 2011 7:26 pm
Peter , on the pin diagram at the start of the master code RA6 and RA7 are reversed. Pin 9 is RA7 and Pin 10 is RA6.
Welcome to the BVS forums at www.batteryvehiclesociety.org.uk
http://www.batteryvehiclesociety.org.uk/bvsorguk/forums/
http://www.batteryvehiclesociety.org.uk/bvsorguk/forums/viewtopic.php?f=53&t=2059
retepsnikrep wrote:Looking at the 16F886 chip pinouts I discovered that Pin RA6 & RA7 are not logically placed and are reversed!!
jackbauer wrote:Peter , on the pin diagram at the start of the master code RA6 and RA7 are reversed. Pin 9 is RA7 and Pin 10 is RA6.
Code: Select all
DEFINE PULSEIN_MAX 20000 'Set PULSIN maximum count to 20,000 (100ms) (Range 0-65535 x 5us units)
jackbauer wrote:Right now its running on the bench with 4 cells. The "M" in mph flashes when not charging and i have a counter incrementing at 1 sec intervals in the top right of the screen. My i2c temp sensors dont seem to want to work anymore even with the correct id! One potential problem is if the 1 sec pulse stops pulsing the program waits forever in a loop.
Code: Select all
If Alarms = 9 Then '(Watchdog chip 1S pulse missing)
DEBUG "Watchdog Pulse" 'Video Display
endif
Code: Select all
' if BatCurrent < Offset then 'If BatCurrent is < Offset means system is Discharging
' BatCurrent = ((Offset - BatCurrent) * 2) / 10 'Subtract offset to get a positive number (0-512 = 0-100A+) Max 99
' AmpSign = 45 'Set ascii Character 45 (-) to be displayed if Discharging
' goto ExitCurrent
' endif
' if BatCurrent > Offset then 'If BatCurrent is > Offset means system is Charging
' BatCurrent = ((BatCurrent - Offset) * 2) / 10 'Subtract offset to get a positive number (0-512 = 0-100A-) Max 99
' AmpSign = 43 'Set ascii Character 43 (+) to be displayed if charging
' goto ExitCurrent
' endif
Code: Select all
BatCurrent = (BatCurrent * 64) / 326 'New current (Amps) calculation for 100A sensor 090211
If BatCurrent < 100 then 'Means system is Discharging
AmpSign = 45 'Set ascii Character 45 (-) to be displayed if Discharging
BatCurrent = 100 - BatCurrent
else 'Means system is Charging
AmpSign = 43 'Set ascii Character 43 (+) to be displayed if charging
BatCurrent = BatCurrent - 100
endif