Anyone know how to create a pulse for PWM, on a simple way ?
and how to use timer for it ?
in MCS51 :
void delay_us (void) //100us delay on 12Mhz
TH0 = 0xFF;
TL0 = 0x37;
TR0 = 1;
TR0 = 0;
TF0 = 0;
How can I create this on Cypress PSOC 1 ?
Easiest would be to use a PWM - Component and configure it accordingly. Have a look at the PWM's datasheet.
The way you showed in your example differs a bit from the way PSoCs work: Usually you do not need to access ports or pins directly, there are many pre-defined components: timers, PWM, counter, interfaces and you just have to configure them at design-time and start them with an API at run-time preferrably in c-language.
Some possibilities(besides the basic PWM module) -
and the basic modules in Designer IDE (see lower right) -
I have a chip level diagram as in the picture..
How can I connect the PWM ? for pinout, for example I wanna use P0.4 as an output to my motor.
Please find my capture attached
In the parameters window of PWM8 user module, set the "compare out" as Row0_Output0. Then, click on LUT on that row and click on the buffer which connects to GlobalOutEven4 (GOE 4). Then click on globalOutEven4 line and select the "pin" as P0.
Please see attached PDF file for example.
The simplest way to see a PWM signal on your pin is using the PWM usermodule.
Place it in your project, configure the signal timing/duty using the usermodule parameters window (refer to the PWM datasheet for info on this; right click on the PWM block -> Datasheet)
Configure output as Rajiv mentioned; easier way is to do it graphically:
Hold Shift key and click on the "CompareOut" terminal, then click on the Pin of your choice.
Only code that you need to add in your main.c is PWM8_Start(); (PWM8 is the name of the usermodule, change accordingly)
Ok, I'll try and get back to you guys later,
thanks for helping
What's "LUT" ?
Look Up Table