You are here

PSOC4 and encoder | Cypress Semiconductor

PSOC4 and encoder

Summary: 3 Replies, Latest post by repsoc on 05 Jan 2016 02:27 AM PST
Verified Answers: 0
Last post
Log in to post new comments.
arek's picture
9 posts

 I use a timer (hardware timer) to run as encoder.
In the documentation is written that  a register that I can read off the direction of rotation of the encoder from TCPWM_CNT_STATUS register.
I do not know how in my program, I can have access to this register.
Can someone show me how to do it.

user_1377889's picture
9249 posts


I would suggest you not to read registers directly, but to use the appropriate APIs to get the required information. Try the TCPWM_ReadStatus() function to check if the flag is STATUS_DOWN is set, might work with the quad encoder.



arek's picture
9 posts

Maybe a silly question but how can I read the register directly?

which APIs function I should use to read the register TCPWM_CNT_STATUS ?

repsoc's picture
18 posts


Try this

uint8 direction;

direction = QuadDec_ReadStatus() & 1; /* read direction

                                       bit0 = QuadDec_STATUS_DOWN

                                       bit1 = QuadDec_STATUS_RUNNING

                                       direction ist _STATUS_DOWN

                                       see TRM PSoC 4200 S. 176 */

//QuadDec is my TCPMW Instance




Log in to post new comments.