CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Problem with driving a MAX6952

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
The Puma



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

Problem with driving a MAX6952
PostPosted: Sun Mar 05, 2006 6:00 am     Reply with quote

I have connected one 5x7 led matrix display as descripted here (DIGIT0)
http://pdfserv.maxim-ic.com/en/ds/MAX6952.pdf

and i use my driver
Code:
#ifndef MAX6952_CS

#define MAX6952_CS    PIN_C0
#define MAX6952_CLK   PIN_C3
#define MAX6952_DOUT  PIN_C4
#define MAX6952_DIN   PIN_C5

#endif

// Register address map
#define NO_OP                               0x00  // Used when cascading max6952s
#define INTENSITY10                         0x01  // Intensity register
#define INTENSITY32                         0x02  // Intensity register
#define SCAN_LIMIT                          0x03  // Scan-limit register
#define CONFIGURATION                       0x04  // Configuration register
#define USER_DEFINED_FONTS                  0x05  //
#define FACTORY_RESERVED                    0x06  // Factory reserved
#define DISPLAY_TEST                        0x07  // Display-test register
#define DIGIT_0_PLANE_P0                    0x20  //
#define DIGIT_1_PLANE_P0                    0x21  //
#define DIGIT_2_PLANE_P0                    0x22  //
#define DIGIT_3_PLANE_P0                    0x23  //
#define DIGIT_0_PLANE_P1                    0x40  //
#define DIGIT_1_PLANE_P1                    0x41  //
#define DIGIT_2_PLANE_P1                    0x42  //
#define DIGIT_3_PLANE_P1                    0x43  //
#define WRITE_DIGIT_0_PLANE_P0_P1           0x60  //
#define WRITE_DIGIT_1_PLANE_P0_P1           0x61  //
#define WRITE_DIGIT_2_PLANE_P0_P1           0x62  //
#define WRITE_DIGIT_3_PLANE_P0_P1           0x63  //

// Configuration register
#define SHUTDOWN_MODE                       0x00  // Shutdown Control (data bit D0)
#define NORMAL_MODE                         0x01
#define SLOW_BLINK                          0x00  // Blink rate selection (data bit D2)
#define FAST_BLINK                          0x01
#define BLINK_FUNCTION_DISABLED             0x00  // Global blink enable/disable (data bit D3)
#define BLINK_FUNCTION_ENABLED              0x01
#define BLINK_TIMING_COUNTERS_UNAFFECTED    0x00  // Global blink timing synchronization (data bit D4)
#define BLINK_TIMING_COUNTERS_RESET         0x01
#define DIGIT_DATA_PLANES_P0_P1_UNAFFECTED  0x00  // Global clear digit data (data bit D5)
#define DIGIT_DATA_PLANES_P0_P1_CLEARED     0x01
#define P1_BLINK_PHASE                      0x00  // Blink phase readback (data bit D7)
#define P0_BLINK_PHASE                      0x01

// Scan-limit register
#define DISPLAY_DIGITS_01                   0x00  // Display digits 0 & 1
#define DISPLAY_DIGITS_0123                 0x01  // Display digits 0 1 2 3

// Intensity register digit 0 and digit 2
#define DIG_0_DIG_2_DUTY_CYCLE_1            0x00  // Intensity min
#define DIG_0_DIG_2_DUTY_CYCLE_2            0x01
#define DIG_0_DIG_2_DUTY_CYCLE_3            0x02
#define DIG_0_DIG_2_DUTY_CYCLE_4            0x03
#define DIG_0_DIG_2_DUTY_CYCLE_5            0x04
#define DIG_0_DIG_2_DUTY_CYCLE_6            0x05
#define DIG_0_DIG_2_DUTY_CYCLE_7            0x06
#define DIG_0_DIG_2_DUTY_CYCLE_8            0x07
#define DIG_0_DIG_2_DUTY_CYCLE_9            0x08
#define DIG_0_DIG_2_DUTY_CYCLE_10           0x09
#define DIG_0_DIG_2_DUTY_CYCLE_11           0x0A
#define DIG_0_DIG_2_DUTY_CYCLE_12           0x0B
#define DIG_0_DIG_2_DUTY_CYCLE_13           0x0C
#define DIG_0_DIG_2_DUTY_CYCLE_14           0x0D
#define DIG_0_DIG_2_DUTY_CYCLE_15           0x0E
#define DIG_0_DIG_2_DUTY_CYCLE_16           0x0F  // Intensity full

// Intensity register digit 1 and digit 3
#define DIG_1_DIG_3_DUTY_CYCLE_1            0x00  // Intensity min
#define DIG_1_DIG_3_DUTY_CYCLE_2            0x01
#define DIG_1_DIG_3_DUTY_CYCLE_3            0x02
#define DIG_1_DIG_3_DUTY_CYCLE_4            0x03
#define DIG_1_DIG_3_DUTY_CYCLE_5            0x04
#define DIG_1_DIG_3_DUTY_CYCLE_6            0x05
#define DIG_1_DIG_3_DUTY_CYCLE_7            0x06
#define DIG_1_DIG_3_DUTY_CYCLE_8            0x07
#define DIG_1_DIG_3_DUTY_CYCLE_9            0x08
#define DIG_1_DIG_3_DUTY_CYCLE_10           0x09
#define DIG_1_DIG_3_DUTY_CYCLE_11           0x0A
#define DIG_1_DIG_3_DUTY_CYCLE_12           0x0B
#define DIG_1_DIG_3_DUTY_CYCLE_13           0x0C
#define DIG_1_DIG_3_DUTY_CYCLE_14           0x0D
#define DIG_1_DIG_3_DUTY_CYCLE_15           0x0E
#define DIG_1_DIG_3_DUTY_CYCLE_16           0x0F  // Intensity full

// Display-test register
#define NORMAL_OPERATION                    0x00  // Normal operation
#define DISPLAY_TEST_MODE                   0x01  // Display-test mode, all leds on

void max6952_test() {
   output_low(MAX6952_CS);
   spi_write(DISPLAY_TEST);
   spi_write(DISPLAY_TEST_MODE);
   output_high(MAX6952_CS);
}


and this main file

Code:
#include <18F4620.h>
#use delay(clock=20000000)
#fuses HS,NOWDT,NOBROWNOUT,NOPUT,NOLVP,DEBUG,NOSTVREN,NOPROTECT

#include <max6952.h>

void main() {

   setup_spi(SPI_MASTER | SPI_H_TO_L | SPI_CLK_DIV_16);
   
   max6952_test();
}



Whats must i do to get it to work?
Please help
StuartH



Joined: 19 Aug 2005
Posts: 14
Location: W. Midlands, UK

View user's profile Send private message

PostPosted: Sun Mar 05, 2006 9:56 am     Reply with quote

I posted some code for a MAX6953 under my old username quite a while back. That should illustrate the things you have to do.
It's been a long time since I used it and my copy of the datasheet is buried somewhere in my backups, but as I recall, the only real difference between the 6953 and 6952 is the processor interface. It's a fairly easy device to get working, provided that you actually read the datasheet properly before writing code. There are some traps for the unwary.
The Puma



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Mar 05, 2006 10:38 am     Reply with quote

@StuartH,

I have used your code
I have changed the i2c code to the hardware spi commands
but no luck, it did't work

With only the "DISPLAY_TEST" command all leds must be swiched on
but it did't

Why
StuartH



Joined: 19 Aug 2005
Posts: 14
Location: W. Midlands, UK

View user's profile Send private message

PostPosted: Sun Mar 05, 2006 1:14 pm     Reply with quote

As I said, read the datasheet and look for the traps...

The device powers up in low power standby mode. Your code as it stands won't work because you don't make any attempt to enable the LED drivers first. I can't remember for sure, but I think the brightness is also set to minimum - i.e. invisible... Look at the short code snippet at the bottom of my MAX6953 post, and trace what it does.
The Puma



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Mar 05, 2006 2:21 pm     Reply with quote

Is it possible to make a moving message board with the max6952?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group