p1 and p2 PASM TUTORIAL

Pplease start tutorials here and make them simple. REMEMBER THIS TUTORIAL IS FOR THE NOVICE ONLY.
EXAMPLE:
IF YOU ARE GOING TO USE A SMART PIN PLEASE GIVE A TOTALLY COMMENTED SET OF CODE.
IF YOU ARE PASSING PARAMETERS FROM SPIN, PBASIC, OR PROPC HOW TO PASS THE DATA IN THE PARAMETERS.
IF YOU ARE DIRECTLY WORKING IN PNUT HOW TO PASS ANYTHING
MEANING:
PLEASE DOCUMENT SO THAT AN 8 YEAR OLD can understand it.
Teach like a teacher not talking to a nerd.
thank you.
martin
“Light thinks it travels faster than anything but it is wrong. No matter how fast light travels, it finds the darkness has always got there first, and is waiting for it.”
“You only live twice:
Once when you are born
And once when you look death in the face”

Comments

  • Examples are often snippets. Especially ones for operating the hardware features of the Prop2.

    My testing of the hardware, for example, always has the test routine sitting in the middle of a large wrapper of proven diagnostic code that I keep reusing and adding to. When changing the test, the prior test routine, containing a specific snippet, is replaced with a new test routine for whatever the current topic of conversation on the forum is.

    I did spend a day recently cleaning up one part of a test routine to turn it into a reusable subroutine. I did this partly because its core was duplicating the basic job of first initialisation in the diagnostics wrapper - setting the sysclock, and comport to suit.
    "... peers into the actual workings of a quantum jump for the first time. The results
    reveal a surprising finding that contradicts Danish physicist Niels Bohr's established view
    —the jumps are neither abrupt nor as random as previously thought."
  • @evanh,

    yes I am following you there, one of my goals is to automate my test bench to run the tests with different clock settings.

    As usual you are a step ahead of me, but we are aiming in the same direction...

    Mike
    I am just another Code Monkey.
    A determined coder can write COBOL programs in any language. -- Author unknown.
    Press any key to continue, any other key to quit

    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this post are to be interpreted as described in RFC 2119.
  • @Tubular
    Read his stuff many times. Was o.k. so I had to hunt around and with some help from David Carrier was able to get in and out of pasm.
    Now because of the differences in the p2 from p1, I am struggling with the smart pins.
    “Light thinks it travels faster than anything but it is wrong. No matter how fast light travels, it finds the darkness has always got there first, and is waiting for it.”
    “You only live twice:
    Once when you are born
    And once when you look death in the face”
  • pilot0315 wrote: »
    @Tubular
    Read his stuff many times. Was o.k. so I had to hunt around and with some help from David Carrier was able to get in and out of pasm.
    Now because of the differences in the p2 from p1, I am struggling with the smart pins.

    You do realise that you can still use the pins as general purpose I/O without the need for setting up smartpins?
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • evanhevanh Posts: 7,297
    edited 2019-07-16 - 07:56:03
    Pilot,
    Here's a quick test I put together for using a couple of smartpins to show two measured PWM levels. Both are configured to monitor the same pin that I'm controlling with a PWM output smartpin.

    It works as is with Fastspin. For Pnut you'll want to copy the init-diag file into the end of the pwm-input file, replacing the #include line.

    PS: The method used here is first option from my earlier post - https://forums.parallax.com/discussion/comment/1473443/#Comment_1473443
    EDIT: Note: This method needs a high-low pulse, it doesn't work for PWM at 100% because there is no edges then. Same for 0%. What happens is the the prior value is retained until there is a complete pulse again.
    "... peers into the actual workings of a quantum jump for the first time. The results
    reveal a surprising finding that contradicts Danish physicist Niels Bohr's established view
    —the jumps are neither abrupt nor as random as previously thought."
  • Another good option might be to learn the basics of smartpins using a high level language like Spin, Forth, or Python (whatever you know best) -- that might be easier than trying to master both smartpins and PASM together.
  • Peter JakackiPeter Jakacki Posts: 8,443
    edited 2019-07-16 - 11:07:38
    @pilot0315 - I would say this to you and to anyone asking for help. Don't be vague and don't treat help given without acknowledging as promptly as possible. (Imagine you are thirsty and someone gives you a drink, you wouldn't leave it lying around and not acknowledge the kindness either).
    For instance, it always helps us if you show us where you are at. Is it as simple as a shift left or is it really as advanced as smartpin useage? Show your code.
    Then when we reply don't leave us hanging and wondering and taking all these stabs in the dark. Enlighten us, was it helpful or was it too much etc.

    Tachyon Forth - compact, fast, forthwright and interactive
    useforthlogo-s.png
    --->CLICK THE LOGO for more links<---
    P2 +++++ TAQOZ INTRO & LINKS +++++ P2 SHORTFORM DATASHEET
    P1 +++++ Latest binary V5.4 includes EASYFILE +++++ Tachyon Forth News Blog
    Brisbane, Australia
  • evanh wrote: »
    Here's a quick test I put together for using a couple of smartpins to show two measured PWM levels. Both are configured to monitor the same pin that I'm controlling with a PWM output smartpin.

    What's a smartpin? I have been curious for awhile. I thought I would've learned by now just by reading discussions but I haven't. The quickest way is to ask.
    Larry

    If the grass is greener on the other side...it's time to water your lawn.
  • ke4pjwke4pjw Posts: 373
    edited 2019-07-16 - 18:54:54
    lardom wrote: »
    evanh wrote: »
    Here's a quick test I put together for using a couple of smartpins to show two measured PWM levels. Both are configured to monitor the same pin that I'm controlling with a PWM output smartpin.

    What's a smartpin? I have been curious for awhile. I thought I would've learned by now just by reading discussions but I haven't. The quickest way is to ask.

    "SMART PINS

    Each I/O pin has a ‘smart pin’ circuit which, when enabled, performs some autonomous function on the pin. Smart pins free the cogs from needing to micro-manage many I/O operations by providing high-bandwidth concurrent hardware functions which cogs could not perform as well on their own by manipulating I/O pins via instructions.

    Normally, an I/O pin’s output enable is controlled by its DIR bit and its output state is controlled by its OUT bit, while the IN bit returns the pin's read state. In smart pin modes, the DIR bit is used as an active-low reset signal to the smart pin circuitry, while the output enable state is controlled by a configuration bit. In some modes, the smart pin takes over driving the output state, in which case the OUT bit gets ignored. The IN bit serves as a flag to indicate to the cog(s) that the smart pin has completed some function or an event has occurred, and acknowledgment is perhaps needed."

    From: https://docs.google.com/document/d/1UnelI6fpVPHFISQ9vpLzOVa8oUghxpI6UpkXVsYgBEQ/view#heading=h.nqr04i44rhzx
    Terry's Workbench

    Feel the need for speed between your PC's com port and Prop?
    Try the FTDI 245 and the FullDuplexParallel Object.
    Check out my spin driver for the Parallax "96 x 64 Color OLED Display Module" Product ID: 28087
    22FPS video from the P2 on the Parallax "96 x 64 Color OLED Display Module" https://www.youtube.com/watch?v=ja84rf38QHM
  • Smart Pins:

    They're like Analog and SPI and PWM pins but more powerful.
    On the P2, every I/O pin is a Smart Pin.
    And no the pin doesn't have to be smart. If you just want a normal digital input pin you can do that.
  • evanhevanh Posts: 7,297
    edited 2019-07-17 - 13:37:29
    I'd like to make a distinction between Pin functions and Smartpin functions. The smartpins are a multi-function controller per pin. However, the pins can be configured into different modes of operation, eg: DAC/ADC, and used directly by a cog or streamer, without that pin's associated smartpin being engaged.

    Here's a posting of a block diagram - https://forums.parallax.com/discussion/comment/1473762/#Comment_1473762

    EDIT: I've added DAC paths now ... probably should try indicating DAC and ADC locations, too.
    EDIT2: Oops, I'd messed up the Even/Odd labels. Fixed now. Also showing DAC/ADC placement now.
    "... peers into the actual workings of a quantum jump for the first time. The results
    reveal a surprising finding that contradicts Danish physicist Niels Bohr's established view
    —the jumps are neither abrupt nor as random as previously thought."
  • evanh wrote: »
    I'd like to make a distinction between Pin functions and Smartpin functions. The smartpins are a multi-function controller per pin. However, the pins can be configured into different modes of operation, eg: DAC/ADC, and used directly by a cog or streamer, without that pin's associated smartpin being engaged.

    That caught my eye. I didn't follow the development of the P2 but now that it's here I want to start learning about it.
    Larry

    If the grass is greener on the other side...it's time to water your lawn.
  • evanhevanh Posts: 7,297
    edited 2019-07-17 - 02:46:06
    To be fair, the ADC in each pin is intended for use with its smartpin. The ADC produces sigma-delta bitstream, simply placing the bitstream on IN as a series of digital bits. A streamer can keep up with the raw bitstream whereas a cog would alias the signal.

    EDIT: And, of note, the upcoming final Prop2 silicon has improved logic, in both the smartpins and streamers, for resolving this bitstream better than the ES Prop2 does.
    "... peers into the actual workings of a quantum jump for the first time. The results
    reveal a surprising finding that contradicts Danish physicist Niels Bohr's established view
    —the jumps are neither abrupt nor as random as previously thought."
  • evanh wrote: »
    EDIT: And, of note, the upcoming final Prop2 silicon has improved logic...
    Thanks.
    Larry

    If the grass is greener on the other side...it's time to water your lawn.
Sign In or Register to comment.