The FAN5646 is a little blinking or “breathing” LED controller indicator. The internal programmable blink algorithm eliminates any need for continual system processor control from Great Cow BASIC. This means longer battery life for a hand-held system because the system processor is not awakened from sleep mode to blink an LED.
Very low dropout of 80 mV allows driving an LED without any inductors or switch capacitors. LED blink rate, rise and fall time, and CTRL line behavior can be programmed by a TinyWire single-wire digital interface. The on-time and time between pulses can be set for up to two different pulse widths. The LED turns on with the programmed rise time, then stays on as long as CTRL remains HIGH. When CTRL falls, the LED turns off at the programmed fall time. Or, when CTRL is HIGH continuously, the LED repeats the programmed pattern.
So, to get these little controllers working required reading the datasheet and a little coding, see code below.
The circuit is simple. Connect the microcontroller output to the CTRL on the LED controller. As shown here:
For the code. Define the microcontroller output, connect up and read table 11 in the datasheet for the timing, and, the section 'Programming Examples' in the datasheet.
To change the timings. You need to update the registers with updated values. The method TinyWireTX needs two parameter: The register and the new value. This is also explain in Table 9 of the datasheet.
Anyway, works here a treat! My little “breathing” LED indicator is working.
Enjoy
#chip 16F15356
#option Explicit
#define TINYWIRE_CONTROL portc.3
dir TINYWIRE_CONTROL out
'Set-up the LED controller per the datasheet, table 9.
TinyWireTX ( TINYWIRE_SLEW1, 0x55 )
TinyWireTX ( TINYWIRE_PULSE1, 0x55 )
TinyWireTX ( TINYWIRE_SLEW2, 0x55 )
TinyWireTX ( TINYWIRE_PULSE2, 0x00 )
TinyWireTX ( TINYWIRE_CONTROL, TINYWIRE_CONTROL_PLAY )
TINYWIRE_CONTROL = ON
do
loop
'end of program
'Methods etc
#define TINYWIRETX_TRESET 300 us
#define TINYWIRETX_LOGIC0_ON 1 us
#define TINYWIRETX_LOGIC0_OFF 3 us
#define TINYWIRETX_LOGIC1_ON 5 us
#define TINYWIRETX_LOGIC1_OFF 1 us
#define TINYWIRE_SLEW1 0
#define TINYWIRE_PULSE1 1
#define TINYWIRE_SLEW2 2
#define TINYWIRE_PULSE2 3
#define TINYWIRE_CONTROL 4
#define TINYWIRE_CONTROL_FOLLOW 1
#define TINYWIRE_CONTROL_PLAY 2
#define TINYWIRE_CONTROL_SLOW 3
Sub TinyWireTX ( in TinyWireTX_address as byte, in TinyWireTX_data as byte )
TinyWireTX_SendBit TinyWireTX_address.0
TinyWireTX_SendBit TinyWireTX_address.1
TinyWireTX_SendBit TinyWireTX_address.2
TinyWireTX_SendBit TinyWireTX_data.0
TinyWireTX_SendBit TinyWireTX_data.1
TinyWireTX_SendBit TinyWireTX_data.2
TinyWireTX_SendBit TinyWireTX_data.3
TinyWireTX_SendBit TinyWireTX_data.4
TinyWireTX_SendBit TinyWireTX_data.5
TinyWireTX_SendBit TinyWireTX_data.6
TinyWireTX_SendBit TinyWireTX_data.7
TINYWIRE_CONTROL = 1
wait TINYWIRETX_LOGIC1_ON
TINYWIRE_CONTROL = 0
wait TINYWIRETX_TRESET
End Sub
Sub TinyWireTX_SendBit ( in TinyWireTX_bit as bit )
if TinyWireTX_bit = 0 then
TINYWIRE_CONTROL = 1
wait TINYWIRETX_LOGIC0_ON
TINYWIRE_CONTROL = 0
wait TINYWIRETX_LOGIC0_OFF
else
TINYWIRE_CONTROL = 1
wait TINYWIRETX_LOGIC1_ON
TINYWIRE_CONTROL = 0
wait TINYWIRETX_LOGIC1_OFF
end if
End Sub
Last edit: Anobium 2019-08-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The FAN5646 is a little blinking or “breathing” LED controller indicator. The internal programmable blink algorithm eliminates any need for continual system processor control from Great Cow BASIC. This means longer battery life for a hand-held system because the system processor is not awakened from sleep mode to blink an LED.
Very low dropout of 80 mV allows driving an LED without any inductors or switch capacitors. LED blink rate, rise and fall time, and CTRL line behavior can be programmed by a TinyWire single-wire digital interface. The on-time and time between pulses can be set for up to two different pulse widths. The LED turns on with the programmed rise time, then stays on as long as CTRL remains HIGH. When CTRL falls, the LED turns off at the programmed fall time. Or, when CTRL is HIGH continuously, the LED repeats the programmed pattern.
So, to get these little controllers working required reading the datasheet and a little coding, see code below.
The circuit is simple. Connect the microcontroller output to the CTRL on the LED controller. As shown here:
For the code. Define the microcontroller output, connect up and read table 11 in the datasheet for the timing, and, the section 'Programming Examples' in the datasheet.
To change the timings. You need to update the registers with updated values. The method
TinyWireTX
needs two parameter: The register and the new value. This is also explain in Table 9 of the datasheet.Anyway, works here a treat! My little “breathing” LED indicator is working.
Enjoy
Last edit: Anobium 2019-08-17
A complete demo of the table 9, 10 and 11.
Enjoy