A new blog post about my led matrix display with a first example about interfacing it with Arduino…
WIRING
As I wrote, to drive the display you need only 3 pins. You can choose any digital pin of your Arduino: to keep my example clear, I defined some aliases in my sketch
#define DISPLAY_CS 3 #define DISPLAY_WR 4 #define DISPLAY_DATA 5 |
The display is powered with 5V, so you can take power and ground from Arduino too:
COMMUNICATION
To enable communication to the display, first you need to set low the CS pin.
Then, for every bit to be sent;
[checklist]
- set low the RW pin
- send the actual bit on the DATA pin
- set high the RW pin
[/checklist]
The value you send on the DATA pin is indeed read on the rising edge of the RW pin.
From HT1632C datasheet you can notice that commands and addresses have to be sent from the most significative bit (MSB), while data have to be sent from the less significative one (LSB):
COMMANDS
HC1632C defines 3 commands, distinguished by the first 3 bits:
- READ, 110
- WRITE, 101
- COMMAND, 100
The first two commands are followed by the memory address and the data; the third one instead is followed by a command code that specifies the specific command to be executed.
INIT
At power on, the display is disabled:
To use it, first you need to send SYS EN and LED On commands (we’re going to send these two commands in the setup() method of our sketch).
In the next page, you’ll find the first sketch…
How fast can the LEDs be updated? I’d like to write to the matrix so that everything is lit, then send a new image 100 – 300 milliseconds later and repeat this at least 10 times over 3 seconds.
thanks,
Mike
Hi Mike,
referring to the datasheet (http://www.holtek.com/pdf/consumer/ht1632cv120.pdf) you can send data to the Holtek controller up to 1MHz
bye
Hello Luca
Is There any chance to translate your code for other
LED-display from Sure electronics.
I have this LED-Display
http://www.sureelectronics.net/goods.php?id=1136
I try to understand how the HT1632C works but I dont get it 🙁
Hi Ahmet,
unfortunately this is the only display by Sure that I own so I can’t modify/test the code on different models…
Hello
Luca thank you its no problem, i got it
thank you very much! 😀
CIao Luca,
anzitutto complimenti, poi…..
non riesco a capire il codice arduino per accendere un led alla volta. In particolare quando entra nel loop, dove viene incrementato l’indirizzo di memoria dell’ HT1632 ? Io noto che anche ad ogni incremento di j l’indirizzo è sempre lo stesso. Come mai?
Ti ringrazio anticipatamente.
Ciao Giuseppe,
ad ogni “refresh” devi inviare lo stato (ON/OFF) di tutti i led… questo refresh viene gestito dal ciclo sulla variabile i. La variabile j che indica la posizione del led acceso viene invece incrementata nel loop() principale e – se è arrivata a 255, viene riportata a 0. Quindi il loop principale “cicla” la posizione del led acceso, mentre il loop interno invia al display – per ogni ciclo principale – lo stato di tutti i led.
bye
It’s really usefull.Great!Many thanks!
How fast can the LEDs be updated? I’d like to write to the matrix so that everything is lit, then send a new image 100 – 300 milliseconds later and repeat this at least 10 times over 3 seconds.
thanks,
John
Hi John, the controller’s datasheet reports a clock of 256Khz and a frame length of 8*328 ticks… so if your microcontroller is fast enough, you should be able to update the matrix display at the rate you need.