Ramsey Electronics COMPUTEMP CT255 Manuel d'instructions Page 5

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 20
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 4
SBRGB 5
CIRCUIT DESCRIPTION
In the old days, we used to make things as simple as possible. The original
blinky used two transistors, two capacitors and four resistors. This simple circuit
is now seen everywhere in blinky kits so we decided to use a new and novel
approach with this one. Our new blinky kit requires over 20,000 transistors,
three capacitors, five resistors, and a few other parts. The difference is we can
make the LED do anything we want, well almost anything.
The part which does most of the work is an 8-pin PIC micro-controller chip.
Frankly these little things are amazing. They are perfectly suited to perform
small tasks like this one. They are fast, easy to program, and require almost no
external components to make them function. The PIC controller is programmed
to pulse width modulate each of the 3 colors in various duty cycles to achieve
the variety of colors we are looking for. What to we mean by pulse width modu-
late?
Pulse width modulation means that we are changing the percentage of on time
vs. off time in a known amount to achieve a specific brightness. In our case we
are pulsing width modulating with a resolution of 256 steps for each color. This
means we have a resolution of 256*256*256 = 16,777,216 colors! We may not
actually achieve this number due to limitations on switching speed, but we’ll still
get more than your eye can discern.
Now, let’s say we want the red LED at 50% of full brightness. The red element
needs to turn on and off in equal amounts fast enough that our eye cannot see
it blink. How is this done in code? If you are familiar with PIC, here is a snippet:
toploop: ;Make the RED led turn on at 50% brightness.
clrf pace ;For the full 256 counts
movlw 0x7F ;50%, leave red on for this many counts of 256
movf red ;Into the red register
bsf GPIO,RED ;Turn on the Red LED
pwmloop:
decfsz red,F ;Decrement the red register
goto reds ;If red not at zero, leave the Red LED on
bcf GPIO,RED ;If red at zero, turn the Red LED off
reds: decfsz pace,F ;Decrement the pace
goto pwmloop ;If not at zero, keep looping until 256 counts done.
goto toploop ;Continue on, or loop to toploop
Ok, so you may not have done much assembly programming before. This is a
real neat example to help you learn what assembly code can do. The best way
to read this code is to look at the text after the semicolons (here is where the
descriptive information resides). The text on the far left are labels that identify
points in the program flow where you may whish the program to start from or
jump to (remember Basic’s goto 10? 10 was a label for a line).
Vue de la page 4
1 2 3 4 5 6 7 8 9 10 ... 19 20

Commentaires sur ces manuels

Pas de commentaire