|
|
12-07-2008, 05:41 PM | #1 |
MetalShark
Drives: 2008 Yaris LB Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
|
Source code for Yaris Tachometer
[IMG][/IMG]
If you want to build a tachometer using a BS2 micro-processor the following will help: ' {$STAMP BS2} ' {$PBASIC 2.5} '************************************************* ************************************** '* TACHOMETER PROGRAM FOR 2008 TOYOTA YARIS. * '* VERSON 2.0 BY STAN CLOYD 3/07/2009. * '* THIS UPDATE EXPANDS TACHOMETER INDICATION RANGE TO 6,800 PLUS RPM AND RAISES RPM * '*FLASH WARNING (4 hZ FLASH RATE) TO 6,000 RPM. THE YARIS ECU REPORTEDLY STARTS * '*LIMITING RPM AT 6,400 RPM AND CAN KEEP CALCULATING ECU OUTPUT VALUES UP TO 7,000 RPM.* '* PARALLAX BS2 PIN #15 IS USED TO READ TACH SIGNAL FROM THE OBD2 SERVICE CONNECTOR.* '*INPUT SIGNAL IS ATTENUATED FROM A 0-12 VOLT SQUARE WAVE TO A 0-5 VOLT SQUARE WAVE BY * '*A 100 K CURRENT LIMITING RESISTER AND A 5.01 VOLT ZENER DIODE. OUTPUT PINS #s 0-14 * '*ARE IMPEDANCE MATCHED TO THE LED LOADS BY LM342-N OP-AMP QUAD PACKS IN A UNITY GAIN * '*CONFIGURATION. * '* PULL DOWN RESISTERS WITH A VALUE OF 47 K ARE USED TO KEEP THE PROCESSOR OUTPUTS * '*FROM FLOATING HIGH WHEN THE LOGIC HAS THEM OFF. COMPARISON OF RPM TO A COMMERCIAL * '*DIGITAL TACHOMETER SHOWED A 1 % DIFFERANCE AT 650 RPM AND A 1/2 % DIFFERANCE AT * '*3,200 RPM. CALIBRATION INTEGERS USED ARE FOR A 4 CYLINDER 4-CYCLE ENGINE ONLY. * '*EEPROM DATA BELOW STORES THE RPM LIMIT VALUES THAT TURN ON AND OFF EACH DISPLAY LED. * '************************************************* ************************************** DATA Word 540, Word 950, Word 1400, Word 1850, Word 2300 'EPROM DATA DATA Word 2750, Word 3200, Word 3650, Word 4100, Word 4550 'EPROM DATA DATA Word 5000, Word 5450, Word 5900, Word 6350, Word 6800 'EPROM DATA '************************************************* *********** '* DECLARATIONS & INITIALIZATIONS * SAMPLE_L VAR Word '*INPUT SQUARE WAVE TIME-LOW COUNT * SAMPLE_H VAR Word '*INPUT SQUARE WAVE TIME-HIGH COUNT * PERIOD VAR Word '*TOTAL SQUARE WAVE PERIOD COUNT (INVERSE OF FREQUENCY) * RPM VAR Word '*REVOLUTIONS PER MINUTE (CRANKSHAFT RPM) * RPM_L VAR Word '*RPM CELL LIMITS READ FROM EEPROM TABLE * INDEX VAR Byte '*OUTPUT PIN INDEX # * CAL1 VAR Byte '*SCALING CONSTANT TO KEEP CAL2 BELOW INTEGER OVERFLOW LIMIT* CAL2 VAR Word '* * CAL1=230 '*FOUR CYLINDER ENGINE-SPECIFIC CALIBRATION VALUE * CAL2=63050 '*FOUR CYLINDER ENGINE-SPECIFIC CALIBRATION VALUE * '************************************************* *********** START: '************************************************* *********** PERIOD = 0 '*RESET/CLEAR LAST SCAN-LOOP VALUES * SAMPLE_L= 0 '* * SAMPLE_H= 0 '* * RPM = 0 '* * '* * PULSIN 15, 0, SAMPLE_L '*SAMPLE PIN #15 LOW COUNT AT ZERO VOLTS * PULSIN 15, 1, SAMPLE_H '*SAMPLE PIN #15 HIGH COUNT AT 5 VOLTS * PERIOD = SAMPLE_L+SAMPLE_H '*CALCULATE TOTAL PERIOD COUNT * PERIOD = PERIOD/CAL1 '*SCALING FACTOR TO PREVENT POSITIVE INTEGER OVERFLOW * RPM = CAL2/PERIOD '*CALULATE RPM * '* * IF RPM>6000 THEN '*FLASH LEDS ON AND OFF AT 4 HZ WHEN RPM EXCEEDS 6000 RPM * '*(SHIFT WARNING). * FOR INDEX=0 TO 14 '************************************************* *********** LOW INDEX NEXT PAUSE 25 ENDIF '******************************************** FOR INDEX=0 TO 28 STEP 2 '*TURN ON CORRECT LEDS FOR ANALOG DISPLAY * READ INDEX, RPM_L.LOWBYTE '*INDICATION(ENGINE-RUNNING CONDITION ONLY).* READ (INDEX+1), RPM_L.HIGHBYTE '******************************************** IF RPM>RPM_L THEN HIGH (INDEX/2) ELSEIF RPM<RPM_L THEN LOW (INDEX/2) ENDIF NEXT '******************************************** DO WHILE PERIOD=0 '*REVERSING STROBE FLASH SEQUENCE WHEN * FOR INDEX=0 TO 14 '*IGNITION KEY IS ON BUT ENGINE IS NOT * HIGH INDEX '*RUNNING (HARDWARE DIAGNOSTIC). * PAUSE 20 '******************************************** LOW INDEX PAUSE 20 NEXT FOR INDEX=14 TO 0 HIGH INDEX PAUSE 20 LOW INDEX PAUSE 20 NEXT LOOP GOTO START
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header. Last edited by metalshark; 04-07-2009 at 07:44 PM. Reason: Updated version 2 |
12-07-2008, 06:15 PM | #2 |
Drives: 2008 Toyota Yaris Liftback Join Date: Oct 2008
Location: Houston, TX
Posts: 1,054
|
wow that makes no sense to me. lol
|
12-07-2008, 08:08 PM | #3 |
MetalShark
Drives: 2008 Yaris LB Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
|
Cents
A smart alec would say its basic but actually its pBasic.
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header. |
12-07-2008, 08:12 PM | #4 |
Drives: 2008 HB, A/T, Power W/L/M Join Date: Oct 2008
Location: LI, New Yawk
Posts: 2,063
|
You are a mental giant!
|
02-28-2009, 05:29 AM | #5 |
MetalShark
Drives: 2008 Yaris LB Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
|
Had to change jobs and be punished on day shift for a while. Here is the schematic from which I'm working on a 2-layer board layout.
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header. Last edited by metalshark; 04-02-2009 at 05:44 PM. |
03-30-2009, 09:41 PM | #6 | |
MetalShark
Drives: 2008 Yaris LB Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
|
Tachometer kit layout
Quote:
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header. |
|
03-30-2009, 10:03 PM | #7 |
Can't wait to see how they come out...I have the plugs almost done for my steeringwheel project!
|
|
03-31-2009, 05:46 PM | #8 |
MetalShark
Drives: 2008 Yaris LB Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
|
Extra Boards
I will have 2 extra boards left over and some parts. I can solder in the parts I have and sell the extra boards with the schematic, bill of material, and source code listing if anyone is interested. I'll post all the pics here if it was laied out correctly. It was my first layout going to the etcher.
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header. |
04-02-2009, 02:39 AM | #9 |
My soldering abilities are good enough to connect wires, but not good enough to populate a board. What would one cost assembled (I can wire the thing into the car)?
|
|
04-02-2009, 05:22 PM | #10 |
MetalShark
Drives: 2008 Yaris LB Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
|
As beta test consumer I might be able to cost it low. The biggest problem is the BS2 chip costs $50. I need to re-prototype this project using the new Parallax Propeller chip since they just dropped the cost to $7.95. The propeller has so many beans you could put the entire Toyota engine management code on it if they would let you have a copy. The parts at-cost is roughly $80 without display LED's AND you'd want me to load the program into the BS2 EEPROM for you too. It is a neat integrated prototype though and cops always ask what it is because when the key is on and the motor dead the display chases left to right and right to left like the original KIT. The cops have to know its not an illegal mobile police scanner. They give it a thumbs up. In a Propeller version I would integrate the dash dimmer control into the unit.
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header. Last edited by metalshark; 04-02-2009 at 05:31 PM. Reason: Inclusion of ball-park costing SWAG. |
04-02-2009, 08:17 PM | #11 | |
ULTIMATE
Drives: 09 5dr LB, 2x 08 3dr LB Join Date: Oct 2008
Location: USA, CT
Posts: 13,460
|
Quote:
For example the PIC16F57 is $1.55 and has 20 I/O Pins and runs at up to 20mHz. If you're not comfortable with C or assembly programming, there is even a basic compiler for the PICs. http://search.digikey.com/scripts/Dk...IC16F57-I/P-ND |
|
04-02-2009, 09:12 PM | #12 |
Drives: Polar White Yaris HB Join Date: Dec 2008
Location: Honolulu
Posts: 263
|
This project has tons of potential and looks great! When will it be avaliable for the rest of us willing to pay?????
|
04-03-2009, 04:01 AM | #13 | |
MetalShark
Drives: 2008 Yaris LB Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
|
Quote:
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header. |
|
04-03-2009, 04:10 AM | #14 | |||
now in HD
|
Quote:
Quote:
Quote:
__________________
|
|||
04-03-2009, 06:01 AM | #15 | |
MetalShark
Drives: 2008 Yaris LB Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
|
Quote:
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header. |
|
04-04-2009, 06:26 PM | #16 | |
MetalShark
Drives: 2008 Yaris LB Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
|
Quote:
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header. |
|
04-05-2009, 06:36 AM | #17 | |
MetalShark
Drives: 2008 Yaris LB Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
|
Microchip
Quote:
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header. |
|
04-05-2009, 08:51 AM | #18 | |
ULTIMATE
Drives: 09 5dr LB, 2x 08 3dr LB Join Date: Oct 2008
Location: USA, CT
Posts: 13,460
|
Quote:
$10 Programmer for many processors: http://robokitsworld.com/index.php?m...fl6nbiqsr52nu0 $50 programmer (USB/serial): http://www.hobbyengineering.com/H3317.html Real Microchip programmers: PicKit2 (directly integrates with Microchip's development system): http://www.microchipdirect.com/Produ...mid=1&treeid=6 $220 Microchip In Circuit Debugger: The latest version is the ICD3. I use the ICD2 for most of my development work. http://www.microchipdirect.com/produ...?Keywords=icd3 To use the Pickit2 or ICD2/3 you have to add a header (or RJ11 jack) to your board to connect to. The two third party programmers allow you to plug the DIP package IC's in for programming. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
P0456 OBD code? | jlift | DIY / Maintenance / Service | 6 | 09-19-2007 03:28 PM |
Anybody know the code? | Driver | New YARIS Purchase Forum | 5 | 08-20-2006 06:56 PM |