- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Arek,
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.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@arek
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
Reiner