Re: Old BMS Software Thread
Posted: Fri Apr 08, 2011 8:49 pm
Martin , the lem hass 300 that i used requires a pull up resistor of i think 10k from 5v to the o/p.
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=2060
Code: Select all
if CellV > FailHigh then 'FailHigh voltage check if CellV > 3.85v then load is turned on.
high Load 'Turn on bypass resistor and bypass led
endif
ReadSlave: '***NEW CODE***
SERIN2 SlaveBusIn, 16468, 5000, TimeOut, [Command] 'Receive Command Byte on Slave Data Bus Timeout 5s
' 9600** Inverted No Parity 16468 Idle Low
If (Command < 1) Or (Command > 13) Then ReadSlave '***NEW CODE***
'*******************************************************************************
Incomming: 'Incomming Command
if Command = 1 then 'If command = 1 then send voltage data on Master Bus
CellS = CellV 'Store CellV in CellS for use with Command 3
if CellV >DHigh or CellV <DLow then 'If V >4.30V or V <1.75V set out of range
VData = 0 'Set VData = 0 Cell error out of Voltage range condition
else
CellV = CellV - DLow 'Convert Word (CellV) data into Byte (VData) for output
endif
endif
Another possibility (and simpler to implement on a limited micro) is to use an error-correcting code. For example a Hamming code uses 8 bits to send 5 bits of data. An error in any one bit is automatically corrected. A 256-byte lookup table converts a byte with any 1-bit error into 5 bits of error-free data.