Hi, I'm completely new to arduino and I can't seem to get my MAX6952 LED Driver chip to work, does anyone has any sample codes that i can run on my arduino to test my MAX6952? I tried running 2 programs but didn't get it to work at all.
This was the top hit when I Googled "MAX6952 Arduino"
is it any use?
Yes it is useful, but i am stuck again.
Is there a way for me to key in the brightness that i want into the serial monitor and it would change the brightness?
For this program, they already set the brightness the moment it is start up, i need help on varying the brightness of the LEDs.
What have you tried so far?
Have you looked at Robin2's serial handling basics tutorial?
Hi,
Welcome to the forum.
Have you got the chip working at all?
You say in your second post
Is there a way for me to key in the brightness that i want into the serial monitor and it would change the brightness?
For this program, they already set the brightness the moment it is start up, i need help on varying the brightness of the LEDs.
So you must have something working.
Can you post the code you have please?
Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Thanks.. Tom..
AWOL:
What have you tried so far?
Have you looked at Robin2's serial handling basics tutorial?
No, i have not tried that. I have manage to get it to display the letters i want on my LED matrix.
/*
MAX6952
Arduino - MAX6952
5V - 35, 36, 37
GND - 4, 5, 6, 18
Pin 10 - 23
Pin 11 - 20
Pin 13 - 21
I've chosen 68k for Rset and 33pF for Cset which works fine so far
*/
#include <SPI.h>
#define ActiveMode 0b00000001 // not shutdown mode
#define FastBlinkRate 0b00000100
//#define GlobalBlinkEnable 0b00001000
#define GlobalBlinkTimingSync 0b00010000
#define GlobalClearDigitData 0b00100000
#define BlinkPhaseReadback 0b10000000
const int CS_pin = 10; // Pin for chip select
const byte NoOp = 0x00;
const byte Intensity10 = 0x01; // see datasheet page 14 (Insesity Registers) & 17 (Table 21, 22)
const byte ScanLimit = 0x03; // false = 2 digits; true = 4 digits
const byte Configuration = 0x04;
const byte UserDefinedFonts = 0x05;
//Factory reserved. Do not write to this.= 0x06;
const byte DisplayTest = 0x07; // False = normal operation; True = test (all LED on)
const byte Digit0P0 = 0x20;
const byte Digit1P0 = 0x21;
const byte Digit2P0 = 0x22;
const byte Digit3P0 = 0x23;
//const byte Digit0P1 = 0x40;
//const byte Digit1P1 = 0x41;
//const byte Digit2P1 = 0x42;
//const byte Digit3P1 = 0x43;
void SetData(byte adr, byte data)
{
digitalWrite(CS_pin, LOW);
SPI.transfer(adr);
SPI.transfer(data);
digitalWrite(CS_pin, HIGH);
delay(1);
}
void SetIntesity(byte Intensity) // intense can be a value between 0 and 15 (4bit)
{
/*
This function sets the same intensity to all digits
The intensity is set in the both registers Intensity10 and Intensity32
The lower 4 bit of Intensity10 are the intesity for Digit0
The higher 4 bit of Intensity10 are the intesity for Digit1
The lower 4 bit of Intensity32 are the intesity for Digit2
The higher 4 bit of Intensity32 are the intesity for Digit3
*/
Intensity = 0x06;
SetData(Intensity10, Intensity);
}
void setup()
{
SPI.begin();
Serial.begin(9600);
// Initalize chip select pins:
pinMode(CS_pin, OUTPUT);
SetData(ScanLimit, true); // false = 2 digits; true = 4 digits
SetData(Configuration, ActiveMode);
SetIntesity(6);
Serial.println("Enter the brightness to be displayed 0 to 15 : ");
}
void loop()
{
if (Serial.available())
{
int Intensity = Serial.read();
if ((Intensity >= '0') && (Intensity <= '15'))
{
Serial.print(" The brightness of the LED is :");
Serial.println(Intensity);
SetData(Intensity10, Intensity);
}
Serial.flush();
//SetData(DisplayTest, true);
//SetData(DisplayTest, false);
if (Serial.available())
{
Serial.println("Enter the character to be displayed: ");
char ch = Serial.read();
if (ch >= 0x18 && ch <= 0x7f && ch != 0x20 )
{
SetData(Digit0P0, ch);
//delay(1000);
Serial.print("The letter displayed on the LED is : ");
Serial.println(ch);
}
if (ch == 0x20)
{ SetData(Digit0P0, 0x20);
Serial.println("The display is blank! ");
Serial.print("Enter character to be displayed : ");
}
}
}
}
Yes i got the chip working.
This is the code that i have.
I want my program to ask me for the brightness of the LED matrix, after i key in the brightness, it would change the brightness followed by asking me of the character that i want it to display.
I am able to get it to display the character but i can't modify the intensity of it.
Thanks!
if ((Intensity >= '0') && (Intensity <= '15'))
Your keyboard has a key makes '0', but I'll bet there isn't one labelled '15'.
Which is why I pointed you at Robin2's serial handling basics tutorial.
#include <SPI.h>
void setup()
{
SPI.begin();
Serial.begin(9600);
Serial.println("Enter the brightness to be displayed 0 to 15 : ");
}
void loop()
{
if (Serial.available())
{
int Intensity = Serial.read();
Serial.print(" The brightness of the LED is :");
Serial.println(Intensity);
}
}
I tried running this code to test on the brightness, i key in 1 to the serial monitor but 49 came out instead of 1, why is this so?
Because 0x31 is the ASCII code for '1'
AWOL:
Because 0x31 is the ASCII code for '1'
How do i not get it to display the ASCII code?
Because you printed its integer value
How do i get it to print the value of 1 to 15 if i type it in the serial monitor?
Did you read Robin2's thread?
Why not?
yes i did, but i don't understand.
I don't think anything I could write would make things much clearer.
I was looking for information on this chip and came accross this conversation.
Horses and water come to mind.