#REM Honda Insight SubPack Balancer Project by Peter Perkins. * Relay Driver Modules * Note you must change the filter and subtraction factor below depending on which relay select module this software is going to be loaded into, A, B, or C. The three relay driver 20M Picaxes are interlinked and this software is designed so that only one relay out of the twenty available can be ON at any one time, no matter what serial data is received. Picaxe 20M - PIC16F677 - 120209 - www.150mpg.co.uk - V.02 Beta. **************************** General Information ****************************** This SubPack Balancer project carries no warranty of any kind! It is used at your own risk, and I make no claims as to it's suitability for a particular function. Prospective users must evaluate the system before using it, and no liability will be entertained by myself in any shape or form whatsoever. The modules and software have been produced at low cost for the benefit of the Insight community. The software is available free via the internet. Users may modify or adapt the system as they see fit. Be aware that vehicle modifications can lead to invalidated insurance and warranty issues. You the end user remain fully liable for any modifications made to your vehicle. ***************************** Picaxe 20M Pinouts ****************************** Top _____ (+ Supply) +Ve -1| ^ |20- -Ve (- Supply) (Program In) Rxd -2| |19- Txd (Program Out) (Unused) Input 7 -3| |16- Output 0 (Relay Active) (Unused) Input 6 -4| 2 |15- Output 1 (SubPack Relay 1) (Unused) Input 5 -5| 0 |14- Output 2 (SubPack Relay 2) (Unused) Input 4 -6| M |13- Output 3 (SubPack Relay 3) (Unused) Input 3 -7| |12- Output 4 (SubPack Relay 4) (Relay Inhibit) Input 2 -8| |11- Output 5 (SubPack Relay 5) (Relay Inhibit) Input 1 -9| |10- Output 6 (SubPack Relay 6) (Relay Serial Data) Input 0 -10| |10- Output 7 (SubPack Relay 7) ----- **************** SubPack Relay Driver Module Specification ********************** Logic Supply Voltage 5.00V DC ********************************************************************************* ********************** Program Size 55 out of 256 Bytes ************************ ********************************************************************************* #ENDREM #Picaxe 20M ;Set Picaxe Editor to Picaxe 20M Mode `Variables Constants and I/O definitions `Variables 8bit symbol Relay = b0 ;b0 = Relay Serial Select Data Byte (1-20) symbol OnOff = b1 ;b1 = Relay Serial OnOff Data Byte (1 or 0) symbol RelaySet = b2 ;b3 = Relay Set Byte stores number of active Relay (1-7) `BaudRate constants for 4mhz symbol Baud2400 = N2400 ;Serial Data Baud rate 2400 at 4mhz `Pins used for I/O and designations `*** Digital high/low Outputs *** symbol RelayActive = 0 ;Active Relay Inhibit on Output 0 `symbol SubPack = 1 ;SubPack Select Relay on Output 1 `symbol SubPack = 2 ;SubPack Select Relay on Output 2 `symbol SubPack = 3 ;SubPack Select Relay on Output 3 `symbol SubPack = 4 ;SubPack Select Relay on Output 4 `symbol SubPack = 5 ;SubPack Select Relay on Output 5 `symbol SubPack = 6 ;SubPack Select Relay on Output 6 `symbol SubPack = 7 ;SubPack Select Relay on Output 7 `*** Digital high/low Inputs *** symbol DataIn = 0 ;Serial Data Input on Input 0 `symbol Inhibit1 = 1 ;Inhibit Signal on Input 1 `symbol Inhibit2 = 2 ;Inhibit Signal on Input 2 `******************************************************************************* `******************************************************************************* Start: ;Program Start low 0,1,2,3,4,5,6,7 ;Switch Off SubPack Select Relays & Outputs Main: ;Main Program Loop serin DataIn,Baud2400,Relay,OnOff ;Receive Data from Master into bytes (Relay) & (OnOff) `* When simulating serial data entering 1,1 turns on relay one, 1,0 turns it off again `* Entering 7,1 turns on relay seven, 7,0 turns it off again, you should find the software does `* not allow you to activate more than one at a time, or any at all if the inhibit input lines are high. `* Note you must change the filter and subtraction factor below depending on which * `* relay select module this software is going to be loaded into, A, B, or C. * if Relay < 1 or Relay > 7 then Main ;If Relay <1 or >7 then data not for Module A ` if Relay < 8 or Relay > 14 then Main ;If Relay <8 or >14 then data not for Module B ` if Relay < 15 or Relay > 20 then Main ;If Relay <15 or >20 then data not for Module C ` Relay = Relay - 7 ;Subtract 7 from Relay to get correct Number for Module B ` Relay = Relay - 14 ;Subtract 14 from Relay to get correct Number for Module C `******************************************************************************* if OnOff = 0 and Relay = RelaySet then ;If OnOff = 0 & Relay = RelaySet then low Relay ;Turn Off selected Relay low RelayActive ;Turn Off Relay Active Line RelaySet = 0 ;Reset Relay Set to 0 endif if OnOff = 1 and pin1 = 0 and pin2 = 0 and RelaySet = 0 then ;If OnOff = 1 & Inhibit Low & RelaySet = 0 then high RelayActive ;Turn On Relay Active Line high Relay ;Turn On Selected Relay RelaySet = Relay ;Store Active Relay in RelaySet Byte. endif goto main ;Goto Main Program