background image

 

PSoC 4 Down Counter 7-bit 

www.cypress.com

 

Document No. 002-24891 Rev.** 

Design and Implementation 

The Count7 timer period can be varied. In this example, Count7 is configured with a period of 128, so the first count is 127 and 
Count7 resets when it reaches 0. A kit button and a control register are used to enable the counter, as 

Figure 2

 shows. The 

status register allows for reading of the counter output. 

Firmware does the following: 

1.  Starts the UART and Count7 operation. 

2.  Configures interrupt handler Switch_InterruptHandler. 

3.  Before obtaining the current value of the counter, the counter is stopped. The counter is restarted after getting a copy of the 

count. 

4.  The counter is read directly, and its digital outputs are read via the status register. If either value has changed, the UART 

displays both values. The two values should always be the same. 

When the button is pressed, Switch_ISR interrupt occurs, Switch_InterruptHandler is called, and the Control register output  is 
toggled. 

Figure 2. PSoC Creator Project Schematic 

 

Components and Settings 

Error! Not a valid bookmark self-reference.

 lists the PSoC Creator Components used in this example, how they are used in 

the design, and the non-default settings required so they function as intended. 

Table 1. PSoC Creator Components 

Component  

Instance Name 

Purpose 

Non-default Settings 

Down Counter (7-bit) [v1.0] 

Count7 

Implements the down counter functionality 

Set 

EnableSignal

 to Enabled 

Control Register [v1.80] 

Control_Reg 

Allows for digital signal outputs 

Set 

Outputs

 to 1 

Status Register [v1.90] 

Status_Reg 

Allows for digital signals to be read 

Set 

Inputs

 to 7 

Digital Input Pin [v2.20] 

Switch_pin 

Handles the SW2 connection on the device 

Se

Figure 3

 

UART (SCB mode) [v4.0] 

UART 

Handles UART communication 

None 

Interrupt [v1.70]  

Switch_ISR 

Handles Interrupt 

None 

 

Содержание Cypress CY8CKIT-042

Страница 1: ...rs as part of the Infineon product portfolio Continuity of document content The fact that Infineon offers the following product as part of the Infineon product portfolio does not lead to any changes t...

Страница 2: ...module is used 1 Connect the UART rx pin P0 4 to P12 7 on header J8 2 Connect the UART tx pin P0 5 to P12 6 on header J8 Other kits use different pins for the UART Make sure that you select the corre...

Страница 3: ...values The two values should always be the same When the button is pressed Switch_ISR interrupt occurs Switch_InterruptHandler is called and the Control register output is toggled Figure 2 PSoC Creat...

Страница 4: ...esources Pins settings as needed Table 2 shows pin assignments required for UART operation on other PSoC 4 devices Note This project cannot be built for PSoC 4 devices with no UDBs Table 2 Pin Assignm...

Страница 5: ...tatus Register The Status Register allows the firmware to read digital signals General Purpose Input Output GPIO A multifunctional Component that allows hardware resources to connect to a physical por...

Страница 6: ...ss com Document No 002 24891 Rev 5 Document History Document Title CE224891 PSoC 4 Down Counter 7 bit Document Number 002 24891 Revision ECN Orig of Change Submission Date Description of Change 630228...

Страница 7: ...f the Software is prohibited TO THE EXTENT PERMITTED BY APPLICABLE LAW CYPRESS MAKES NO WARRANTY OF ANY KIND EXPRESS OR IMPLIED WITH REGARD TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE IN...

Отзывы: