Shop OBEX P1 Docs P2 Docs Learn Events
Notes On Propeller (might be helpful for new user ) — Parallax Forums

Notes On Propeller (might be helpful for new user )

Attached Word document with navigation bar might help with syntax look up for propeller has essentially what has been previously documented on Parallax site but includes examples might help new users waiting for Propeller manual.

«1

Comments

  • Very nice Bob! :smiley:

  • Very nice doc, Bob!

  • Updated "Hello Propellwe 2 Examples Rev02.docx" and added the example program files. docx is at bottom of zip file list
    RegardsB
    Bob (WRD)

  • evanhevanh Posts: 16,022
    edited 2021-07-16 10:51

    Bob,
    That's a lot of effort you've thrown in! You're picking up plenty of good details too.

    Are you doing this for Parallax? They are beavering away on docs right now themselves.

    PS: Section 4.1 "P2 Uses a Voltage Divider approach." ... I should point out the first figure is also a voltage divider circuit. The main difference is the Prop2 uses a more robust and faster acting arrangement that doesn't have the buffering op-amp. Therefore the output is pure resistive, hence why the output resistance is specified. I think it also has the side effect of better linearity as well but that's just a guess from me.

    PPS: Looking it up, the first figure is called a "binary weighted resistor" DAC. Linearity of that type becomes a major issue at higher word sizes. The "R-2R ladder" DAC is effectively the same but greatly improves on the linearity.

    Prop2 uses what's called a "Thermometer coded" or "Unary coded" DAC. A name I've never bumped into before but then I'd not seen the exact method either. It's pretty heavy on real-estate but does deliver high precision at speed.

  • evanhevanh Posts: 16,022
    edited 2021-07-16 11:29

    Prop2's ADCs are what's called a "sigma-delta modulator" or "delta-sigma modulator". Just a single fast comparator with feedback, which oscillates in the MHz, producing a natural bit-stream known as pulse-density-modulation (PDM). This is subsequently vacuumed up by a counter configured as a "Sinc filter/decimator" from which you then get your typical PCM samples.

  • Thanks for reply. I will add your comments into the document for future revision. I am not doing this for Parallax who will do a better job when then get around to the docuentation, but anyone who wants to use it can. I am retired and I think the propeller II has so much poetential for learning .
    Regards
    Bob (WRD)

  • Most recent revision see docx file examples updated
    Regards
    Bob (WRD)

  • MaciekMaciek Posts: 675
    edited 2021-07-26 07:01

    Valuable information inside. Thank you.
    May I suggest updating the first post with the newest doc file and commenting the changes within the consecutive posts ?
    This way one will always have the newest document version at the top and the newest comments detailing the changes as they come in the posts.

  • @"Bob Drury" said:
    Most recent revision see docx file examples updated
    Regards
    Bob (WRD)

    Great work Bob!

  • @Maciek said:
    Valuable information inside. Thank you.
    May I suggest updating the first post with the newest doc file and commenting the changes within the consecutive posts ?
    This way one will always have the newest document version at the top and the newest comments detailing the changes as they come in the posts.

    +1

  • Maciek
    I will see if I can do that on the next update.
    Regards
    Bob (WRD)

  • Latest Revision 4 of Notes. Working on Assembly operand instruction examples.
    Regards
    Bob (WRD)

  • New HelloPropellerP2Rev05 Added more PASM instructions examples mainly ALT commands
    Regards
    Bob (WRD)

  • New HelloPropellerP2Rev06 added more PASM examples and Information on CRC8 Cyclic Redundancy Checks (thanks to forum members for helping with understanding PASM Syntax)
    Regards
    Bob (WRD)

  • evanhevanh Posts: 16,022
    edited 2021-09-09 01:59

    Bob,
    A PDF of your work might be in order. When I load the .docx with LibreOffice it looks pretty untidy in many places. Font sizes are wonky so that not a lot fits on a page. BTW: I'm getting 815 pages.

  • It is 669 pages. I had trouble making PDF . I finnaly got it to export . I believe my laptop doesn't have enough memory.
    I like the feeddback thanks. Does the PDF give you Navigation tool? Does Libre office have the navigation tool? I find this really useful for jumping around in word document.
    Regards
    Bob (WRD)

  • Nice, just very, very, nice. Only gripe so far is the pin block diagram is fuzzy on my screen. Kinda like the edges and characters are a bit out of focus. Otherwise, wish I had seen this sooner.

  • For long documents like this, I really like LyX. It's a graphical front end for LaTeX. I started using it back when my computer didn't have enough ram to load OpenOffice, let alone handle a long document.

    If you don't mind, I might try starting with this document.

  • BY all means go for it. Goal is to get a good manual for the propeller II
    Regards
    Bob (WRD)

  • @"Bob Drury" said:
    BY all means go for it. Goal is to get a good manual for the propeller II
    Regards
    Bob (WRD)

    @"Jeff Martin" is supposed to be giving an update today on the state of P2 documentation -- it's part of the P2 live stream at 1PM (Pacific Time).

  • RaymanRayman Posts: 14,738

    @"Bob Drury" Glad you wrote all this down!

    If you don't mind, I added it to my P2 web page: http://www.rayslogic.com/Propeller2/Propeller2.htm

  • Rayman
    Please use it how ever you want.
    Regards
    Bob (WRD)

  • Rayman
    Can I put your website in notes?
    Regards
    Bob (WRD)

  • RaymanRayman Posts: 14,738

    Sure, no problem...

  • Added more P2 instructions and some info HDMI\DVI looking for some CALL subroutine examples and some Selected events examples if any one has PASM code it would be apreciated.
    I guess I can't post file updates anymore it is too large to attach.
    Regards
    Bob (WRD)

  • evanhevanh Posts: 16,022

    Might be a good time to section it up and make a file for each.

  • evanhevanh Posts: 16,022
    edited 2021-09-28 03:40

    CALL examples ... that's so ordinary ... oh, hehe, not well suited to inline assembly examples though.

    CALL is how compiled programs execute functions/methods. An assembly demo using CALL would be best demo'd in a separate cog where it can be pure pasm.

    When I'm testing the hardware limits I'm often using pure pasm from go to whoa. Then I use my own debug routines for reporting results. Sometimes this involves trashing all of hubRAM. So everything needed is contained in the one cog. Here's an example snippet:

    'report time taken
            getct   pa
            sub pa, pb
            call    #itod
            call    #putnl
    

    The relevant subroutines are:

    'Emit CR/LF
    '  input:  (none)
    ' result:  (none)
    'scratch:  pb
    '
    putnl
            callpb  #13, #putch
            mov pb, #10
            jmp #putch
    
    '  input:  pb
    ' result:  (none)
    'scratch:  (none)
    '
    putch
            rqpin   inb, #DIAGTXPIN wc  'transmiting? (C high == yes)  *Needed to initiate tx
            testp   #DIAGTXPIN  wz  'buffer free? (IN high == yes)
    if_nc_or_z  wypin   pb, #DIAGTXPIN      'write new byte to Y buffer
    if_nc_or_z  ret         wcz 'restore C/Z flags of calling routine
            jmp #putch          'wait while Smartpin is both full (nz) and transmitting (c)
    
    'Integer (32-bit) to ascii decimal and emit
    '     Note:  Uses the CORDIC.  This means that any already running operations will be corrupted
    '            Also requires bcdlen set for the number of digits to be emitted
    '            If bit8 of bcdlen is set then leading zeros will be emitted
    '  input:  pa, bcdlen
    ' result:  (none)
    'scratch:  pa, pb, bcdi, bcdstr, temp1
    '
    itods
            cmps    pa, #0      wc
        if_c    neg pa
        if_c    mov pb, #"-"
        if_c    call    #putch
    
    itod
    'bundle 32-bit integer to BCD array
    ' X / 10 = X/(8+2) = X/8 - X/64 - X/128 - X/512 + X/4096
    '
            mov bcdstr, #0      'clear bcdstr to all zeros
            mov bcdstr+1, #0
            mov bcdi, #0        'reset digit index
    .makebcd
            rep @.rend, #1      'IRQ shielding
            qdiv    pa, #10
    
            testb   bcdlen, #8  wc  'prepend leading zeros
    '       mov temp2, bcdlen
    '       sub temp2, #1
            mov temp1, #bcdstr
            bith    temp1, #9       'post-increment "bcdi" at ALTxx instruction
    
            getqx   pa      wz  'collect quotient for recursion
            getqy   pb          'collect decimal digit (remainder)
    .rend
            altsn   bcdi, temp1     'bcdstr[bcdi++] = pb  (instruction prefix)
            setnib  0-0, pb, #0-0       '(p2asm neeeds extended form)
        if_nz   jmp #.makebcd
    
    
    'Emit BCD as an ASCII string to comport
            getnib  pb, bcdlen, #0      '1 to 16 digits for string length
        if_nc   add pb, #1
            fge bcdi, pb        'set minimum string length
            sub bcdi, #1    wz  'to suit zero based indexing
        if_z    jmp #.emit
    .leadin
            altgn   bcdi, #bcdstr       '(instruction prefix)
            getnib  pb          'retrieve next digit from BCD:  pb = bcdstr[bcdi]
            cmp pb, #0      wz
    if_z_and_nc mov pb, #" "        'replace with leading spaces
    if_z_and_c  mov pb, #"0"        'replace with leading zeros
    if_z        call    #putch          'Relies on #putch preserving C/Z flags
    if_z        djnz    bcdi, #.leadin
    
    .emit
            altgn   bcdi, #bcdstr       '(instruction prefix)
            getnib  pb          'retrieve next digit from BCD:  pb = bcdstr[bcdi]
            add pb, #"0"        'encode ASCII
            call    #putch
            djnf    bcdi, #.emit
            ret         wcz 'restore C/Z flags of calling routine
    
  • evanh
    I think your right I will section it up. To start I think I will leave all the examples as files and just have their file names in the main body with the assembly description. It is
    actually redundant having both. Thanks for Call program will go through it . My experience was with 6802D5 kit from motorola where subroutines had stacks that were automatic (Push\Pull) and the propeller doesn't really have that . (at least that I know of) so I was curious how the stack is made and how the interrupt routines would handle
    that. Since there really aren't CPU registers that require saving and restoring in the same way (trying to remember way back ) it may not be required at all .
    Regards and Thanks
    Bob (WRD)

  • evanhevanh Posts: 16,022
    edited 2021-09-29 03:47

    Oh, right, yes, there is a choice of stacks in the Prop2, as opposed to the Prop1 which had none. Above, I use the dedicated 8-level hardware stack, or, more accurately, CALL/RET use it. Which means no RAM used for the implicit push/pop, and also means it is the same speed, 4 sysclock ticks (13..20 hubexec), as a JMP instruction.

    Compilers will more likely use a stack in hubRAM instead. For that, CALLA/RETA uses PTRA register as the stack pointer. Speed is 5..32 ticks for the branch (maybe hubexec) and push combined. RETA is longer at 11..40 ticks, since the implicit pop is a rdlong timing compared to push's wrlong timing.

    CALLB/RETB can be used for PTRB as well.

    And finally, there is CALLD (JMPRET in Prop1), which doesn't use a stack. This is same as LINK instruction in other processors. It branches like a JMP while saving the PC in a named register. Very flexible.

    EDIT: Corrected the speeds to include hubexec.

  • evanhevanh Posts: 16,022
    edited 2021-09-29 05:29

    ISR entry is handled by means of an injected CALLD. There is a collection of reserved cogRAM for this. ISR exiting, both RESx and RETx, is via aliasing of more CALLD variations. Stack is untouched.

    So don't go exiting from an interrupt with anything extra on the stack.

Sign In or Register to comment.