Remote Display Board Version 1
Posted: Thu Jun 24, 2010 5:59 am
This a placeholder, info will be added asap. At the moment info on this is in the three old threads.
Welcome to the BVS forums at www.batteryvehiclesociety.org.uk
http://ww.batteryvehiclesociety.org.uk/bvsorguk/forums/
http://ww.batteryvehiclesociety.org.uk/bvsorguk/forums/viewtopic.php?f=53&t=2688
Code: Select all
TxdData: ;Sends 18 bytes of data to remote display and/or PC Logger
;Txd sends 5 byte preamble to lock with Rxd, then qualifier "bms"
;followed by 9 bytes of data
peek Temp1Data, b2 ;Read Front Pack Temp from Temp1Data Ram Byte (Note 0-100C Max)
peek Temp2Data, b3 ;Read Rear Pack Temp from Temp2Data Ram Byte (Note 0-100C Max)
peek VoltsData, b4 ;Read PackVoltage from VoltsData Ram Byte (Note 0-255V Max)
peek SocData, b5 ;Read Soc from SocData Ram Byte (Note 0-100%)
peek ErrCell, b6 ;Read Cell with Error from ErrCell Ram Byte
peek AmpSign, b7 ;Read AmpSign (+ or -) from AmpSign Ram Byte
peek AmpData, b8 ;Read AmpData from AmpData Ram Byte
' peek WhStore, b9 ;Read Wh/Mile Data from WhStore EEprom Byte
serout DriveInhibit, BaudN2400, (0x55, 0x55, 0x55, 0x55, 0x55) ;Txd 5 byte preamble to clear Rxd
pause 10 ;Pause for 5ms to allow serial rxd to clear
serout DriveInhibit, BaudN2400, ("bms",b0,b1,b2,b3,b4,b5,b6,b7,b8) ;Txd data (2400 baud at 8mhz)
return ;Return to main program
Code: Select all
#picaxe 08M ;Set editor to Picaxe 08M Mode
`Variables Constants and I/O definitions
`Variables
`Variables 8bit (Byte) ;Note some Word variables converted to byte variables by Master
;for transmission to remote display to save variables
symbol AlarmByte = b0 ;Alarm Type Byte (0-255 number of different Alarms)
symbol AlarmCount = b1 ;Alarm Counter Byte (0-255 number of times an Alarm has occured)
symbol Temp1 = b2 ;Temp1 Sensor LM335 (0-100C)
symbol Temp2 = b3 ;Temp2 Sensor LM335 (0-100C)
symbol PackVoltage = b4 ;Pack Voltage (0-255V)
symbol Soc = b5 ;Pack Soc (0-100%) Rounded down to nearest %
symbol ErrCell = b6 ;Number of the Cell with any Error condition
symbol AmpSign = b7 ;Amp Sign (+ or -)
symbol AmpData = b8 ;Amp Data to nearest Amp (-100 to +100A)
symbol WhMile = b9 ;Wh/Mile Data (0-255 wh/mile)
`AlarmByte (b0) Additional Information (255 possible Alarms) 0 = No Alarms
`If AlarmByte = 0 then (No Alarms Set)
`If AlarmByte = 1 then (Cell over AbsMax V)
`If AlarmByte = 2 then (Cell under AbsMin V)
`If AlarmByte = 3 then (Cell data serial transfer timeout error)
`If AlarmByte = 4 then (Battery Pack over AbsMax Temp)
`If AlarmByte = 5 then (Alarm Test Condition) Used to simulate Alarms
`Constants
symbol Delay = 50 ;Pause for 50ms at 4mhz
symbol AlarmActivate = 3 ;Number of times Alarm must occur before Alarm activates
`Pins used for I/O and designations
`*** Digital high/low Outputs ***
symbol Txd = 0 ;Serial 4800 baud out to PC via prog cable on Output 0
symbol Led = 1 ;Data OK Led on Output 1
symbol Lcd = 4 ;Serial 2400 baud out to 16x2 Lcd on Output 4
`*** Digital high/low Inputs ***
symbol Rxd = 3 ;Serial 2400 baud in from Master via 433mhz link on Input 3
`*******************************************************************************
`*******************************************************************************
sertxd(13) ;Send a lone CR to ensure PLX-DAQ buffer is ready
Start: ;Program Start
high led ;Turn off data Led (Sink driven)
serin Rxd,N2400,("bms"),b0,b1,b2,b3,b4,b5,b6,b7,b8 ;Receive data via 433mhz link from Master
' sertxd("DATA,TIME",",",#b0,",",#b1,",",#b2,",",#b3,",",#b4,",",#b5,",",#b6,",",#b7,",",#b8,",",#b9,",",13) ;Txd to PC
if AlarmCount >= AlarmActivate and AlarmByte > 0 then DisplayAlarms ;If gosub Alarms Display
low led ;Turn on data Led (Sink driven)
serout Lcd,N2400,(254,128,#PackVoltage,"V ",#Soc,"% ",b7,#b8,"A ") ;Transmit data to Lcd
' serout Lcd,N2400,(254,192,#Temp1,"C ",#Temp2,"C ",#b9,"wh/m ") ;Transmit data to Lcd
goto Start ;Goto program start
DisplayAlarms: ;255 different possible Alarms!)
serout Lcd,N2400,(254,1) ;Transmit data to Lcd
serout Lcd,N2400,(254,128,"Alarm ",#b0," Cell ",#b6,254,192," * Check BMS! * ") ;Transmit data to Lcd
if b0 = 6 then ;If Alarm = 6 (End Charge) then
pause 5000 ;pause for 5 seconds to allow audible alarm to sound
low led ;Turn on data Led (Sink driven) Silence audible Alarm
endif