Pages: [1]   Go Down
Author Topic: HT1632 library not working :(  (Read 1510 times)
0 Members and 1 Guest are viewing this topic.
New York
Offline Offline
Sr. Member
****
Karma: 4
Posts: 366
xronosclock.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to get HT1632 library (this one) to work with my Sure 32x16 LED display. I've connected it to my Aruduino Uno3 and tested following this wonderful and extremely helpful tutorial. Pong game works, I can plot individual dots, etc. However when I tried using Gaurav Manek's HT1632 library, I'm not getting any life signs from the LED board smiley-sad
My connections mapping to arduino are as follow:
CS = pin 8
CLK = pin 9
WR = pin 7
DATA = pin 6
Here's the code, taken streight from the Github:
Code:
#include <font_5x4.h>
#include <HT1632.h>

int pinCS1 = 8;
int pinCS2 = 9;
int pinWR = 7;
int pinDATA = 6;


int wd;
int i = 0;

void setup () {
    HT1632.begin(pinCS1, pinCS2, pinWR, pinDATA);
    wd = HT1632.getTextWidth("Hello, how are you?", FONT_5X4_WIDTH, FONT_5X4_HEIGHT);
}

void loop () {
    // Select board 1 as the target of subsequent drawing/rendering operations.
    HT1632.drawTarget(BUFFER_BOARD(1));
    HT1632.clear();

    HT1632.drawText("Hello, how are you?", 2*OUT_SIZE - i, 2,
        FONT_5X4, FONT_5X4_WIDTH, FONT_5X4_HEIGHT, FONT_5X4_STEP_GLYPH);

    HT1632.render(); // Board 1's contents is updated.

    // Select board 2 as the target of subsequent drawing/rendering operations.
    HT1632.drawTarget(BUFFER_BOARD(2));
    HT1632.clear();

    HT1632.drawText("Hello, how are you?", OUT_SIZE - i, 2,
        FONT_5X4, FONT_5X4_WIDTH, FONT_5X4_HEIGHT, FONT_5X4_STEP_GLYPH);

    HT1632.render(); // Board 2's contents is updated.

    i = (i+1)%(wd + OUT_SIZE * 2); // Make it repeating.
}

It compiles but nothing happens on the screen smiley-sad  Any suggestions?  Is there a better library out there?
Logged

Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, and purchasing info smiley

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 217
Posts: 13742
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Wha if you added a delay(1000) after every display action?

it might just be that you update too fast, resulting in very fast clears() ...

or make it elementary
Code:
#include <font_5x4.h>
#include <HT1632.h>

// just to keep them as small as possible :)
uint8_t  pinCS1 = 8;
uint8_t  pinCS2 = 9;
uint8_t  pinWR = 7;
uint8_t  pinDATA = 6;
uint8_t  wd;

void setup ()
{
    HT1632.begin(pinCS1, pinCS2, pinWR, pinDATA);
    wd = HT1632.getTextWidth("Hello, how are you?", FONT_5X4_WIDTH, FONT_5X4_HEIGHT);

    HT1632.drawTarget(BUFFER_BOARD(1));
    HT1632.clear();

    HT1632.drawText("Hello, how are you?", 2*OUT_SIZE - i, 2,
        FONT_5X4, FONT_5X4_WIDTH, FONT_5X4_HEIGHT, FONT_5X4_STEP_GLYPH);

    HT1632.render(); // Board 1's contents is updated.
}

void loop () {}
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

New York
Offline Offline
Sr. Member
****
Karma: 4
Posts: 366
xronosclock.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Wha if you added a delay(1000) after every display action?

it might just be that you update too fast, resulting in very fast clears() ...

or make it elementary

Still nothing smiley-sad  BTW had to remove "i" from your code...
Logged

Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, and purchasing info smiley

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 217
Posts: 13742
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
BTW had to remove "i" from your code
Code was not tested, but you got the idea.

Strange it does not do anything. Has it a self test modus/ splash screen?
Or can the string be too long?
(guessing)
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

New York
Offline Offline
Sr. Member
****
Karma: 4
Posts: 366
xronosclock.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Still not having much luck. Frankly this phrase from the library doc doesn't make sense to me:
Quote
HT1632 is always initialized by calling the begin function, like so:

HT1632.begin(pinCS1 [, pinCS2 [, pinCS3 [, pinCS4]]], pinWR, pinDATA);
What about Clock pin? Where is it defined?  Maybe I'm not wiring it correctly?  My display has 5 usable pins, CS, CLK, WR and DATA, and I know it's pretty standard...
Logged

Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, and purchasing info smiley

0
Offline Offline
Edison Member
*
Karma: 8
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This comment is from HT1632.h:
Quote
HT1632.h - Library for communicating with the popular HT1632/HT1632C
  LED controllers. This library provides higher-level access (including
  text drawing) for these chips. Currently, the library supports writing
  to a single chip at a time, and has been tested with a single
  Sure Electronics 3208 5mm red board.
Logged

New York
Offline Offline
Sr. Member
****
Karma: 4
Posts: 366
xronosclock.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This comment is from HT1632.h:
Quote
HT1632.h - Library for communicating with the popular HT1632/HT1632C
  LED controllers. This library provides higher-level access (including
  text drawing) for these chips. Currently, the library supports writing
  to a single chip at a time, and has been tested with a single
  Sure Electronics 3208 5mm red board.


I assumed author just didn't update the text. It contradicts itself in more than one place, for example:
Quote
This library supports up to 4 chips at a time (though technically more can be run concurrently). To take advantage of this, specify multiple CS pins in the initialization.
Taken from: https://github.com/gauravmm/HT1632-for-Arduino  smiley-sad

BTW florinc, I just tried your library from WiseClock2 (http://code.google.com/p/wiseclock2/downloads/detail?name=HT1632.zip&can=2&q=#makechanges) and it works for my setup!  I'm still figuring it out, biggest issue is terrible flicker... I'm displaying letter in some COLOR then displaying same letter in BLACK color, then moving it, etc. Am I going about it wrong?
« Last Edit: November 09, 2012, 08:58:02 am by bratan » Logged

Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, and purchasing info smiley

New York
Offline Offline
Sr. Member
****
Karma: 4
Posts: 366
xronosclock.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Phew, got it working! Well not the library, I abandoned all hope, but Florinc's code and it's derivatives are awesome! I even wrote my own text processor (it shows large clock digits), but all the other backend stuff I left as it was, with exception of adding brightness control:
Code:
#define LEDBrightness 8 // Set Brightness of teh display from 1-15
ht1632_sendcmd(j, HT1632_CMD_PWM +LEDBrightness); /* Set Brightness */
I was actually shocked that it worked, as I was just guessing smiley
Biggest issue is that clear screen function really messes up everything big time, and I don't understand why. Every time I use it RTC clock stops working (that's the strangest part) and I get artifacts on the screen that won't go away... So I'm only using it the setup and only in the very beginning, before RTC initialization.  If anyone interested I'll post sketch, but I'll need to tidy it, cause it's a mess right now...
Logged

Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, and purchasing info smiley

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 217
Posts: 13742
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

we are always interested in end results here for future reference. Tidying the code up first is also a good idea.

Idea:
the : between the hours can flash in the first 20 seconds the upper dot only, the next 20 the lower one and the last 20 seconds both dots.
Gives just a bit more precise timing.

Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

New York
Offline Offline
Sr. Member
****
Karma: 4
Posts: 366
xronosclock.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

we are always interested in end results here for future reference. Tidying the code up first is also a good idea.

Idea:
the : between the hours can flash in the first 20 seconds the upper dot only, the next 20 the lower one and the last 20 seconds both dots.
Gives just a bit more precise timing.


Cool idea! Should be easy to implement, thanks!
Logged

Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, and purchasing info smiley

Pages: [1]   Go Up
Jump to: