September 17, 2024

Biscotti firmware -- modes and brightness levels

The software talks about modes and levels. They are the same unless "SOFT_START" is enabled, which it is not. So we really want to talk about levels.

Level 0 is off. It is useful to turn the light off when the battery voltage is too low, and for generating blinks and strobes.

Then we have levels 1 through 7, These get values from the "RAMP_FET" array as follows:

0 = 0 (off)
1 = 1   -  * 0.1 (moonlight)
2 = 7   -  * 1
3 = 32  -  * 10
4 = 63  -    20
5 = 107 -  * 35
6 = 127 -    50
7 = 255 -  * 100 percent
The levels marked with * (0.1,1,10,35,100) are the five levels in group 2, which is what I have always chosen.

A quick note is due here comparing the moonlight from the Biscotti to the moonlight from the BLF-a6. The BLF gets its moonlight by doing PWM on a single 7135 (350 mA) at 3/255 and gets 3-4 mA.
If you have a Convoy (as I do) with three 7135 regulators (1050 mA) and you do PWM at 1/255 as shown above, you get 4.1 mA -- pretty much the same as the BLF. If you have a Convoy with eight 7135 (as most folks do) and do the PWM at 1/255 you get 11 mA (over twice as bright).
There are two lessons here. One is that that is why they designed the BLF to have both a FET and a 7135 side by side -- they could use only the 7135 to get low moonlight modes. The other is that if you want a 4 mA moonlight, do as I did and order your Convoy with only three 7135.

This is done with PWM using the 8 bit timer/counter

TCCR0A - control register A
TCCR0B - control register B
TCNT0  - counter register
OCR0A  - output compare register A
OCR0B  - output compare register B
TIMSK0 - interrupt mask register
TIFR0  - interrupt flag register
GTCCR  - general timer control register (with prescaler)
The Biscotti code does not access the GTCCR, so it does not configure the prescaler and should get the system clock full speed (4.8 Mhz).

The TCCR0A and B registers are entirely different. They don't deal identically with output channels A or B like I thought. However OCR0A and B are as I thought, they deal with channels A and B. Stupid names for the TCCR registers.

PWM is controlled by writing values to the OCR registers.


Feedback? Questions? Drop me a line!

Tom's Light Info / [email protected]