Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Tool for Windows Alpha Release Supports P2 - Page 2 — Parallax Forums

Propeller Tool for Windows Alpha Release Supports P2

2»

Comments

  • JonnyMacJonnyMac Posts: 8,926
    edited 2020-07-11 19:28
    The pinx() instructions are helpful because they correspond directly to P2ASM instructions and automatically take care of the correct pin group (remember, there are A and B pin groups).

    I, too, am looking forward to device detection by the new Propeller Tool -- I frequently load up my P2 template and press F10 after some changes, only to be met by compiler complaints because it defaults to P1. Jeff has indicated that he's going to do something similar in PT as he did with the BASIC Stamp tool, so an embedded comment can be used to identify the device. I have this in my code now, just waiting for the compiler to see it!

    I don't know if you saw it, but I wrote a Spin2 object for the LED matrix that gives you pretty complete control. You can find it here:
    -- https://github.com/parallaxinc/propeller/blob/master/libraries/community/p2/All/jm_p2es_matrix/jm_p2-es_matrix.spin2

    You should probably ignore the old files in the other repository -- they were written a lot time ago, and Spin2 has matured since then.
  • Jon you are obviously using you covid time to move a lot of your P1 stuff to the P2.

    This is absolutely wonderful because hopefully other people will adapt to your comment and code standard.

    I will try to do so, but - heck - I like to read code and yours is usually very pleasing to the eyes..

    So just a thank you out of Clearlake Oaks, CA

    Mike
  • VonSzarvasVonSzarvas Posts: 3,278
    edited 2020-07-11 21:36
    This update to the matrix code runs on the new Propeller Tool.

    (Sure the code could be improved, but it's a quick fix to get you started!)
    ' test_LEDMATRIX.spin2
    '
    
    
    
    CON
    
      basepin=32
      
      
    
    PUB Main() | r, c, speed
     
      speed := 10
    
      repeat
    
       pintoggle(56) ' Toggle P2-EVAL LED to indicate test is running
    
       speed:= speed + 1000
    
       if speed > 10000
            speed := 100
    
       
       repeat r from 0 to 7
    
            pinhigh(basepin + r)
    
            repeat c from 0 to 7
    
                if c == r
                    next
    
                if r==7 and c==7
                    next
    
                pinlow(basepin + c)
    
                'waitcnt(clkfreq / 100000 + cnt) ' Minimal delay for mfg test, to get all LEDs visible at once (very dim)
                'waitcnt(clkfreq / speed + cnt)   ' Use longer delay to see some scroll action; changing speed value for demo
                waitms(1)
                
                pinfloat(basepin + c)
                
    
            pinfloat(basepin + r)
    
  • VonSzarvasVonSzarvas Posts: 3,278
    edited 2020-07-11 21:41
    Oh.. I hadn't refreshed the forum page to see Jon has already posted a newer solution.

    I'll leave the sample above, but probably Jon's will be clearer, and much better :)
    The test_LEDMATRIX.spin2 code was just intended to create scrolling patterns for testing.
Sign In or Register to comment.