Made new hardware with an Attiny85 to include up to 2 PWM channels and up to 4 digital outputs. One PWM channel occupies 2 digital outputs , a PWM output and a second output with the inverted PWM value. Thus, depending on the software, 3 options are available: 4 digital outputs and no PWM, 2 channels PWM and no digital outputs, 1 PWM channel and 2 digital outputs. In this version I use 2 output pins for one PWM channel and 2 digital outputs. The old hardware version with software is described in section 2 of this blog.
The new hardware adds 2 extra 12V digitals outputs:
The state machine now has to deal with 5 Panasonic remote control button values: 3D, left-arrow, right-arrow, blue and yellow buttons: main_c
The C program uses Switch-case statements in the main() function to implement the state-machine and is to be seen here: main.c
Section 2, old version: Made some updates to the Panasonic IR receiver module to include an PWM output to control an outdoor 12V LED lamp. The PWM duty cycle is controlled by the Panasonic remote left-arrow and right-arrow buttons. Original design at: https://larsenhenneberg.dk/2016/07/11/panasonic-tv-ir-decoder/
The PWM signal is provided via hardware registers, i.e. software is only needed for initialization and for subsequent changes in frequency and/or duty cycle.
In this way, the critical IR frame receiver timing is not affected by other interrupts. A software state-event machine is now in the main function to decode specific Panasonic remote IR button sequences.
The LED lamp output pin was moved from PB3 to PB4 (OC1B) to use the PWM signal:
Shown below are the scope snapshots of min. and max. PWM duty cycles at the LIGHT output.
The Attiny25 datasheet is available here: http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7598_Automotive-Microcontrollers-ATtiny25-45-85_Datasheet.pdf
The state-event diagram for the state event machine inside the gcc C main() function:
The updated Attiny25 C source is here: main_c