Shop OBEX P1 Docs P2 Docs Learn Events
Propeller 2, What does "%00110 NCO Frequency mode" do? - Page 2 — Parallax Forums

Propeller 2, What does "%00110 NCO Frequency mode" do?

2»

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2020-05-21 04:10
    Unfortunately (and fortunately) there is only one person editing the document. Even if we have it organized that we document little sections that Chip could review and perhaps use in the main document, I doubt that Chip would find the time to do so.

    For that reason I have my own copy of the P2 document and instruction set that I fill in. I have made many documents available, including the color column version of the instruction set so you can actually find stuff in there, but nobody looks at it. Come to think of it I even did up a datasheet brief well over a year ago with artwork and diagrams and tables. I did it at the time because there was no information anywhere and I was doing a reference design that turned into the P2D2. but nobody seems to know that the unofficial P2 datasheet exists, even though there is nothing else.

    BTW, I did up lots of scope captures of smartpins with simple one line examples in TAQOZ, since it is already built into the ROM, and literally anybody can type that one line, even on a BC PC, and get it to do the same thing. My Tachyon Sourcepage wiki is now being filled with these examples, bit by bit.
  • evanhevanh Posts: 15,916
    Regarding our answers, we have of course become very familiar with many parts of the prop2 and also the tools, eg: Pnut, so we will often skip small details like an explanation for commonly used registers. Snippets are a good example of this very short-handing.

    Just ask for more info when it doesn't make sense.

  • AribaAriba Posts: 2,690
    edited 2020-05-21 05:46
    PropGuy2 wrote: »
    So lets try this for the P2 newbie - I need a DAC output voltage at exactly 1.378 Volts DC, continuous. It might be for a DC motor, or instrumentation set point, or who knows what else. I really do not care about PASM2 or anything else, I just need the P2 to output 1.378 volts DC on pin 15.

    SetDCvolts( 15, 1378, DCmilliVolts, Continuous ) = Happy camper! Love the P2 !!!
    My project is a success...

    You would need a ton of such library routines, there are so much possibilities in the P2.
    Instead of such methodes, there are many predefined constants in Spin2. So for your DAC example you can define a scaling factor for mV:
    CON   mV = 256 FRAC 3300    '3300mV in 256 steps (8 bits)
    
    and then in the PUB code, you use the following to set the DAC output voltage:
       dira.[15] := 1
       wrpin(15, P_DAC_990R_3V + (1378 sca mV) << 8)
    

    or you define your own methode:
    pub SetDCVolts(pin, mV)
      pinl(pin)
      wrpin(pin, P_DAC_990R_3V + (mV * 256 / 3300) << 8)
    
    Andy
  • Cluso99Cluso99 Posts: 18,069
    edited 2020-05-21 09:29
    Unfortunately (and fortunately) there is only one person editing the document. Even if we have it organized that we document little sections that Chip could review and perhaps use in the main document, I doubt that Chip would find the time to do so.

    For that reason I have my own copy of the P2 document and instruction set that I fill in. I have made many documents available, including the color column version of the instruction set so you can actually find stuff in there, but nobody looks at it. Come to think of it I even did up a datasheet brief well over a year ago with artwork and diagrams and tables. I did it at the time because there was no information anywhere and I was doing a reference design that turned into the P2D2. but nobody seems to know that the unofficial P2 datasheet exists, even though there is nothing else.

    BTW, I did up lots of scope captures of smartpins with simple one line examples in TAQOZ, since it is already built into the ROM, and literally anybody can type that one line, even on a BC PC, and get it to do the same thing. My Tachyon Sourcepage wiki is now being filled with these examples, bit by bit.
    Where is the colorised Instruction document that you did a few years ago. I know there were a few instruction changes, and the instruction codes changed.
    That was a great document until it was outdated with the instruction opcodes (opcode bits) being redone.

    I'll try and dig out my Excel instruction decode list and update it. It showed how the various instructions fitted into the opcode bit map.
  • I have attached a timing diagram for the %00110 NCO Frequency mode. Feel free to correct any errors. What happens to the IN flag after it gets set? Does something reset it?
    I like graphics that show relationships. Would it help people to have this type of diagram in some Smart-Pin Mode descriptions? I have shown a divide-by-2 input and increments of $5010 for the output square wave. Comments welcome. --Jon
    2253 x 854 - 114K
  • evanhevanh Posts: 15,916
    Yes, putting Z in numerically is a good idea.

    Period (Base Period) isn't really a signal of itself, the Z updates do a great job of showing the base period. Output should follow Z[31] for that mode. So two periods low then two periods high then one period low ...
  • evanhevanh Posts: 15,916
    ACK unlatches IN. Smartpin instructions (WRPIN/RDPIN/AKPIN/WXPIN/WYPIN), except RQPIN, generate an ACK to the smartpin.

    There is a small part about this at the start of the smartpin section of the main doc. It mentions it takes two instructions for ACK effect to take place.

  • AribaAriba Posts: 2,690
    JonTitus wrote: »
    ... I have shown a divide-by-2 input and increments of $5010 for the output square wave...

    What you show is an increment of $5010_0000. The full 32 bits of Y gets added to the 32bit Z register. And as Evans said, the Output is following the MSB of Z.

    Attached is a diagram that also shows a Y value of $5000_0010 in red, and $5010_0000 in black.

    Andy
    744 x 282 - 47K
  • Andy: Many thanks for redrawing the diagram. I appreciate help understanding this mode. I didn't include the 4 least-significant bytes simply for clarity. I assumed they would always remain $0000 in the example. Cheers. --Jon
Sign In or Register to comment.