#rem
Four cylinder motorcycle carburettor balancing tool using 4 map sensors
By R. A. Hodge. 2011/01/04
Manifold Absolute Pressure Sensor data
(frequency output)
29.92 inHg= Sea Level
100 kPa = Sea Level
Manifold Vacuum MAP Frequency
inHg PSI kPa Hz My Display
0.00 0.00 0.0 159 95
3.00 1.47 10.16 150 90
5.00 2.46 16.93 146 88
6.00 2.95 20.32 141 85
8.00 3.93 27.09 134 80
9.00 4.42 30.48 133 80
11.00 5.40 37.25 126 76
12.00 5.89 40.64 125 75
13.00 6.39 44.02 121 73
14.00 6.88 47.41 119 71
15.00 7.37 50.80 117 70
16.00 7.86 54.18 114 68
17.00 8.35 57.57 111 67
18.00 8.84 60.95 109 65
19.00 9.33 64.34 107 64
20.00 9.82 67.73 104 62
21.00 10.31 71.11 102 61
23.00 11.30 77.89 97 58
24.00 11.79 81.27 95 57
27.00 13.26 91.43 88 53
30.00 14.73 101.59 80 48
4 bit mode LCD Example for Picaxe 28X2
Based on Hippy's code by Svejk,
modified for Picaxe 18M2 by me.
b.7 --> DB7
b.6 --> DB6
b.5 --> DB5
b.4 --> DB4
b.3 --> EN
b.2 --> RS
#endrem
#picaxe 18M2
setfreq m8
dirsB = $FF
SYMBOL MAP1 = b20
SYMBOL MAP2 = b21
SYMBOL MAP3 = b22
SYMBOL MAP4 = b23
symbol Counter = b27
symbol chr = b26
'LCD
symbol RSCMDmask = %00000000 'select Command register
symbol RSDATmask = %00000100 'select Data register
symbol En = b.3
symbol rsbit = b25
'OnPowerUp:
eeprom 0, ($33, $32, $28, $0C, $06, $01)
'Initialise LCD:
pause 50
for counter = 0 to 5
read counter, Chr
gosub SendCmdLCD
pause 30
next counter
;Message:
chr = $80 'send cursor to begining of top line
GOSUB SendCmdLCD
for counter = 0 to 15
lookup counter, ("Carbie Balancer"), chr
gosub SendDataLCD
next counter
chr = $C0 'send cursor to begining of bottom line
GOSUB SendCmdLCD
for counter = 0 to 15
lookup counter, ("by R. A. Hodge "), chr
gosub SendDataLCD
next counter
pause 6000
'DisplayTopLine:
chr = $80 'send cursor to begining of top line
GOSUB SendCmdLCD
for counter = 0 to 15
lookup counter, ("CARB 1 2 3 4 "), chr
gosub SendDataLCD
next counter
'DisplayEndBotLine:
chr = $C0 'send cursor to display 'READ' on bottom line
GOSUB SendCmdLCD
for counter = 0 to 15
lookup counter, ("READ "), chr
gosub SendDataLCD
next counter
do 'main program
count C.0, 1200, MAP1 ' count pulses in 0.6 seconds each sample
count C.1, 1200, MAP2 ' or 2.4 seconds total sample time
count C.2, 1200, MAP3
count C.6, 1200, MAP4
bintoascii MAP1,b0,b1,b2 'convert No.1 sensor data to ascii
chr = $C5 'send cursor to under the number '1'
GOSUB SendCmdLCD
FOR counter = 0 TO 1 'display counts on lcd
lookup counter, (b1,b2), chr
gosub SendDataLCD
next counter
bintoascii MAP2,b0,b1,b2 'convert No.2 sensor data to ascii
chr = $C8 'send cursor to under the number '2'
GOSUB SendCmdLCD
FOR counter = 0 TO 1 'display counts on lcd
lookup counter, (b1,b2), chr
gosub SendDataLCD
next counter
bintoascii MAP3,b0,b1,b2 'convert No.3 sensor data to ascii
chr = $CB 'send cursor to under the number '3'
GOSUB SendCmdLCD
FOR counter = 0 TO 1 'display counts on lcd
lookup counter, (b1,b2), chr
gosub SendDataLCD
next counter
bintoascii MAP4,b0,b1,b2 'convert No.4 sensor data to ascii
chr = $CE 'send cursor to under the number '4'
GOSUB SendCmdLCD
FOR counter = 0 TO 1 'display counts on lcd
lookup counter, (b1,b2), chr
gosub SendDataLCD
next counter
loop
'LCD Routines
SendCmdLCD:
RSbit = RSCMDmask
SendDataLCD:
pinsB = chr & %11110000 | rsbit
pulsout En, 2
pinsB = chr * %00010000 | rsbit
pulsout En, 2
rsbit = RSDATmask
return