centrex wrote:Am I missing something.
regards
Centrex
Yes but it's a bit complicated. I hope you can follow my explanation.
The variable CellVoltage is a 16 bit word made up of two byte variables b0 (VData) and b1 (Not defined). I used a 16 bit word to allow me the full resolution of the 10bit READADC10 input command. I could have used the 8bit READADC command, but would have lost a lot of resolution, however the code would have been simpler.
In order to save time I only transmit one byte of info back to the Master (VDATA) this covers a 0-2.55v range.
In order to get a valid single byte value to transmit back to the Master I subtract 175 from CellVoltage, which leaves a result that fits into the single lower byte of the word CellVoltage, and is the byte VData
![Wink :wink:](./images/smilies/icon_wink.gif)
This is transmitted and the Master adds 175 back to it to re-create the actual voltage in the Master word variable CellVoltage.
So if the cell voltage was say 4.00V this would be 400 in the Slave CellVoltage word variable, minus 175 = 225 which is stored in the lower byte VData, and transmited to the Master. The Master receives this into VData which again is the lower byte of the word variable CellVoltage and adds 175 to it to get the original voltage in the word CellVoltage.
The single byte data method gives a useful cell voltage range of 1.75 (175) to 4.30 (430) Volts, anything outside this is treated as an error by the Slave, and VData is set to 0 so the Master can detect it.
I hope that helps.
You will see the Slave If/Then test checks wether the CellVoltage is outside the permitted range due to a problem, and sets VData to 0 so the Master can say "Houston we have a problem" when it receives it
Edit
Just a few pics of the bms screen and buttons installation into the little cubby hole in my Insight. I'm not convinced it's in as good a spot as the little screen would have been on the dashboard, but it is certainly discrete and less likely to encourage theft/breakin.
www.solarvan.co.uk/bms/CubbyHoleDisplay1.jpg
www.solarvan.co.uk/bms/CubbyHoleDisplay2.jpg
www.solarvan.co.uk/bms/CubbyHoleDisplay5.jpg
www.solarvan.co.uk/bms/CubbyHoleDisplay6.jpg
Pics of rear 16A charging socket behind hinged number plate with magnetic fastners.
www.solarvan.co.uk/insight/chargesocket1.jpg
www.solarvan.co.uk/insight/chargesocket4.jpg
Need to do some testing on the menu buttons now, but it seems to be working OK so far
The slightly higher (intentional) centre opaque led is an extension led from the Zivan NG3 charger and changes colour according to the point in the charge cycle. Red (Charging), Yellow (Nearly done), Green (Finished)
Latest Master software with enhanced buttons and new speed/distance routine seems to work ok. Thanks Matt & Jeremy. Happy now Roger
www.solarvan.co.uk/bms/MASTER141008_V42_2400BAUD.txt