Shop OBEX P1 Docs P2 Docs Learn Events
debug statement weirdness — Parallax Forums

debug statement weirdness

jay_harlowjay_harlow Posts: 43
edited 2023-01-26 23:44 in PASM2/Spin2 (P2)

Propeller Tool 2.9.2

Where did the debug("hello ", ubin(mask), ubin(match)) output go?

I don't see it

  {Object_Title_and_Purpose}
  DEBUG_LOG_SIZE = 65536
  'debug_main = true

CON
  _clkfreq = 180_000_000

  IO = 0
  pinCAN_INT    = IO + 4 ' INT

VAR
  long  stack1[6]

PUB Main() | mask, match
  mask := decod pinCAN_INT
  match := decod pinCAN_INT
  debug("hello ", ubin(mask), ubin(match))

  cogspin(NEWCOG, Collector(), @stack1)

PUB Collector() | cs, clk, sdo, sdi, index

  debug(`LOGIC MyLogic TITLE 'CANBUS I/O' SAMPLES 256 'Index' 1 gray 'CLK' 1 ORANGE 'CS' 1 MAGENTA 'SDO' 1 RED 'SDI' 1 BLUE)
  'repeat
    index += 1
    CLK := index // 2
    CS :=  trunc(getrnd()) // 4
    SDO := trunc(getrnd()) // 4
    SDI := trunc(getrnd()) // 4
    debug(`MyLogic `udec_(index, CLK, CS, SDO, SDI))

  cogstop(CogId())

Comments

  • evanhevanh Posts: 15,184

    Use three back-ticks to quote code.

  • evanhevanh Posts: 15,184

    Try adding a repeat below the cogspin(NEWCOG, Collector(), @stack1)

  • hey thanks, much better now.

      {Object_Title_and_Purpose}
      DEBUG_LOG_SIZE = 65536
      'debug_main = true
    
    CON
      _clkfreq = 180_000_000
    
      IO = 0
      pinCAN_INT    = IO + 4 ' INT
    
    VAR
      long  stack1[6]
    
    PUB Main() | mask, match
      mask := decod pinCAN_INT
      match := decod pinCAN_INT
      debug("hello ", ubin(mask), ubin(match))
    
      cogspin(NEWCOG, Collector(), @stack1)
    
    PUB Collector() | cs, clk, sdo, sdi, index
    
      debug(`LOGIC MyLogic TITLE 'CANBUS I/O' SAMPLES 256 'Index' 1 gray 'CLK' 1 ORANGE 'CS' 1 MAGENTA 'SDO' 1 RED 'SDI' 1 BLUE)
      repeat
        index += 1
        CLK := index // 2
        CS :=  trunc(getrnd()) // 4
        SDO := trunc(getrnd()) // 4
        SDI := trunc(getrnd()) // 4
        debug(`MyLogic `udec_(index, CLK, CS, SDO, SDI))
    
      cogstop(CogId())
    
  • I found a simple workaround

      debug(if(true), "hello ", ubin(mask), ubin(match))
    

    Which demonstrates a new limitation:

    debug(if(my_flag), `MyLogic `udec_(index, CLK, CS, SDO, SDI))
    

    I would like to turn the myLogic line on and off, just like other debug statements.

    Jay

Sign In or Register to comment.