cy_psoc3_count7 instantiation ?

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

cross mob
JeVE_287651
Level 1
Level 1

I think that the instantiation example in the component autor guide (page 43) is false :

   

cy_psoc3_count7 Counter7Name #(.cy_period(7'b1111111), .cy_route_ld(`FALSE),
.cy_route_en(`FALSE)) (...

   

I think that the correct syntax is :

   

cy_psoc3_count7 #(.cy_period(7'b1111111), .cy_route_ld(`FALSE),
.cy_route_en(`FALSE))  Counter7Name (...

   

Anyway (!!!) my simple 7 bit counter don't works. Can you explain me why ?

   

Regards

   

Jean-Louis

   

 

   

//`#start header` -- edit after this line, do not edit this line
// ========================================
//
// Copyright YOUR COMPANY, THE YEAR
// All Rights Reserved
// UNPUBLISHED, LICENSED SOFTWARE.
//
// CONFIDENTIAL AND PROPRIETARY INFORMATION
// WHICH IS THE PROPERTY OF your company.
//
// ========================================
`include "cypress.v"
//`#end` -- edit above this line, do not edit this line
// Generated on 05/19/2010 at 10:18
// Component: count7_simple
module count7_simple (
    count7,
    clk
);
    output [6:0] count7;
    input   clk;

//`#start body` -- edit after this line, do not edit this line
        cy_psoc3_count7 #(.cy_period(100),.cy_route_ld(1),.cy_route_en(1))
    count7_simple(
            /* input            */  .clock(clk),
            /* input            */  .reset(1'b0),
            /* input            */  .load(1'b0),
            /* input            */  .enable(1'b1),
            /* output [06:00]        */  .count(count7),
            /* output            */  .tc()
        );
//`#end` -- edit above this line, do not edit this line
endmodule
//`#start footer` -- edit after this line, do not edit this line
//`#end` -- edit above this line, do not edit this line
 

0 Likes
2 Replies
Anonymous
Not applicable

You are correct.  The instantiation examples throughout the Component Author guide have the instance name placed at the wrong place.  This has been corrected for the next version of the guide that will come out with the Beta 5 version of PSoC Creator.

   

When you say that the counter is not working, I'm assuming that you are not seeing it count at all.  If that is the problem that you are seeing, then it is because the Count7 has both a hardware enable and a software enable.  They both must be enabled in order for it to count.  The software enable is part of the Aux Control register.  You will need to set the enable bit to a one in software.  The C call to do that will look something like:

   

CY_SET_REG8(count7_simple__CONTROL_AUX_CTL_REG, CY_GET_REG8(count7_simple__CONTROL_AUX_CTL_REG) | 0x20)); You will need to replace "count7_simple" with the full instance name to your count7.  You can always refer to the generated cyfitter.h file for all the defines that are available.  For details on the Count Start bit in the Aux control registers refer to the documentation in the Technical Reference Manual for PSoC 3 (TRM).  Search for "Auxiliary Control Register".

   

 

   

Brad Budlong
PSoC Sensei
 

0 Likes
JeVE_287651
Level 1
Level 1

 Thank you, Brad

   

The counter is now counting !

   

 

   

But... in the Author guide, I see "cy_route_en: A Boolean to enable a routed signal as an enable to the counter. If false then the counter is always enabled, if true then the counter is only enabled while the enable input is high. Default is `FALSE.".

   

When cy_route_en is false, and if I put 0 in .enable(0), the counter is stopped (and the fitter said : "Warning: mpr.M0069: Count7 "\count7_simple_1:count7\" detected with a constant 0 for the enable.  This will prevent the Count7 from operating. (App=cydsfit)")

   


I think that when cy_route_en is false, the counter is NOT "always enabled"...

   

 

   

Best regards

   

Jean-Louis VERN

0 Likes