my code is like this..
LCD_Char_1_PrintString(" WELCOME ");
CYGlobalIntEnable; /* Uncomment this line to enable global interrupts. */
You can set the interrupt on Terminal Count on as shown in the figure below.
Next in the isr.c file generated, the "Timer_1.h" file has to be included and the variables which are to be used between the isr and the main( ) are declared as extern. Example, a variable named "flag" is declared as extern.
This section has to be written between the #START and #END section. If written outside this section, it will be erased upon build. The snap below shows the same.
Now, the code which has to be implemented in the ISR has to be written within CY_ISR( ) function between the #START and #END section.
Care must be taken to read the Status Register of the Timer Component in order to clear the Interrupt bit (as it is a sticky bit). Then the code can be written as per your logic. The snap-shot is provided below.
This should get your project working.
Another way would be to connect the Interrupt component directly to the TC Terminal present on the Timer component. In this case, it is not required to enable Interrupt in the Timer component and also reading the Status Register in the ISR is not required.
hello sir, i am using stepper motor controller using the cypress appilcation note, and code i have one que: how to decide the clock of the PWM module for given RPM, i am not able to get full 200 rpm by your application code,,,,
The speed at which a stepper motor rotates is determined by many factors. One of them is the rate at which the coils are pulsed. In the PSoC3 project a timer generates periodic interrupts that generate each step (or microstep) of the motor. This timer can be used to run the motor at a specific speed, or to a specific position (exact number of steps). To set the speed of the motor, the interrupt period of the timer is updated by firmware.
Also note that every motor has its own limit on speed due its construction, size, number widning in coil and so on. The same will be mentioned in the datasheet of the motor.
but if i am changing the PWM clock, perforamance changed,,,, if i increse the PWM clock,, higher RPM can get,, so what is the rule?
The speed of a stepper motor depends on the delay between two subsequent steps. Smaller the delay, faster the steps and hence higher the speed.
If you want to increase the speed, then decrease the Time Period in the Timer Component.
The calculation will become straight forward once you get the specifications of the stepper motor from its datasheet. If it moves 1.8 degrees per step, then 200 such sequence will give one complete rotation (360 degrees).
You can use the appropriate clock depending upon the speed required in your application.
i know this about the timer to change the RPM, but the problem is with PWM clock,, if i change the timer interupt according to 150RPM ,torque of motor reduced, and at 200 RPM it need the starting torqe,, if i change the PWM clock,, the reulse get better,, but no proper,, still torque is so low..
PSoC timer is very easy to use. I think the best way is to build a simple application with a timer to turn on/off an LED. The software should be very straght forward. and should get you hands on experience.
For each component in PSoC Creator, there is an associated simple code example. This can be found as follows,
component (right click) --> Find Example project. I hope this helps. Moreover reading through the component datsheet will explain the operation and configuration of the timer component.
I can not see any pictures in dasq's post, does anyone else have silimar problem?
Anyway, I need to build timer, so I configure the count down to be 0.5sec. However, the interrupt stop being triggered after a while. If I raise the timer priority, then the UART interrupt wouldn't be triggered. It seems that I always have problem with the lowest priority interrupt. Any suggestions?
some update, I change the timerISR priority to be 5, higher than UART interrupt and my DAC_I2C. When I am running in debug mode, the interrupt triggered fine, however, if I let it run freely for a while, then I hit pause, then set break point inside timer interrupt, it will not trigger any more.