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.
    "We suspect that ALMA will allow us to observe this rare form of CO in many other discs.
    By doing that, we can more accurately measure their mass, and determine whether
    scientists have systematically been underestimating how much matter they contain."
  • @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,928
    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.
    "We suspect that ALMA will allow us to observe this rare form of CO in many other discs.
    By doing that, we can more accurately measure their mass, and determine whether
    scientists have systematically been underestimating how much matter they contain."
  • 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,646
    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 Tachyon 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: 399
    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,928
    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.
    "We suspect that ALMA will allow us to observe this rare form of CO in many other discs.
    By doing that, we can more accurately measure their mass, and determine whether
    scientists have systematically been underestimating how much matter they contain."
  • 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,928
    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.
    "We suspect that ALMA will allow us to observe this rare form of CO in many other discs.
    By doing that, we can more accurately measure their mass, and determine whether
    scientists have systematically been underestimating how much matter they contain."
  • 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.
  • @evanh
    Thanks for the code. It appears straight forward. My understanding level is getting better.
    “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”
  • @Cluso99
    @Peter Jakacki
    @evanh
    @everbody "can we have an @everybody"

    Sorry to not get back to you. Yes I can use the pins as pins. But I have been studying the pins for the counters and other stuff. I am attempting to learn and emulate you code wizards who have been working in the trenches with asm and the math. I am self teaching. The local colleges do not have classes in asm let alone why one for example shifts data right and left to do some magic. So I thank you for your input. It is greatly appreciated.

    You probably saw my post some time ago when in the forum posts regarding the accessories where two persons complained about how much money they spent and were disappointed. Well this is my Sodoku. The best ever learning I have ever experienced and I owe this renewal to Parallax and to all of you who have tried to help me even "he may be be perplexed when I say this" @Peter Jakacki with his code.

    I have and continue to read your code. Having scoured the forums I have been able to start to get a handle on this. Sometime I am overwhelmed but after some slow consideration and study make sense of this. I posted a p1 to p2 asm forum. It would be really nice that we could open a forum for the basics of asm code with a structure to have lessons for others to learn this.


    From what I can find on the internet we who attempt or are skilled in asm are a very small community. We need to expand that if possible.

    I find it "facinating" per Captain Spock, single eyebrow raised, of what we can do now as opposed to the IBM 1130 and the HP 2000 my first machines.
    We did not have digital gyros and other sensors.

    Sorry for rambling.

    It is a pleasure to be experimenting with you and the others.
    Thank you for your cooperation. "Mr. Chekov startrek in the latest movies"
    I love scifi that uses good science. We did not get here without the myriad of minds great and small who imagine.

    Martin

    btw fyi

    do you remember this:

    Mr. Mulder why do people like you despite the evicdence to the contrarary believe that the are here?
    What is the response from mulder. "fun" thanks.




    “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”
  • evanhevanh Posts: 7,928
    edited 2019-08-09 - 04:21:52
    Pilot,
    Have you watched the film "Hidden Figures"? It has glamourised enactment of first IBM mainframe going into NASA during early Apollo development. Among other things, I found the film informative of the level of value they got just from having a machine faster than a group of human "computers". It only had one physical job to do ... to get the answers printed on a sheet of paper.

    Because that's all that was wanted of it.

    The capsule and lunar lander computers, on the other hand, were very much wired to lots of sensors and actuators. But of course developing this type of control system had very limited employment opportunities, even now control systems is still relatively small field compared to other computing opportunities.

    Money for developing business transaction processing suites was plentiful. Still is.

    "We suspect that ALMA will allow us to observe this rare form of CO in many other discs.
    By doing that, we can more accurately measure their mass, and determine whether
    scientists have systematically been underestimating how much matter they contain."
  • @evanh
    evanh,

    I have the disk for the movie but have not as of yet seen it. Probably start tonight, since you mentioned it. Last movie was First Man, lunar landing. Slow but was accurate and interesting from my being a flight instructor and mechanic instructor. I grew up watching the NASA programs totally facinated and captivated.

    My family has an unusual NASA connection to the moon program. I normally do not talk about it but, you may find it interesting.
    I grew up in the music industry. My father is a disck jockey and music producer. I am sending a couple of links that you can follow. This is another life long ago for me.

    http://www.magnificentmontague.com/
    https://www.popularmechanics.com/space/moon-mars/a21771/code-for-apollo-moon-landings-on-github/
    https://duckduckgo.com/?t=palemoon&q=burn+baby+burn+lunar+code&ia=web
    https://nmaahc.si.edu/ my father is one of three black diskjockies permenantly exhibited in the smithsonian.

    The reason that I do not talk about this much is to many it would be so fantastic that they would not believe it.

    If you decide to find the book I will get it autographed for you.

    It is a pleasure.

    Martin

    btw when I found out about the apollo code I was amazed.

    I will be sending you another question in the next post hoping that you can send me down a path of understanding.

    And would you like some punch cards I have a case of 1000 of them. LOL!!!!!!!!!!!!!
    “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”
  • Ha, I'd always thought that was the name of a song. Sorry, I've never followed music at all really. I have a few tapes and CDs of the likes of Jarre and Oldfield is about all. Avoided ever buying a DVD because of the stupid warnings they place at the beginning.

    Can't say I ever wanted a punch card back in the day either, didn't fit in with the video game culture. I note there is mention of the ROM technology employed in the Apollo modules. Again, it shows the gulf that was between "data processing" and "control systems".
    "We suspect that ALMA will allow us to observe this rare form of CO in many other discs.
    By doing that, we can more accurately measure their mass, and determine whether
    scientists have systematically been underestimating how much matter they contain."
Sign In or Register to comment.