Shop OBEX P1 Docs P2 Docs Learn Events
Exceed maximum nested in SPIN? — Parallax Forums

Exceed maximum nested in SPIN?

MacTuxLinMacTuxLin Posts: 821
edited 2010-08-09 22:10 in Propeller 1
Hi All,

May I know if there are any error msg when compiling if the number of nested block is more than 8 or will I just experience weird results including prop restarting in the mist of running the code?

Comments

  • BradCBradC Posts: 2,601
    edited 2010-08-09 21:19
    Error message in Prop Tool. I'm pretty sure bstc will let you just keep going.
  • MacTuxLinMacTuxLin Posts: 821
    edited 2010-08-09 21:59
    Thanks Brad.

    Just done another test script that blinks the LED. If I have 9 repeat loops within a method, yes, compile error. But if I break into sub methods, it compiled without errors but had funny results. Reason I asked is because my main project has similar nesting process but I tend to get very weird results (e.g. prop hanging & restarting). Ruled out hardware as I've tried different prop & PC I'll continue debugging ...

    This one is working:
    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    PUB Main
      dira[6..7]~~
      dira[22..23]~~
      outa[6..7]~~
      outa[22..23]~~
      waitcnt(clkfreq/2 + cnt)
       repeat
        repeat
          repeat
            repeat
              TryThis
    
    PRI TryThis
    
      repeat
        repeat
          repeat
    
            !outa[6..7]
            !outa[22..23]
            waitcnt(clkfreq/2 + cnt)
        
          repeat
            repeat
              TryThisAgain
    
    PRI TryThisAgain
      repeat
        repeat
          repeat
            repeat
              !outa[6..7]
              !outa[22..23]
              waitcnt(clkfreq/2 + cnt)          
    


    But, this one is not working right:
    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    PUB Main
      dira[6..7]~~
      dira[22..23]~~
      outa[6..7]~~
      outa[22..23]~~
      waitcnt(clkfreq/2 + cnt)
       repeat
        repeat
          repeat
            repeat
              TryThis
    
    PRI TryThis
    
      repeat
        repeat
          repeat
    {
            !outa[6..7]
            !outa[22..23]
            waitcnt(clkfreq/2 + cnt)
    }    
          repeat
            repeat
              TryThisAgain
    
    PRI TryThisAgain
      repeat
        repeat
          repeat
            repeat
              !outa[6..7]
              !outa[22..23]
              waitcnt(clkfreq/2 + cnt)
               
    
  • MacTuxLinMacTuxLin Posts: 821
    edited 2010-08-09 22:10
    Gzee .... found my own bug in this LED test script. So I guess as long as there are 8 or less nest within a method is fine then. ... Back to debug my project.
Sign In or Register to comment.