Shop OBEX P1 Docs P2 Docs Learn Events
Pullup & Schmitt — Parallax Forums

Pullup & Schmitt

UghaUgha Posts: 543
edited 2009-02-19 21:39 in General Discussion
The SX/B helpfile says that Pullup and/or Schmitt when used like this:
RX PIN RC.0 INPUT PULLUP SCHMITT


Only work on SX48/52.

Yet I've seen many example codes where its used for SX28s.

Is this a case of the helpfile not being updated with new information?

What about the TTL and CMOS commands?

Comments

  • JonnyMacJonnyMac Posts: 9,214
    edited 2009-02-19 17:13
    You're confusing PIN declaration modifiers (which work on the SX28) with the TTL, CMOS, and SCHMITT keywords (which are used independent of the PIN declaration). The keywords only work on the SX48.

    You cannot do this on the SX28:

    SCHMITT RC.7, 1
    


    ... this only works on the SX48. The line of code you posted is fine because PULLUP and SCHMITT are used as modifiers of the PIN declaration.

    The reason for the keywords only working on the SX48 is that the SX48 allows us to read certain configuration registers that are write-only on the SX28. The PIN declaration affects the internally-generated setup code (usually at Start) but once it's written in the SX28 we can't read it, and creating shadow registers would use more RAM space than one would want (shadow registers are used for TRIS which are also write-only on the SX28).

    You should *study* this document if you're serious about the SX:
    -- www.parallax.com/Portals/0/Downloads/docs/prod/sx/SxUsersManualV31.pdf

    Table 2-4 shows that configuration registers for the SX28 are write only; table shows that configuration registers on the SX48 can be read -- this is what allows the TTL, CMOS, and SCHMITT keywords to work in the SX48. You can see for yourself by looking at the compiled code: in the SX48 the code will read a configuration register, modify the target bit, then write it back.

    The SX takes more involvement that the BASIC Stamp and understanding the hardware will help you achieve your goals, even if using straight high-level SX/B.

    Post Edited (JonnyMac) : 2/19/2009 5:31:06 PM GMT
  • UghaUgha Posts: 543
    edited 2009-02-19 17:24
    Your right, I did mix up the two... the helpfile explains what they do and how to use them, but doesn't seem to explain the difference between the two much.

    Thanks
  • JonnyMacJonnyMac Posts: 9,214
    edited 2009-02-19 17:38
    The SX/B help file is not intended to explain the architectural differences between the SX28 and SX48 -- the documentation exists and it is the responsibility of the SX programmer to be familiar with it. The help file also suggests that you should use the ST_B and ST_C registers for the SX28 (i.e., for SCHMITT).

    That said, I am updating the help file for Parallax and will add an another note vis-a-vis the CMOS, SCHMITT, and TTL instructions and the SX20/28
  • UghaUgha Posts: 543
    edited 2009-02-19 17:49
    Thanks [noparse]:)[/noparse]

    When I said I didn't understand the difference, I meant the difference between the PULLUP command and the PULLUP modifier.

    Thanks though... its great to see that user feedback really makes a difference.
  • JonnyMacJonnyMac Posts: 9,214
    edited 2009-02-19 17:59
    It does and that's why we moved SX/B 2.0 to public beta; those of us that know how to use it can take things for granted.

    Still, don't be lulled into using this exchange as a reason not to study and experiment on your own; you've shown a habit of posting questions that are easily answered with a few minutes of experimentation and and, sadly, while you may get the answer you want from the forums I don't think your understanding of the process is complete without working it through on your own. But that's just my opinion... and we all know what those are like! tongue.gif

    Here's then note I added to the SCHMITT page.

    Note for SX18/20/28
    The SX18/20/28 does not allow for the SCHMITT configuration of individual pins except in the context of the PIN declaration which affects the program start-up code. To change the SCHMITT configuration of a port during the operation of the program one must write to the ST_B or ST_C registers. On the SX18/20/28 the ST_B and ST_C registers are write-only.


    I'm also going to change the check-mark icons on the aliases page to indicated read-only, write-only and read/write.

    Post Edited (JonnyMac) : 2/19/2009 9:42:29 PM GMT
  • T'SaavikT'Saavik Posts: 60
    edited 2009-02-19 18:52
    Thanks JonnyMac, that "sx 48/52" only comment confused me at one point also when writing a program for my sx28 [noparse]:D[/noparse]
  • CJCJ Posts: 470
    edited 2009-02-19 20:52
    @JonnyMac, shouldn't that be write only on the sx18/20/28 instead of read only

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax Forums - If you're ready to learn, we're ready to help.
  • JonnyMacJonnyMac Posts: 9,214
    edited 2009-02-19 21:39
    Yes, CJ, thank you for that -- that's what I get for wanting to change important things before the Starbucks has kicked in! I've fixed the post above.
Sign In or Register to comment.