Shop OBEX P1 Docs P2 Docs Learn Events
Odd bug — Parallax Forums

Odd bug

asynchronous13asynchronous13 Posts: 2
edited 2006-07-13 15:45 in BASIC Stamp
I think this might be a memory error or something, but I can't figure out how to fix it.

The project I'm working on is persistance of vision on a bicycle wheel.

At the beginning of the program, I define some text phrases, like so:

text0 DATA "CRITICALMASS.ORG ",255
text1 DATA "FASTER MUSTACHE ",255
text2 DATA "SOPO BIKES ",255



and everything is fine, until I add the 5th phrase. At that point, everything keeps working, except the 'space' character in every phrase has 3 dots in it.

I guess I have to go deeper into how the program works...

First, I made an alphabet/font for the LEDs (dots are off, ones are on).


' .111. ' 1111. ' .111. ' 111.. ' 11111
' 1...1 ' .1..1 ' 1...1 ' 1..1. ' 1....
' 1...1 ' .1..1 ' 1.... ' 1...1 ' 1....
' 11111 ' .111. ' 1.... ' 1...1 ' 1111.
' 1...1 ' .1..1 ' 1.... ' 1...1 ' 1....
' 1...1 ' .1..1 ' 1...1 ' 1..1. ' 1....
' 1...1 ' 1111. ' .111. ' 111.. ' 11111
letterA DATA 5,$3F,$48,$48,$48,$3F
letterB DATA 5,$41,$7F,$49,$49,$36
letterC DATA 5,$3E,$41,$41,$41,$22
letterD DATA 5,$7F,$41,$41,$22,$1C
letterE DATA 5,$7F,$49,$49,$49,$41




The first data point is how many columns are in the letter, (mostly 5, but some letter like 'W' or 'M' are wider). The following N bytes define how the letter looks.

Then there's the code to display one letter: It just cycles through the data for one letter, and outputs that to the LEDs.


' --------- Display One Letter Routine
oneLetter:
READ letter, numColumns
FOR column = (letter+1) TO (letter+numColumns)
 READ column, LEDvalue
 OUTL = LEDvalue
NEXT
' put a little space between letters
OUTL = 0
RETURN



Then the code to display an entire phrase:
scanPhrase:
  READ phrase, nextLetter
  IF nextLetter = 255 THEN phraseDone
  LOOKDOWN nextLetter, [noparse][[/noparse]"ABCDEFGHIJKLMNOPQRSTUVWXYZ ."], nextLetter
  LOOKUP nextLetter, [noparse][[/noparse]letterA,letterB,letterC, ... ,letterZ,letterSpace,letterDot], letter
  GOSUB oneLetter
  phrase = phrase + 1
GOTO scanPhrase




Then there's some code to cycle through all the phrases. Like I said, with 4 phrases, everything is fine. With 5 or more phrases, all the letters display ok EXCEPT for the 'space' character. It ends up looking like this:
' ..1..
' .....
' ..1..
' .....
' ..1..



I've tried adding some dummy data, in case their was a bad memory location. And I just can't see anything in the code that would change the output based on the number of phrases that are in memory.

Any ideas?

Post Edited (asynchronous13) : 7/28/2006 2:04:38 AM GMT

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-12 21:03
    Hey, man -- this is a family show.
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2006-07-12 23:15
    First, we need to see the entire code.

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-07-13 15:45
    And if you do post the code, post it as an attachment, PLEASE.

    Easiest way to do that is create a 'Quick Reply', submit it, then Edit (with the little 'pencil' icon) the reply, click the Attachment, and enter the path to your file.
Sign In or Register to comment.