PDA

View Full Version : Numeric Display failing to work.



jknightandkarr
12-19-2009, 12:45 PM
StefanL38 said...
Hello jknightandkarr,

a SPIN program always starts with the first method o execute code regardless of its name

Your first method is start which just does a cognew with speedometer

Inside method speedometer you have a repeat-loop that is executed endlessly
and that's all what you program is doing. al the other lines of code are NEVER executed.

So this is a real beautiful example that a program does always what's programmed.
And if it does something different then the programmer intended, that the programmer has
not understand his programming YET.

Things like that you can find out by adding debug-output to your code that you get a feedback what and where your prgram is doing

Do you know how to add debug-output over the serial connection ?
if not drop a line

best regards

Stefan

I'm having trouble getting my display to work. Tested the leds with another simple program & they are fine, but on my speedometer program I get only a blank screen, no leds at all are lit. I used the code available here (http://obex.parallax.com/objects/142/) as the base for my program display. What am I doing wrong here? Like I said I checked my led connectrion with a simple display pattern, so I know all are hooked up & work, but in the program I'm working on nothing. Thanks.

Joe

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol

Post Edited (jknightandkarr) : 12/19/2009 5:10:46 PM GMT

StefanL38
12-19-2009, 04:04 PM
Hello jknightandkarr,

a SPIN program always starts with the first method o execute code regardless of its name

Your first method is start which just does a cognew with speedometer

Inside method speedometer you have a repeat-loop that is executed endlessly
and that's all what you program is doing. al the other lines of code are NEVER executed.

So this is a real beautiful example that a program does always what's programmed.
And if it does something different then the programmer intended, that the programmer has
not understand his programming YET.

Things like that you can find out by adding debug-output to your code that you get a feedback what and where your prgram is doing

Do you know how to add debug-output over the serial connection ?
if not drop a line

best regards

Stefan

Microcontrolled
12-19-2009, 07:09 PM
If that's EXACTLY what your code looks like you have a lot of problems. There is NO indenting, which in spin is what defines EVERYTHING! Your repeat loop is endlessly repeating nothing, and that's holding up your program, your IF loops are doing nothing if defined because nothing is indented under them, etc.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Computers are microcontrolled.

Robots are microcontrolled.
I am microcontrolled.

But you·can·call me micro.

Want to·experiment with the SX or just put together a cool project?
SX Spinning light display· (http://www.gadgetgangster.com/find-a-project/56?projectnum=200)
My overstock is killing me.
PM me for absolutly FREE 8-pin Mini Din connectors.

jknightandkarr
12-19-2009, 11:58 PM
StefanL38 said...
Hello jknightandkarr,

a SPIN program always starts with the first method o execute code regardless of its name

Your first method is start which just does a cognew with speedometer

Inside method speedometer you have a repeat-loop that is executed endlessly
and that's all what you program is doing. al the other lines of code are NEVER executed.

So this is a real beautiful example that a program does always what's programmed.
And if it does something different then the programmer intended, that the programmer has
not understand his programming YET.

Things like that you can find out by adding debug-output to your code that you get a feedback what and where your prgram is doing

Do you know how to add debug-output over the serial connection ?
if not drop a line

best regards

Stefan


The Start method will actually start 3, one is disabled & the other isn't actually written yet, but there will be 3 when it's all done. How do you do that debug-output thing. I'm not sure. I think it may be something with the original program. I've tried it & I get no display from it as well. Had messed with it before & got all gobbly gook on the display, but never a display from my program yet.


microcontrolled said...
If that's EXACTLY what your code looks like you have a lot of problems. There is NO indenting, which in spin is what defines EVERYTHING! Your repeat loop is endlessly repeating nothing, and that's holding up your program, your IF loops are doing nothing if defined because nothing is indented under them, etc.

It's indented, I'll post the program later, so you can see it.

Joe

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol

Post Edited (jknightandkarr) : 12/19/2009 5:24:16 PM GMT

StefanL38
12-20-2009, 02:48 AM
OK here is a short demo-code how the debug-output works




CON
'serial communication requires a precise clockmode
'internal oscillator-mode is much too much unprecise
'so ALWAYS use a xtal1-mode
_clkmode = xtal1 + pll16x
'when using another chrystal than 5 MHz adjust constant _xinfreq
'to the right value
_xinfreq = 5_000_000

'result of pll16x * _xinfreq should NOT exceed 80MHz
'example if _xinfreq = 10_000_000 than use pll8x instead of pll16x
'as 10_000_000 * 16 = 160MHz and 10_000_000 * 8 = 80MHz


OBJ
Debug : "FullDuplexSerial"


VAR
long MyVar1
long MyCounterVar


PUB Main
Debug.Start(31, 30,0,115200) 'start(rxpin, txpin, mode, baudrate) :
'' '"rx" and "tx" viewed from Propeller-Chip. Propeller-Chip-PIN-Tx ----> PC

Debug.Str(string("Debug.Start(31, 30,0,115200) done"))

Debug.Str(string("message right before entering the loop"))

repeat MyCounterVar from 1 to 5
Debug.Str(string("Decimal Value of variable MyCounterVar="))
Debug.dec(MyCounterVar)
Debug.Tx(13) 'carriage return
waitCnt(ClkFreq * 2 + cnt)
Debug.Tx(13) 'carriage return
Debug.Tx(13) 'carriage return

Debug.Str(string("message right after exiting the loop"))




You have to adjust PST.EXE to 115200 baus 8N1 to get the correct characters

best regards

Stefan

jknightandkarr
12-20-2009, 04:29 AM
Cool, Thanks.

Joe

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol

jknightandkarr
12-20-2009, 04:36 AM
Speedometer.spin (http://www.newarkknights.net/speedometer.zip)
Here is my program. I had to zip it up & post it, for some reason I couldn't access it unzipped.

Joe

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol

StefanL38
12-20-2009, 01:47 PM
in the attachment I have added debug-output to show you what is going on

best regards

Stefan

jknightandkarr
12-21-2009, 04:34 AM
Oh Thank you. Really appreciate that.

Joe

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol

w8an
12-21-2009, 11:35 AM
Joe,

What I see right away is your Start routing launches the Speedometer routine. The Speedometer routine then perpetually initializes some of your vars in a non-terminating repeat loop.

The command that launches the display multiplexer (ShowValue) is actually after this endless loop so it will never execute. Even if the display was started, you are not sending it any value to show (the SetValue) routine.

Try out and study the demo and that came with the seven-segment functions you got from Obex and I think you'll understand why you're having problems.

Steve

jknightandkarr
12-21-2009, 01:33 PM
w8an said...
Joe,

What I see right away is your Start routing launches the Speedometer routine. The Speedometer routine then perpetually initializes some of your vars in a non-terminating repeat loop.

The command that launches the display multiplexer (ShowValue) is actually after this endless loop so it will never execute. Even if the display was started, you are not sending it any value to show (the SetValue) routine.

Try out and study the demo and that came with the seven-segment functions you got from Obex and I think you'll understand why you're having problems.

Steve


I just noticed that a section in my code wasn't indented, so that's probly one source of the issue. Thanks for the help everyone.

Joe

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm going insaine. It's SOOOOOO much fun. lol