10/10 is 1..... right?
CannibalRobotics
Posts: 535
I have this little snippet of SPIN that is misbehaving. For all values of 'val' between 0 and 99, the value that arrives in cf.drawlevel is an integer truncated·val/10 which is correct, ie. if Val = 40 going in, the Val arriving is 40/10 or 4. This works fine for everything except 10.
If the value coming in through SingVol is Val=10, the arrival data·at cf.drawlevel 10 also?
10/10 is 1 right?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Signature space for rent!
Send $1 to CannibalRobotics.com.
If the value coming in through SingVol is Val=10, the arrival data·at cf.drawlevel 10 also?
10/10 is 1 right?
Pub SingVol(Chan,Val) '' Sets volume in I2C format and updates displays SetVol(Chan,Val) cb.SetControl(44 + Chan,Val) val := val / 10 cf.drawlevel(val)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Signature space for rent!
Send $1 to CannibalRobotics.com.
Comments
Any other suggestions?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Signature space for rent!
Send $1 to CannibalRobotics.com.
Display what the values are at various points. See what is happening to a variable at different points.
For the propeller, I use the FullDuplexSerial object to display values on the Parallax serial terminal.
Might want to search these forums to read more about using that object. But here are the "ingredients"...
A fast clock speed...
CON
· _xinfreq = 5_000_000····················
· _clkmode = xtal1 + pll16x
Include the object and rename it to "Debug"...
OBJ
· Debug : "FullDuplexSerial"
Start the object by placing this·in the PUB section...
Debug.start(31, 30, 0, 115200)
Then you can display things on the terminal like this...
Debug.str(string("Hi There!"))
Display the value in decimal of the variable tenthsec...
Debug.dec(tenthsec)
Carrage return...
Debug.tx(Debug#CR)
Load the program to EEPROM,·get your serial terminal up and click on enable, set the baud to 115200.
Then click reset on the propeller.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
To
and
to
·And it works. Seems to me that moving this operation from one cog to another should not change the outcome of the math?
PS: There is a 'debug' statement at the end of the 'case' showing me what the value is.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Signature space for rent!
Send $1 to CannibalRobotics.com.
Post Edited (CannibalRobotics) : 5/5/2010 9:47:52 PM GMT
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lonesock
Piranha are people too.