element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Cypress Kits
  • Products
  • Dev Tools
  • Cypress Kits
  • More
  • Cancel
Cypress Kits
Forum Quadrature Decoder with Logic Gates Circuit FPGA
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Cypress Kits to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 11 replies
  • Subscribers 31 subscribers
  • Views 3331 views
  • Users 0 members are here
  • logic
  • psoc4
  • digital
  • encoder
  • fpga
  • gates
  • quadrature
  • decoder
Related

Quadrature Decoder with Logic Gates Circuit FPGA

juanes.pazj
juanes.pazj over 11 years ago

I need to read two rotary quadrature encoders at the time I didnt know that the PSOC4 could work with the TCPWM Quadrature decoder but I really enjoyed this circuit It is a really good example of the digital logic power included on PSOC.

the great thing about this is that all the circuit logic is made via hardware that means there is no work required by the processor until it reaches the causes the interrupt. this way I won't waste processing power on this reading.

image

here is a little simulation of how this works notice that on each case only one of the lights turns that would turn on the interrupt sequence for that pin.

image

  • Sign in to reply
  • Cancel

Top Replies

  • COMPACT
    COMPACT over 11 years ago +2
    You can further offload the decoding by adding an up-down counter component. Just use a single ISR to inform the processor of a change of value. As DAB says - "Just a thought."
  • cy.gul
    cy.gul over 11 years ago +1
    Juan, nice work! This is an excellent example of how you can use the simple digital logic Components in PSoC Creator to make your own peripherals or functions, entirely in hardware! In addition to the…
  • juanes.pazj
    juanes.pazj over 11 years ago in reply to cy.gul +1
    Thanks Gagan! I'll try to get something done with that feature sounds like a really great improvement!!
  • cy.gul
    cy.gul over 11 years ago

    Juan,

    nice work!

     

    This is an excellent example of how you can use the simple digital logic Components in PSoC Creator to make your own peripherals or functions, entirely in hardware!

     

    In addition to the simple logic Components, PSoC Creator 3.0 now includes a full UDB editor with State Machines, making it very easy to create more complex digital hardware on the UDB hardware (Universal Digital Blocks = CPLDs + Datapaths on the PSoC).

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • juanes.pazj
    juanes.pazj over 11 years ago in reply to cy.gul

    Thanks Gagan!

    I'll try to get something done with that feature sounds like a really great improvement!!

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • COMPACT
    COMPACT over 11 years ago

    You can further offload the decoding by adding an up-down counter component.

    Just use a single ISR to inform the processor of a change of value.

     

    As DAB says - "Just a thought."

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • juanes.pazj
    juanes.pazj over 11 years ago in reply to COMPACT

    Great thought Compact! thanks!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • porkyboy
    porkyboy over 9 years ago

    Hi,

    Just came across this after searching for simple quadrature decoding to up/down logic for a PSoC app.  Thanks for the schematic - implimented in under 5 minutes on a PSoC 5.  PSoCs really do rock!

    Many thanks!

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • michaelkellett
    michaelkellett over 9 years ago

    Thanks for posting - I do a lot of FPGA work but I don't use PSoCs,

     

    It's not a very FPGA like use of logic - (but may be perfectly sensible for the limited CPLD style logic in a PSoC).

     

    Why ?

     

    Well, almost all (possibly all)  FPGAs are designed for synchronous logic and this is an asynchronous design (the flip flop is clocked by the XOR of the two inputs). In a very simple design like this it may be OK (but you can't tell what will happen if the two inputs change simultaneously) - in real FPGAs the timing verification tools can't work with asynchronous designs - so they are avoided because you can never be sure that they will work.

     

    Do the PSoC tools offer simulation and any timing verification ?

     

    MK

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • COMPACT
    COMPACT over 9 years ago in reply to michaelkellett

    Yes!

    There are clock domains on the PSoC and they can't be directly connected to standard logic connections. They have to be done properly in a controlled manner.

    An alternative to the above circuit is to incorporate Gray Code verification and suitable FSM (Finite State Machine) to ensure that one bit can change at any one time to change states.

     

    Surprisingly there are many consumer products that do not properly decode quadrature encoded switches. If you spin them to fast the product can get quite confused even incrementing in the wrong direction.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • juanes.pazj
    juanes.pazj over 9 years ago in reply to porkyboy

    Sorrry have been away for quite some time, glad it helped you!, I believe there was some things to be checked with the interrupts.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • juanes.pazj
    juanes.pazj over 9 years ago in reply to michaelkellett

    I am not sure if it would work to solve the asynchronous logic but there is an option that allows you to sync the input signals with one single clock at 24MHz

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 9 years ago

    Hi everyone..This is an excellent example of how you can use the simple digital logic Components in PSoC Creator to make your own peripherals or functions, entirely in hardwar. In addition to the simple logic Components,Psoc now includes a full UDB editor with State Machines, making it very easy to create more complex digital hardware on the UDB hardware.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube