Shop OBEX P1 Docs P2 Docs Learn Events
Confusion! — Parallax Forums

Confusion!

I am using the "Spin code examples for beginners (public version)". The fun example uses the LED's on the demo board to display a bitmap pattern stored in a data table. Code by Beau Schwabe (parallax). Dave Scanlan 2006-03-04. It is about in the center of the page. I typed this program in and it did not work. The start of the program douse not look right. Could someone ex plane what I am seeing. Thank you for your help. 2 feb 2019(sat)

Comments

  • PublisonPublison Posts: 12,366
    edited 2019-02-02 18:43
    Link to the publications please so we can respond correctly?

    Or post the code in the "Code" tags.

  • http://forums.parallax.com/discussion/83915/spin-code-examples-for-the-beginner-public-version/p1
    This is the page that I was referring to that has the problem with the spin code " Fun examples using the LED's on he demo board to display a bit pattern stored in a data table". Center of page. I thought that there was only one page of the help. There are a lot of pages!!!Thank you for your help. 2 feb 2019(sat)
  • Iguanaman wrote: »
    http://forums.parallax.com/discussion/83915/spin-code-examples-for-the-beginner-public-version/p1
    This is the page that I was referring to that has the problem with the spin code " Fun examples using the LED's on he demo board to display a bit pattern stored in a data table". Center of page. I thought that there was only one page of the help. There are a lot of pages!!!Thank you for your help. 2 feb 2019(sat)

    Which Example #? And you need to post the code you typed in. Did you try and Cut/Paste code from the unzipped files?

  • ''** Fun example uses the LED's on the demo board to display a bitmap **
    ''** pattern stored in a data table **
    ''********************************************************************************
    '' Coded by Beau Schwabe (Parallax). **
    ''********************************************************************************
    ''
    '' Directions:
    '' Load the program. LED's will appear to ALL be on.
    '' Rapidly move the demo board back-n-forth.
    '' (unplug USB2SER connector first-grin
    ''
    ''
    '' Other options to this program would be to use an accelerometer
    '' to determine which direction/speed you are moving, and display
    '' an actual message forward or backward accordingly.
    _xinfreq = 5_000_000 'Set crystal frequency to 5 MHz
    _clkmode = xtal1 + pll16x 'wind it up to 80 MHz via a X16 PLL

    CON
    Rate = 50_000 'Set motion rate.

    VAR

    PUB Message | scan
    dira[noparse][[/noparse]16..23] := %11111111 'Make I/O's 16 to 23 OUTPUTs

    repeat 'Enter Endless Loop
    repeat scan from 0 to 26 'Create an offset index from 0 to 26
    outa[noparse][[/noparse]16..23] := Propeller[noparse][[/noparse]scan] 'Lookup byte value in data table at offset 'scan'
    waitcnt(Rate + cnt) 'pause so we can see something

    DAT
    Propeller byte %00000000
    byte %00010000
    byte %00111000
    byte %01111100
    byte %11111110
    byte %01111100
    byte %00111000
    byte %00010000
    byte %00000000

    byte %00000000
    byte %11111111
    byte %10000001
    byte %10000001
    byte %10000001
    byte %11111111
    byte %00000000

    byte %00000000
    byte %10000000
    byte %01000000
    byte %00110000
    byte %00011000
    byte %00000111
    byte %00011000
    byte %00110000
    byte %01000000
    byte %10000000
    byte %00000000
    I hope this helps. I will copy and past more often. Thank you for your help. I removed the [noparse]. 2 feb 2019(sat)
  • If you use the "Code Tags", The Big C in the post, it looks like this:
    ''********************************************************************************
    ''** Fun example uses the LED's on the demo board to display a bitmap           **
    ''** pattern stored in a data table                                             **
    ''********************************************************************************
    '' Coded by Beau Schwabe (Parallax).                                            **
    ''********************************************************************************
    ''
    ''                    Directions:
    ''                    Load the program. LED's will appear to ALL be on.
    ''                    Rapidly move the demo board back-n-forth.
    ''                    (unplug USB2SER connector first-grin
    ''            
    ''
    '' Other options to this program would be to use an accelerometer
    '' to determine which direction/speed you are moving, and display
    '' an actual message forward or backward accordingly.
      _xinfreq      = 5_000_000          'Set crystal frequency to 5 MHz
      _clkmode      = xtal1 + pll16x     'wind it up to 80 MHz via a X16 PLL
     
    CON
      Rate = 50_000                      'Set motion rate.
     
    VAR
     
    PUB Message | scan
      dira[noparse][[/noparse]16..23] := %11111111          'Make I/O's 16 to 23 OUTPUTs
      
      repeat                             'Enter Endless Loop
        repeat scan from 0 to 26         'Create an offset index from 0 to 26
         outa[noparse][[/noparse]16..23] := Propeller[noparse][[/noparse]scan] 'Lookup byte value in data table at offset 'scan'
         waitcnt(Rate + cnt)             'pause so we can see something
     
    DAT
    Propeller     byte %00000000
                  byte %00010000
                  byte %00111000
                  byte %01111100
                  byte %11111110
                  byte %01111100
                  byte %00111000
                  byte %00010000
                  byte %00000000
     
                  byte %00000000
                  byte %11111111
                  byte %10000001
                  byte %10000001
                  byte %10000001
                  byte %11111111
                  byte %00000000
     
                  byte %00000000
                  byte %10000000
                  byte %01000000
                  byte %00110000
                  byte %00011000
                  byte %00000111
                  byte %00011000
                  byte %00110000
                  byte %01000000
                  byte %10000000
                  byte %00000000
    
  • PublisonPublison Posts: 12,366
    edited 2019-02-02 22:00
    What is your specific problem? I used this program about 8 years ago and it worked fine. You have a Propeller Demo Board 32100?

    You have to move the board back and forth pretty aggressively to see the results.
  • Iguanaman,

    Which Parallax Propeller board are you using because I see that example program uses I/O pins 16 to 23?

    I also see that example is about half-way down the page and there is a SPIN file attached, which is what you should be using.
    DisplayBitmapPatternVer2.spin

    The listed code has some issues in addition to the [NoParse] and [/NoParse].
    The constants XinFreq and ClkMode should both be in the CON section and the code should be indented for functionality and clarity.

    As an example, the code to be to repeated should have at least one space under the Repeat command.
    Propeller Tool will show white lines from the Repeat statement to the lines of code that will be repeated.

    Much of this is explained in the Propeller Education Kit text.
  • I have the Propeller Education kit 40-pin dip with breadboard. It comes in a fishing tackel box with compartments. I have been running lots of programs with it. It is very nice. 2 feb 2019(sat)
  • PublisonPublison Posts: 12,366
    edited 2019-02-02 23:00
    Iguanaman wrote: »
    I have the Propeller Education kit 40-pin dip with breadboard. It comes in a fishing tackel box with compartments. I have been running lots of programs with it. It is very nice. 2 feb 2019(sat)

    OK, You first said you where using the Parallax Demo Board which has built in LED's.

    Now you have to show a picture of your setup a tells us exactly what is not working.
  • PublisonPublison Posts: 12,366
    edited 2019-02-02 23:37
    The forum software corrupted the last code posting inserting with some [noparse] statements. I checked this one to compile correctly.
    ''********************************************************************************
    ''** Fun example uses the LED's on the demo board to display a bitmap           **
    ''** pattern stored in a data table                                             **
    ''********************************************************************************
    '' Coded by Beau Schwabe (Parallax).                                            **
    ''********************************************************************************
    ''
    ''                    Directions:
    ''                    Load the program. LED's will appear to ALL be on.
    ''                    Rapidly move the demo board back-n-forth.
    ''                    (unplug USB2SER connector first-grin
    ''            
    ''
    '' Other options to this program would be to use an accelerometer
    '' to determine which direction/speed you are moving, and display
    '' an actual message forward or backward accordingly.
      _xinfreq      = 5_000_000          'Set crystal frequency to 5 MHz
      _clkmode      = xtal1 + pll16x     'wind it up to 80 MHz via a X16 PLL
     
    CON
      Rate = 50_000                      'Set motion rate.
     
    VAR
     
    PUB Message | scan
      dira [16..23] := %11111111          'Make I/O's 16 to 23 OUTPUTs
      
      repeat                             'Enter Endless Loop
        repeat scan from 0 to 26         'Create an offset index from 0 to 26
         outa [16..23] := Propeller[scan] 'Lookup byte value in data table at offset 'scan'
         waitcnt(Rate + cnt)             'pause so we can see something
     
    DAT
    Propeller     byte %00000000
                  byte %00010000
                  byte %00111000
                  byte %01111100
                  byte %11111110
                  byte %01111100
                  byte %00111000
                  byte %00010000
                  byte %00000000
     
                  byte %00000000
                  byte %11111111
                  byte %10000001
                  byte %10000001
                  byte %10000001
                  byte %11111111
                  byte %00000000
     
                  byte %00000000
                  byte %10000000
                  byte %01000000
                  byte %00110000
                  byte %00011000
                  byte %00000111
                  byte %00011000
                  byte %00110000
                  byte %01000000
                  byte %10000000
                  byte %00000000
    
  • Iguanaman,

    This may sound like a stupid question but have you gotten a single LED to blink and at different rates?

    And since your are using the Propeller on a breadboard it is very important that you check, double check, triple check, etc your wiring or "the magic smoke will escape".
Sign In or Register to comment.