Shop OBEX P1 Docs P2 Docs Learn Events
jazzed mcu Simulator - Page 4 — Parallax Forums

jazzed mcu Simulator

124»

Comments

  • mindrobotsmindrobots Posts: 6,506
    edited 2014-05-01 16:13
    No worries, it all sounds good!

    I don't play on demand, I certainly don't expect you to push on demand!! :smile:
  • kuronekokuroneko Posts: 3,623
    edited 2014-05-01 17:18
    Rsadeika wrote: »
          ...
    :Main                        
          waitcnt Time, Delay  ' Wait
          jmp :flashon
          waitcnt Time, Delay  ' Wait
          jmp :flashoff
          ...
    
    What exactly does the jmp :flashon do?

    Also, the use of ret requires a call (or jmpret).
  • jazzedjazzed Posts: 11,803
    edited 2014-05-01 18:43
    Ok, pushed my changes.

    There is a "New" button. Press that (so that it looks pressed) and it will cause "Debug" to break on any coginit ... including the first one that loads the spin interpreter. Press it again to not stop on any coginit while "Debug" is running.

    Debug performance should be better now. You can set delay to 1 and the program will still respond.

    I'm no longer trying to track instruction cycles in debug mode. That is rdlong will not "stutter" anymore.

    Hopefully you guys can't break this version. If it looks good, I'll cut it in as an option for running on PropellerIDE.

    I'd still like to add a logic analyzer and device options at some point.
  • jazzedjazzed Posts: 11,803
    edited 2014-05-01 18:48
    Here's a snapshot of "Run" on Linux Mint.

    attachment.php?attachmentid=108465&d=1398995284
    1019 x 628 - 30K
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-05-01 18:53
    jazzed wrote: »
    There is a "New" button. Press that (so that it looks pressed) and it will cause "Debug" to break on any coginit ... including the first one that loads the spin interpreter. Press it again to not stop on any coginit while "Debug" is running.

    What a neat idea!! :lol:

    I'll hit the ground testing tomorrow morning! (There's probably some work stuff people want me to do...but I'll adjust!)

    I thought we were supposed to try and break it?

    Launching from PropellerIDE into a debugger will be pretty cool. It's like a complete IDE! :smile:

    Thanks, Steve (and Dave),,,,,another great creation!
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-05-02 04:32
    I was leaning towards a program to test all of the previous things that were talked about, but ... The program below is the best that I could come up with, maybe the experts can add to this to cover the missing items.

    I am still not sure about that clock thing, I liked that hypnotic spiraling doodad :-), other than that it seems to working as expected.

    Ray
    CON
       _clkmode = xtal1 + pll16x
       _xinfreq = 5_000_000
       
    PUB Main
       cognew(@ToggleP18,0)
       coginit(0,@Tasker, 0)
    
    DAT
     {Tasker P16 & P17}
        org 0
        
    Tasker   mov Task2, #P17_led
    
    P16_led ' Task for P16
           mov  dira, Pin
           mov  Time, cnt
           add  Time, Delay
                 
        jmpret Task1, Task2
           waitcnt Time, Delay
           xor outa, Pin
           waitcnt Time, Delay
           xor outa, Pin    
        jmpret Task1, Task2
        jmp #P16_led
        
    P17_led ' Task for P17
           
        jmpret Task2, Task1   
           mov dira, Pin1
           mov Time1, cnt
           add  Time1, Delay1
           waitcnt Time1, Delay1
           xor outa, Pin1
           waitcnt Time1, Delay1
           xor outa, Pin1
                     
        jmpret Task2, Task1
        jmp #P17_led
    
    ' Just in case
        jmp #$
        
    
    Pin   long    |< 16
    Delay long    80_000_000
    Pin1 long |< 17
    Delay1 long 80_000_000/2
    
    Time  res 1
    Time1 res 1
    Task1  res 1
    Task2  res 1
    
    {Toggle P18}
            org 0
    ToggleP18     mov dira, Pin2
               mov Time2, cnt
              add  Time2, Delay2
    :loop waitcnt Time2, Delay2
               xor outa, Pin2
          waitcnt Time2, Delay2
               xor outa, Pin2
               jmp #:loop 
    
    ' Just in case
        jmp #$
    
    Pin2 long |< 18
    Delay2 long 80_000_000/4
    Time2 res 1
    
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-05-02 06:27
    The program below works as expected on the QS board, but on the Simulator it works differently. The P16 is flashing very quickly and not the desired delay rate.

    Ray

    CON
       _clkmode = xtal1 + pll16x
       _xinfreq = 5_000_000
       
    PUB Main
    
       coginit(0,@Start,0)
       
    DAT
        org 0
    
    Start
    
           mov  dira, Pin   ' make pin an output
           mov  Time, cnt   ' Calculate delay time
           add  Time, Delay
    
    :Main                        
          waitcnt Time, Delay  ' Wait
          call #flashon
          waitcnt Time, Delay  ' Wait
          call #flashoff
          jmp :Main
          
    flashon       xor  outa, Pin   ' set output pin high
    flashon_ret      ret
    
    flashoff      xor  outa, Pin    ' make pin low?
    flashoff_ret     ret
    
         ' Just in case 
           jmp #$            ' end processor loop
    '       jmp #$+1          ' end Simulator loop
    '       jmp #$-1
    
    Pin   long    |< 16
    Delay long   80_000_000
    Time        res 1
    temp        res 1
    
    
  • jazzedjazzed Posts: 11,803
    edited 2014-05-02 06:48
    Rsadeika wrote: »
    The program below works as expected on the QS board, but on the Simulator it works differently. The P16 is flashing very quickly and not the desired delay rate.
    The jump to :Main must be "immediate": jmp #:Main

    Using # in #:Main says jump to that location.
    Omitting the # means jump to the contents of that location.
  • kuronekokuroneko Posts: 3,623
    edited 2014-05-02 19:23
    jazzed wrote: »
    The jump to :Main must be "immediate": jmp #:Main
    Regardless, the simulator should show the same behaviour?
  • jazzedjazzed Posts: 11,803
    edited 2014-05-02 20:14
    kuroneko wrote: »
    Regardless, the simulator should show the same behaviour?

    Hi Marko!

    It does the right thing in that case as far as I can tell. The posted code was just wrong.

    Any help flushing out problems in the simulator is certainly appreciated.
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-05-03 05:59
    The program below works as expected in the Simulator, but does not work very well on the QS board. In the Simulator checking and unchecking P0 turns the P16 on or off. On the QS board I was expecting to see the LED turn on, on the first press, and then turn off on the next press. Not sure as to how that could be solved.

    Since the PropellerIDE provides a way to do terminal IO programs, will the Simulator be a able to simulate also?

    Ray

    CON
       _clkmode = xtal1 + pll16x
       _xinfreq = 5_000_000
       
    PUB Main
    
       coginit(0,@Start,0)
    
    DAT
                 org 0
    
    Start 
           mov    dira, Pin  ' set pin direction
           mov   outa, #0    ' make all outputs low
    :loop
           mov   temp, ina   ' grab the input
           and   temp, #1    ' mask out all but P#0
           tjz   temp, #:flashoff
           mov   outa, Pin   ' else set output pin high
           jmp   #:loop      ' and then loop
     
    
    
    :flashoff
          mov  outa, #0
    '      xor  outa, Pin    ' make pin low
          jmp #:loop
    'flashoff_ret     ret
    
    
         ' Just in case 
           jmp #$ 
    
    Pin   long    |< 16
    temp        res 1
    
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-05-03 06:33
    The QS touch pads aren't simple switches. They need special treatment to read as shown in the Whack-a-mole program. I haven't found the PASM version of this code.

    Hook up a push button or switch (with a resistor) to the input pin on the QS and it will work like the simulator.
Sign In or Register to comment.