Through this programing of the dice, I was able to learn various PSoC designs. This time it is the modified version. From the previous program Let's make the dice of seven eyes on PSoC 4 with sound, the decoder part of the circuit is simplified and the PWM part is modified to swap. I will explain the changes here.
The environment used is as follows:
・PSoC Creator 4.3
１． Change of decoding part
The simplified circuit of the decoding section is as follows. Two inverter logics have been deleted from the previous time.
２． PWM uses swap function
The PWM_1 component settings are as follows. Check the Swap of Period.
３． Program changes
Swap is performed at the timing of the S/W side.
* Copyright YOUR COMPANY, THE YEAR
* All Rights Reserved
* UNPUBLISHED, LICENSED SOFTWARE.
* CONFIDENTIAL AND PROPRIETARY INFORMATION
* WHICH IS THE PROPERTY OF your company.
uint32_t sw=0; //sw is off (Stop rolling dicce)
CyGlobalIntEnable; /* Enable global interrupts. */
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
PWM_1_WriteCounter(0); // Clear counter
PWM_1_Start(); // Start rolling dice
/* Roll dice slowly */
CyDelay(1500); // keep rolling slowly for 1.5sec
PWM_1_Stop();// Stop rolling dice
sw=0; // sw is off
/*  END OF FILE */
Press SW2 on the kit board to rotate the dice, and release it to slowly move down and stop.
PSoC 345 LP
Thank you for sharing your example project with the community.