Project issue
jknightandkarr
Posts: 234
Here's my program first of all.
My problem is, vss:=67 give me the desired display, but when I disable it to use
Dira[noparse][[/noparse]12]:=0 'Start counting vss signal
ctra:=0
ctra:=(%01010<<26)|(%001<<23)|(0<<9)|(12)
frqa:=1
phsa:=0
waitcnt(80_000_000+cnt)
vss:=phsa 'Send speed sensor value on.
ctra:=0
All I get is random numbers from my speedsensor & the speedbuffer system, which is from an 89' Trans-Am 700R4, the numbers continue even with my speed sensor stopped. I got an analog electric speedometer from a Firebird I have hooked up with the propeller, so the speedsensor & buffer works fine. I tried looking the counter program over, but I don't quite fully understand the programming. I got it from the BS2 Functions list from the propeller object exchange. What's my problem?
Joe
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol
Post Edited (jknightandkarr) : 4/28/2010 6:27:53 AM GMT
{{Vehical Speedometer Display.
8K or 4K Pulses Per Mile sending units
Displays Kph=Kilometers Per Hour or Mph=Miles Per Hour
By: Joe R on March 16th, 2010
}}
CON
_clkmode =xtal1+pll16x 'system clock
_xinfreq=5_000_000 'set 80 Mhz
isEnabled = %0001
VAR
long LowDigitPin, HighDigitPin 'The pins for specifying digits.
'Must be contiguous
'HighDigitPin can be from 0 to 7 more than LowDigitPin
long Seg0Pin, Seg8Pin 'The pins for the segments.
'Must be contiguous
'Segment 8 is the decimal point
long flags
long myStack[noparse][[/noparse]10]
long runningCogID
long myValue 'Value to be displayed
long vss 'Vehical Speed Sensor Input
long Mph 'Display In Miles Per Hour
PUB Speed(dLow, digits, s0, enabled)|kph
'' Start the display
'' Parameters:
'' dLow - the pin number of the least significant digit
'' digits - the number of digits to display (up to 8)
'' s0 - the pin number of segment 0
'' enabled - the initial enabled state
dira[noparse][[/noparse]13]:=0 'Set pin 13 as input
repeat
Dira[noparse][[/noparse]12]:=0 'Start counting vss signal
ctra:=0
ctra:=(%01010<<26)|(%001<<23)|(0<<9)|(12)
frqa:=1
phsa:=0
waitcnt(80_000_000+cnt)
vss:=phsa 'Send speed sensor value on.
ctra:=0
'vss:=67 'Temporary Speed sensor value
If ina[noparse][[/noparse]13]==0 'Look for Pin13 for 1 or 0
Mph:=vss*9 'Calibrate for 4000ppm sender if pin 13=Low
else
Mph:=vss*9/2 'Calibrate for 8000ppm Sensor if pin 13=High
If ina[noparse][[/noparse]14]==1 'Check for Mph or Kph setting
Kph:=Mph*1_609_344/1_000_000 'Display speed in Kph
else
Kph:=Mph*1 'Display speed in Mph
myValue := Kph 'Copy Kph to myValue
LowDigitPin := 8
HighDigitPin := 8 + ((4 - 1) <# 7) 'Limit to eight digits
Seg0Pin := 0
Seg8Pin := 0 + 7
dira[noparse][[/noparse]Seg0Pin..Seg8Pin]~~ 'Set segment pins to outputs
dira[noparse][[/noparse]LowDigitPin..HighDigitPin]~~ 'Set digit pins to outputs
outa[noparse][[/noparse]Seg0Pin..Seg8Pin]~ 'Turn off all segments
dira[noparse][[/noparse]LowDigitPin..HighDigitPin]~~ 'Turn off all digits
' if enabled 'Set initial enabled state
flags |= isEnabled
'else
'flags~
stop
runningCogID := cognew(ShowValue, @myStack) + 1
PUB Stop
'' Stop the display
if runningCogID
cogstop(runningCogID~ - 1)
PUB Enable
'' Enable the display
flags |= isEnabled
PUB Disable
'' Disable the display
flags &= !isEnabled
PUB SetValue(theValue)
'' Set the value to display
myValue := theValue
PRI ShowValue | digPos, divisor, displayValue
' ShowValue runs in its own cog and continually updates the display
dira[noparse][[/noparse]Seg0Pin..Seg8Pin]~~ 'Set segment pins to outputs
dira[noparse][[/noparse]LowDigitPin..HighDigitPin]~~ 'Set digit pins to outputs
repeat
if flags & isEnabled
displayValue := myValue 'take snapshot of myValue so it can't be changed
' while it is being displayed
divisor := 1 'divisor is used to isolate a digit to display
repeat digPos from 0 to HighDigitPin - LowDigitPin 'only display as many digits as there are pins
outa[noparse][[/noparse]Seg0Pin..Seg8Pin]~ 'clear the segments to avoid flicker
outa[noparse][[/noparse]LowDigitPin..HighDigitPin] := byte[noparse][[/noparse]@DigSel + digPos] 'enable the next digit
outa[noparse][[/noparse]Seg0Pin..Seg8Pin] := byte[noparse][[/noparse]@Digit0 + displayValue / divisor // 10] 'display the digit
waitcnt (clkfreq / 10_000 + cnt) 'the delay value can be tweaked to adjust
' display brightness
divisor *= 10
else
outa[noparse][[/noparse]LowDigitPin..HighDigitPin]~~ 'disable all digits
waitcnt (clkfreq / 10 + cnt) 'wait 1/10 second before checking again
DAT
'Common cathode 7-segment displays are activated by bringing the cathode to ground
DigSel byte %11111110
byte %11111101
byte %11111011
byte %11110111
byte %11101111
byte %11011111
byte %10111111
byte %01111111
'.GFEDCBA
Digit0 byte %00111111
Digit1 byte %00000110
Digit2 byte %01011011
Digit3 byte %01001111
Digit4 byte %01100110
Digit5 byte %01101101
Digit6 byte %01111101
Digit7 byte %00000111
Digit8 byte %01111111
Digit9 byte %01100111
My problem is, vss:=67 give me the desired display, but when I disable it to use
Dira[noparse][[/noparse]12]:=0 'Start counting vss signal
ctra:=0
ctra:=(%01010<<26)|(%001<<23)|(0<<9)|(12)
frqa:=1
phsa:=0
waitcnt(80_000_000+cnt)
vss:=phsa 'Send speed sensor value on.
ctra:=0
All I get is random numbers from my speedsensor & the speedbuffer system, which is from an 89' Trans-Am 700R4, the numbers continue even with my speed sensor stopped. I got an analog electric speedometer from a Firebird I have hooked up with the propeller, so the speedsensor & buffer works fine. I tried looking the counter program over, but I don't quite fully understand the programming. I got it from the BS2 Functions list from the propeller object exchange. What's my problem?
Joe
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol
Post Edited (jknightandkarr) : 4/28/2010 6:27:53 AM GMT

Comments
Ok, I don't know why the code option took out all my extra indentations, so rather then fight with it all nite, I'll just post the program directly.
Joe
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol
Yeah it takes the formatting out sometimes. It's a pain.
Without looking at your code, I would bet that you are getting electrical noise that is causing the random value.
Are you running the Propeller from the car battery ?
Can you post a schematic of your buffer ?
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are two rules in life:
· 1) Never divulge all information
Buffer......I can try, depends if I can·figure·that or not. ·It's a factory GM speed sensor buffer from·like 85& up·Trans-Am/Camaro, so it depends if I can find out what the·components that are on it are. It's a solid state unit, but I'll work on that now.
Joe
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol
Post Edited (jknightandkarr) : 4/28/2010 12:14:51 PM GMT
6758 H
CS 8609 H
on it & one large yellow component with 336K printed on it. I tried to look for scematics on the net, but no luck. It's a 4000 Pulse per mile to the speedometer & 2000 ppm to the cruise control, & unknown value to the ecm, 4K again I think. My book don't tell this value. This is about all the info I can give at this time. on the Buffer
Joe
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol
What voltage levels does the buffer output ? I hope you are not running 12V pulses directly into a propeller pin ??? That would be bad.
You will probably need a filter between the buffer output and the propeller pin. Maybe just a resistor and a cap would do it.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are two rules in life:
· 1) Never divulge all information
Joe
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Lots of propeller based products in stock at affordable prices.
Free shipping on orders over $100 and a Free LCD screen for orders over $200. Today Only(April 28th, 2010)
propmodule.com will be closed May 1-10th. Orders made in that time will be shipped on the 11th.