Shop OBEX P1 Docs P2 Docs Learn Events
PST Debug Lite, working but port directions defined in other objects are showing as inputs. — Parallax Forums

PST Debug Lite, working but port directions defined in other objects are showing as inputs.

Hi,
Does anyone know how "PST Debug Lite" (latest version 0.56??) determines the direction of the input / output lines?

I have added the "PST Debug Lite" object into my code as below:-
OBJ

  debug: "PST Debug LITE"                                 ' Nickname PST Debug Lite  debug
  Led1 : "Flash"                                          ' uses one cog

And in my main routine, I Call the debug "Start Method":-
PUB Main | char1, char2, dT, index, array[3], myVal      'dT on are debug variables
  dT := clkfreq/10                                                        ' dt stores time increment  
  debug.start(115_200, debug#DEFAULT)                     ' Start PST Debug Lite
  Led1.Start(_Led1Pin, 300, 0)                                      ' Status LED blinks to show Propeller is working

The "Led1.Start" method sets P11 as an output & toggles the LED on & off, but the "PST Debug Lite" display shows P11 as an input, but it does show it changing state from 0 to 1.

And added these lines inside my main loop (these are just the sample variables from the "Test Debug" program at this time)
  array[index // 3] += index++                        ' Store values in array variables  'run debug code?
  debug.ListHome
  debug.Vars(@dT, String("| dT, index, array[3], myVal"))

Everything seems to work fine except for the Pin direction of P11, I am guessing this is related to the fact that "Flash" is running in a separate COG but don't yet understand propellers or the "PST Debug Lite" code enough to correct this!

Any ideas anyone?. Any pointers are appreciated!

Comments

  • I have investigated his further and have learned much.

    Looking at the code "PST Debug Lite", the DAT "heading" is used to write the text at the top of the terminal window, followed by DAT "io_map" which draws the Processor outline.

    Then the code in PRI "IoUpdate" cycles through the PIN locations on the drawing, positioning the cursor via (PC) x,y and then uses the index to read that locations DIRA (0=in / 1 = out), INA (reads pin state HI or LO), OUTA (sets pin state HI or LO).

    I think my problem is caused by the fact that each COG has its own DIRA register, to quote the manual
    "Each cog maintains its own DIRA register that gives it the ability to set any I/O pin’s direction" ... "each I/O pin’s direction state is the “wired-OR” of the entire cog collective"

    So since the code for each is running in a different COG the DIRA values will be different!
    Perhaps there is no way short of storing the DIRA registers for each COG and OR'ing them to get to actual value??

    The Actual state of the pin is correctly shown as the INA & OUTA commands work directly on the IO pins without an intermediate state.
    I am happy to be corrected in any of the above.
Sign In or Register to comment.