I have a project I am trying to figure out that needs PWM for 5 LED arrays. I want to replace the TS Flasher on my motorcycle with a MC-based one so I can use LEDs w/o hyperflash or load resistors. I am altering the stock functionality also. I originally planned to use a 16f628A but am open to change/suggestions.
5 lamps: 2 front turns, 2 rear turns, 1 center Brake (On low-level except when input is triggered.)
2 dash-mounted TS indicators (off always except flashing when TS is on)
3 active-high inputs: L/R turns and Brake
Typical function of left/right turn and brake. All the rear lamps light for brake unless turn indicator on when that side will flash at about 1 Hz. All TS flashes are On-Off, not On-dim.
In designing the circuit I need to understand how the PWM and On/Off parts can work. I plan to use one 2A Sharp 12V regulators PQ12RD21 with on/off for each of the 5 lamps, then a PNP for the high-side switching of the TS indicators (yup, the MC pins need to sink current here).
here is the DS for the regulators:
https://www.electro-tech-online.com/custompdfs/2010/02/pq05rd21_e.pdf
It seems to me that hardware PWM may work for the running light mode if I can shut off the regulator during the flashing. Otherwise I may need to go with SW PWM so I can switch pins from PWM to flashing on TS mode. The SW PWM version seems less desirable since quite a bit of overhead will be spent "watching" for turn signal and especially brake inputs. The various combinations of flashing and bright will seemingly interfere with the smoothness of the SW PWM function and limit further "improvements." I know me and this will only be a start.![Big Grin :D :D](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Am I correct in understanding that HW PWM only outputs to 1 pin (CCP1) so all the other I/O pins work as regular tri-state pins?? If so then I could have the PWM waveform pulsing the regulators during regular function. Then have the port B pins 'override' the pulses for bright mode. Can they override the PWM pulses in the off direction too??
I thought I could use a couple of Port A pins to flash the dash lamps to keep RB6 and 7 open for ICSP. Since only one of these will only go 'off' or 'on' at 0.5 second intervals when the TS is on they will use next to no cycles.
I just can't get my head around how to get smooth PWM all the time and do the other stuff too. Am I just over thinking this?? Do I just not understand implementation of PWM? and so on....
Thank You!!!
5 lamps: 2 front turns, 2 rear turns, 1 center Brake (On low-level except when input is triggered.)
2 dash-mounted TS indicators (off always except flashing when TS is on)
3 active-high inputs: L/R turns and Brake
Typical function of left/right turn and brake. All the rear lamps light for brake unless turn indicator on when that side will flash at about 1 Hz. All TS flashes are On-Off, not On-dim.
In designing the circuit I need to understand how the PWM and On/Off parts can work. I plan to use one 2A Sharp 12V regulators PQ12RD21 with on/off for each of the 5 lamps, then a PNP for the high-side switching of the TS indicators (yup, the MC pins need to sink current here).
here is the DS for the regulators:
https://www.electro-tech-online.com/custompdfs/2010/02/pq05rd21_e.pdf
It seems to me that hardware PWM may work for the running light mode if I can shut off the regulator during the flashing. Otherwise I may need to go with SW PWM so I can switch pins from PWM to flashing on TS mode. The SW PWM version seems less desirable since quite a bit of overhead will be spent "watching" for turn signal and especially brake inputs. The various combinations of flashing and bright will seemingly interfere with the smoothness of the SW PWM function and limit further "improvements." I know me and this will only be a start.
Am I correct in understanding that HW PWM only outputs to 1 pin (CCP1) so all the other I/O pins work as regular tri-state pins?? If so then I could have the PWM waveform pulsing the regulators during regular function. Then have the port B pins 'override' the pulses for bright mode. Can they override the PWM pulses in the off direction too??
I thought I could use a couple of Port A pins to flash the dash lamps to keep RB6 and 7 open for ICSP. Since only one of these will only go 'off' or 'on' at 0.5 second intervals when the TS is on they will use next to no cycles.
I just can't get my head around how to get smooth PWM all the time and do the other stuff too. Am I just over thinking this?? Do I just not understand implementation of PWM? and so on....
Thank You!!!