What c header file do include to be able to use the PSOC built in periperials Timer, Counter, and PWM

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
JoSa_3786491
Level 3
Level 3
First like received First like given

According to section 25 of http://www.cypress.com/file/123561/download​ there are 4 built in timer/counter/pwm peripherals on the PSOC 5lp.

Which header file do I need to include to get access to their functions?

Is there better documentation on said peripherals?

Thanks,

-Morio

Rabbit Hole Computing

0 Likes
1 Solution
JoSa_3786491
Level 3
Level 3
First like received First like given

The issue was I didn't understand that a fixed function Timer, Counter and PWM uses the system peripheral Timer, Counter, PWMs. There are four of them in the PSoC 5LP. I created a fixed function timer and sure enough one of the timers were used as reported by the project rpt file.

Resource Type                 : Used : Free :  Max :  % Used
============================================================
Digital Clocks                :    7 :    1 :    8 : 87.50 %
Analog Clocks                 :    0 :    4 :    4 :  0.00 %
CapSense Buffers              :    0 :    2 :    2 :  0.00 %
Interrupts                    :   26 :    6 :   32 : 81.25 %
IO                            :   46 :   26 :   72 : 63.89 %
Segment LCD                   :    0 :    1 :    1 :  0.00 %
I2C                           :    1 :    0 :    1 : 100.00 %
USB                           :    1 :    0 :    1 : 100.00 %
DMA Channels                  :   10 :   14 :   24 : 41.67 %
Timer                         :    1 :    3 :    4 : 25.00 %

Thanks for all your help,
-Morio

View solution in original post

0 Likes
4 Replies
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

If you are using PSoC Creator,

#include "project.h"

will do the trick.

If you are new to PSoC, I would recommend you to watch following video tutorials.

http://www.cypress.com/training/psoc-101-video-tutorial-series-how-use-arm-cortex-m0-based-psoc-4

Although the device family is different, we can learn the "Cypress Way" of developing a program.

I just noticed that there is a following URL to start with.

http://www.cypress.com/documentation/application-notes/an77759-getting-started-psoc-5lp

moto

0 Likes
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

Like moto says:

If you are using PSoC Creator,

#include "project.h"

will do the trick.

At the same time, there are many code example in the creator IDE, you can open and run it.

0 Likes
JoSa_3786491
Level 3
Level 3
First like received First like given

The issue was I didn't understand that a fixed function Timer, Counter and PWM uses the system peripheral Timer, Counter, PWMs. There are four of them in the PSoC 5LP. I created a fixed function timer and sure enough one of the timers were used as reported by the project rpt file.

Resource Type                 : Used : Free :  Max :  % Used
============================================================
Digital Clocks                :    7 :    1 :    8 : 87.50 %
Analog Clocks                 :    0 :    4 :    4 :  0.00 %
CapSense Buffers              :    0 :    2 :    2 :  0.00 %
Interrupts                    :   26 :    6 :   32 : 81.25 %
IO                            :   46 :   26 :   72 : 63.89 %
Segment LCD                   :    0 :    1 :    1 :  0.00 %
I2C                           :    1 :    0 :    1 : 100.00 %
USB                           :    1 :    0 :    1 : 100.00 %
DMA Channels                  :   10 :   14 :   24 : 41.67 %
Timer                         :    1 :    3 :    4 : 25.00 %

Thanks for all your help,
-Morio

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Dear Morio-san,

I'm very sorry for my poor English Reading skill.

To access Fixed Timer's registers, I would do

(1) Enter a schematic using Timer (Fixed), or probably yours already has one.

(2) Generate Application by selecting "Generate Application" icon.

(3) PSoC Creator Generates drivers etc according to your schematic setup.

(4) Among the Generated_Source > PSoC5, there is a folder named "Timer" or

    whatever name you assigned to the Timer

011-Schematic.JPG

(5) By un-folding the Timer folder, you will see the header and soruce(s) generated for your project.

012-Timer.JPG

(6) You can open and/or edit any of these, but please note that your modification to these file will be over written by the next "Generate Application"

(7) From the main.c only including "project.h" will take care of including necessary headers generated for your project. (This was my first answer).

Best Regards,

25-Jan-2019

Motoo Tanaka

0 Likes