Bico128 – 128 Bicolor LED array

Transcription

Bico128 – 128 Bicolor LED array
CH-1092 Belmont, Switzerland
Tel +41 21 728-6156, Fax 728-6157
Email [email protected], www.didel.com
www.didel.com/wellbot/BicoDble.pdf
Bico128 – 128 Bicolor LED array
The Bico128 can display in red, green and
the yellow mixture of both.
It is cascadable and under the control of a
simple microcontroller, it can display text and
can be used as a building block for hobby
and industrial applications.
A local microcontroller refreshes the leds
from a bit-map memory (32 8-bit words)
which can be updated through a SPI
protocol.
Schéma
Les ports incomplets du 16F946 compliquent l’accès aux pixels, mais ceci est caché
par une première couche de définitions et macro.
La sélection d’une ligne se fait en activant un bit dans le portB. Ce port commande
des transistors, qui activent jusqu’à 32 diodes avec chacune un courant limité par une
résistance de 470 Ohm pour le rouge et 220 Ohm pour le vert. L’impulsion de courant
est donc au maximum de 240 mA.
L’accès à une ligne de 8 bits se fait par 2 à 4 instructions,
En rouge, la sélection se fait en mettant à zéro les ports D et F. A noter que le port F
est en page 3.
En vert, c’est un peu plus compliqué car le le portG est incomplet, le port C a des bits
réservés pour le SPI, et le portE a un bit en entrée seulement.
La routine DoScan tient compte de ces contraintes.
Pour afficher un motif, on le copie avec lla macro GetMotif Adresse du motif et on le
joue ensuite avec la routine DoScan pour la durée voulue, si on veut changer de motif.
Le bitmap est à l’adress Bitmap selon le format ci-dessous.
Pour préparer des motifs, on utilise les macros V et R ou on se fait des macros
personelles. Si on a dessiné le motif sur une feuille, le codage en hexa est plus rapide.
Poussoirs
Les poussoirs et 2 interrupteurs
de mode sont lus sur le portA,
état 1 si pressé. Pour les
interrupteurs, état 1 si à gauche
ordre : Ra6 RA5 RA3 RA4 RA7
jdn 100111
Communication
- A adapter de WBico The bit map variables are updated
with a serial transfer over 2 lines,
plus one line for reading the two
switches status.
pin1 Gnd
Connector : pin2 Vcc (3 to 5V)
pin3 Ck Clock
pin4 Do pixels from master
pin4 Di push buttons to master
Protocol
8-bit words are shifted between the robot and the display, under control of the robot.
The first byte is a 4-bit address for addressing up to 15 displays. Address 2’0000 is a
broadcast address, that is if several displays are connected in parallel, they will all do
the same (this is specailly usefull for clearing or changing the color). The four upper
bits of that byte defines a mode which specifies how many additional bytes are
transferred :
Update mode : The first 128 clocks transfer the 2x8x8 bits, the next 8 bits transfer
the switches, available on bit 0 (left) and 1 (right switch). It is possible to stop the
transfer anytime for more than 4ms ; only the completely transferred bytes will be
updated.
Pixel mode : The x-y coordinate of the pixel is given, together with 2 bits that set the
color to red, green or both. One or many pixels can be sent, till a stop of 4 ms that will
resynchronize the receivers.
Clear mode : The display is cleared.
Display local images : a library of 16 images will be stored on the display processor
and called (see below).
Several other effects could be coded in the future if required. 1101xxxx 1110xxxx
1111xxxx are free.
Clock durations are : min 120 µs On, 200µs Off. Complete update is hence 0.32 x 136
= 40ms. A silence (no clock) of 2 ms guaranties the resynchronization of the next
transfer.
Schematic
Layout (bottom)
Pin 1 Gnd
Pin2 3.5-5V
Pin3 Ck
Pin4 DataIn
Pin5 (D bataout)
Pseudo code for sending data
Send address (all zeros)
Point to local data block
Repeat 16 times
Send 8 bits, MSB first
EndRepeat
Read 8 bits
Test bit 7 and 6 to know the switch status (1
means depressed)
Wait 5ms before next update
Pseudo code for modifying pixels
Send control word/address (2’0xx00000)
Send pixel coordinates and address
Optionally send as many additional
pixels
Wait 5ms before next update
Pseudo code for clearing display
Send control word/address (2’11100000)
Wait 5ms before next update
Note : 5ms wait is not required if the transfer
is complete.
CK
Dout
(Din)
WellBot870
RA5
RA2
RA4
WellBot168
PD2
PD3
PC5
WellBotStamp
P15
P14
P13
jdn 100111