1 of 1 people found this helpful
Since the CY8C9560A is a peripheral device, it is not designed to store program logic, and hence would not be able to turn on LEDs with respect to the change in switch states.
If you can try your hand in programming, I suggest you use our latest PSoC4 device.
Thanks and regards,
Got it, Thanks Sampath.
So, always i have to use the master to the control the the cypress periperal.
Also i am trying to configure the PWM on one of the GPIO , I connected one active low LED to the 1st PIN of Port 1 with a pull-up resistor.
The below steps i followed to activate the PWM,
But i am getting constant voltage on the LED and it glows always, i didn't see any change in the Light intensity.
I expected that light intensity will vary continuously.
So, is that correct ? If not , can you please explain me the general working of the PWM.
and to configure correctly , in the above case ?
Thanks and Regards,
There are some corrections to be made in your sequence, as follows
i2c_write_one_byte(0x18,0x01); // Select Port #1
i2c_write_one_byte(0x1a,0x02); // Select PWM #2
i2c_write_one_byte(0x1c,0x02); // Enable Output on P1_2
i2c_write_one_byte(0x28,0x02); // Select PWM #2, as PWM #2 only can be output on P1_2
i2c_write_one_byte(0x29,0x04); // Clock from programmable divider
i2c_write_one_byte(0x2a,0x20); // PWM Period
i2c_write_one_byte(0x2b,0x10); // PWM pulse Width
i2c_write_one_byte(0x2c,0x80); // Programmable divider value
This should output around 36Hz on P1_2, with a constant duty cycle of 50%.
In order to vary the intensity of the LED, you should change the pulse width by specifying a new value
i2c_write_one_byte(0x2b,0x18); // PWM pulse Width
and so on.
Thanks sampath for lot of information, Now i understood clearly.
The above code and with 2 changes, it is working for me.
As per data sheet Writing 1 into 0x1C , will make that pin as input, so for output i made it zero.
i2c_write_one_byte(0x1c,0x00); // Enable Output
Also the 1st pin in the port 1 is connected to PWM_4 Source , so i have to write 0x04 in the 0x28 register
i2c_write_one_byte(0x28,0x04); // PWM_4 is selected.
And as you mentioned, i can see the variations in the intensity by writing different values in the 0x2b Register.
Thank you once again sampath.