Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Teensy 4 and #define ENC_PORT PINC

  1. #1
    Junior Member
    Join Date
    Jul 2017
    Posts
    7

    Teensy 4 and #define ENC_PORT PINC

    I've been using a small bit of rotary encoder code on the Teensy 3.2 and have just bought a Teensy 4 to test.

    The code has the following define statement:

    #define ENC_PORT PINC

    Which has worked on the previous Teensy iterations but not the 4. Does anyone have a quick explanation as to why?

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,729
    It might help to have a lot more details, like what library are we talking about? Or sketch?
    For example I did a quick search of all of the files installed by Teensyduino for ENC_PORT and did not find any hits.

    But a strong guess is that you are using some old code that was originally written to run on Arduino AVR based boards like the UNO?

    The Teensy 3.x code base has emulation code added to emulate the AVR registers, i.e. read input on PORT C. Note: There is no such thing as PortC on the T3.2 (or T4).

    So far I don't believe we have migrated this emulation code over the T4.

    Again there is no details given here, but would suggest trying to use a library that hopefully has been adapted to use native pins and the like:
    hopefully encoder library works...

  3. #3
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,306
    Again there is no details given here, but would suggest trying to use a library that hopefully has been adapted to use native pins and the like:
    hopefully encoder library works...
    The Teensy encoder library does work with the T4 - had tested that a couple of times with the T4 in beta testing so unless something drastic changed....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •