Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 3 > How to combine sub modules successfully in main module ??

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



How to combine sub modules successfully in main module ??
Moderator:
RKRM

Post Reply
Follow this topic



How to combine sub modules successfully in main module ??

blueblood posted on 27 Nov 2011 10:42 PM PST
Member
10 Forum Posts

Hello !! Thanx everyone to solve my previous query so quickly.. :)

i am facing a simple problem that i have made my sub modules of voltage measurment, voltage averager, probe logic and frequency measurment individually and everything is working fine !! But when i combine them all in main module using switch case, the frequency measurment part doesn't work.. any idea why it is creating such problems ?? i have attached my code along with my post..




Re: How to combine sub modules successfully in main module ??

Bob Marlowe posted on 27 Nov 2011 12:52 AM PST
Top Contributor
1768 Forum Posts

Where is the declaration of your interrupt procedure for the timer? I miss a CY_ISR or a CY_ISR_PROTO?

I usually would write

 

ISR_Counter_StartEx(MyInterruptRoutine);

to exactly define what I want.

Your program is poorly readable, it takes some time to see, which button-value is for which part of your program, why not #define Button_Frerquency_Count 1 and so on.

Why not put the whole case-block into a separate function

case Button_Frequency_Count: Count_Frequency();

            break;

case Button_Measure_Voltage: Measure_Voltage();

            break;

Check your comments for correctness.

Check your comments for nessicity: "LCD_Position(0,0);//Position cursor on LCD"  here the comment is obsolete

Check your Indentation

 

Happy coding

Bob



Re: How to combine sub modules successfully in main module ??

blueblood posted on 27 Nov 2011 05:28 AM PST
Member
10 Forum Posts

yup.. i think it is the problem i am facing.. but where should i initialize the timer interrupt routine ?? the code is going upto printing the frequency statement on lcd.. but i think it is not going further.. any help ??



Re: How to combine sub modules successfully in main module ??

Bob Marlowe posted on 27 Nov 2011 06:12 AM PST
Top Contributor
1768 Forum Posts

Initialize the interrupt and the Timer-Module once, then (if you prefer) you can disable them with the appropiate API-Call.

In the corresponding procedure you can enable/restart them and(again if you prefer) disable them.

The right place would be the function (I hope you already took it out of the switch-block) where you measure frequency.

I (normally) put an isolated function like measuring the frequency into a complete different .c-file and make a .h interface. Later when programming a completely different project I have the opportunity to re-use that piece of software.

 

Bob



Re: How to combine sub modules successfully in main module ??

blueblood posted on 27 Nov 2011 02:27 PM PST
Member
10 Forum Posts

as per suggetion i used counter initialization and isr initialization outside the switch case.. but still no success.. :(

i am doing it wrong ?? can you please modify my original code so that i will fully understand my mistake and will try to avoid them in future..



Re: How to combine sub modules successfully in main module ??

H L posted on 27 Nov 2011 04:25 PM PST
Top Contributor
679 Forum Posts

1. Post your latest change here

2. Tell us what you change and why do you change it?

3. People here may help you so you can learn how to fish. not to give you a fish.






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20