| Electronic Components Datasheet Search |
|
AS3661 Datasheet(PDF) 71 Page - ams AG |
|
|
|||||||||||||||||||||||||||||
AS3661 Datasheet(HTML) 71 Page - ams AG |
|
71 / 87 page ![]() www.austriamicrosystems.com Revision 1.3 70 - 85 AS3661 Datasheet - D e t a i l e d D e s c r i p t i o n 8.12.3.1 SPW Application Example The SPW command can be used to set the PWM duty cycle of the program execution engine. In the following example we want to set the duty cycle of the PWM output to 55% like in the ramp example in the previous section. The right PWM value can be calculated with the following formula: PWM value = (Duty Cycle * 255 / 100) = 55% * 255 / 100 = 140. The predefined PWM value can be used as a starting point for dimming LEDs for example. COMPILER COMMAND SYNTAX: SPW, 140; 8.12.4 SET PWM (Variables) This instruction is used for setting the PWM value on the outputs LED1 to LED9 without any ramps. In comparison to the SPW command, this command is in combination with variables similar to the RWM example in one of the previous sections. COMPILER COMMAND SYNTAX: SPV, Variable[2]; 8.12.4.1 SPV Application Example The purpose of the SPV command is basically the same one like with the SPW command in the previous section. The only difference is that this command allows the user the control the PWM duty cycle with the variables of the chip. COMPILER COMMAND SYNTAX EXAMPLE: SPW, 0; The example above shows the control of the duty cycle with the local variable A. If the local variable is for example loaded with a value of 100, the duty cycle of the PWM output is set to 39.2%. 8.12.5 WAIT When a wait instruction is executed, the engine is set in a wait status and the PWM values on the outputs are frozen. This can be used for example to keep the LEDs enabled for a certain period of time before another up/down dimming process is being initiated. COMPILER COMMAND SYNTAX: WAIT, prescale[1], time[5]; 8.12.5.1 WAIT Application Example In the example shown below we want to have a target wait time of 125ms after dimming up the LEDs. In order to get the 100ms delay we select a prescaler value “1”, which gives a cycle time of 15.625ms. If we divide the 100ms by the cycle time we get the right value for the time parameter which is 8. COMPILER COMMAND SYNTAX EXAMPLE: WAIT, 1, 8; Table 78. SPW Parameter Description Name Value Description Variable 0-3 0 local variable A 1 local variable B 2 global variable C 3 register address 3CH variable D value, or register address 42H value. Table 79. WAIT Parameter Description Name Value Description Pre-scale 0 Divide master clock (32 768 Hz) by 16 which means 0.488 ms cycle time. 1 Divide master clock (32 768 Hz) by 512 which means 15.625 ms cycle time. time 1-31 Total wait time will be = (time) x (prescale). Maximum 484 ms, minimum 0.488 ms. |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |