Exact match. Not showing close matches.
PICList
Thread
'[SX] Max6953 LED Matrix Controller'
2005\12\23@041634
by
ALTITUDEAPn/a
|
|
I have a few of these chips and want to control them with the SX28. I have been a little confused on the controlling of the chip, but i have found this. It is written in C and for a pic. Is it possible that someone would be interested in assisting me with this converting. I have never used I2C on the SX, so i dont know what is neccisary. I have looked through Gunther's book at the app notes. Is all that stuff in the I2C master area required to be in the code in order to make it work?
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=101896
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
2005\12\23@041712 by ALTITUDEAPn/a
|
|
sorry here is the code that i found Written for the CCS PCM cross-compiler version 3.185
/******************************************************************************
Driver routines for MAX6953 5x7 cathode-row LED display drivers.
Originally written by Stuart Hunter, Technical Director, ViziMatic Ltd.
******************************************************************************/
#ifndef DISPLAY_SDA
//The pin definitions are set for a PIC16F819 SSP module. If they are
//redefined elsewhere before this file is included then your own definitions
//will override these.
#define DISPLAY_SDA PIN_B1
#define DISPLAY_SCL PIN_B4
#endif
//Miscellaneous defines
#define SLOW 0 //Use for setting blink rate
#define FAST 1
#define PLANE0 0x20 //Use for setting data start address
#define PLANE1 0x40
#define BOTHPLANES 0x60
#define WRITE_NOW 1 //Used in operations affecting the CONFIG
#define WRITE_LATER 0 //register.
//Add FORCE_HW to the end of the line below if you want or need
//to use a hardware I2C implementation (ie your PIC has the MSSP module).
//Remove the line if you've already defined the I2C pins!!!
#use i2c(master, sda=DISPLAY_SDA, scl=DISPLAY_SCL ) //,FORCE_HW int config_byte;
int device_address;
// Initialise the I2C bus and config register
void init_display()
{
output_float(DISPLAY_SCL);
output_float(DISPLAY_SDA);
config_byte = 0;
}
void set_device_address( int addr )
{
addr+= 0x50; //MAX6953 addresses take the form 101xxxx
device_address = addr; //where xxxx is the user-selected address 0-15.
}
// This function is mainly for internal use, but you can use it to
// set the CONFIG register directly if you don't want to use the
// individual functions provided for this purpose.
void write_config_register( int config_byte )
{
i2c_start();
i2c_write( (device_address<<1) & 0xFE );
i2c_write( 0x04 );
i2c_write( config_byte );
i2c_stop();
}
// This function sets the display interval for each display plane.
// With a 4MHz clock, FAST is 0.5s and SLOW is 1.0s.
void set_blink_speed( int speed, short wrt )
{
if( speed == SLOW ) config_byte &= 0xFB;
else config_byte |= 0x04;
if( wrt ) write_config_register( config_byte );
}
// This function enables or disables plane switching ( blinking )
void blink_enable( short state, short wrt )
{
if( state ) config_byte |= 8;
else config_byte &= 0xF7;
if( wrt ) write_config_register( config_byte );
}
// This function is used for blink time synchronisation across multiple devices.
// call it once for each device, in sequence. Nonpersistent.
void blink_sync( void )
{
write_config_register( config_byte |= 0x10 );
}
// Clear the plane data in the chip. Nonpersistent.
void clear_digits( void )
{
write_config_register( config_byte | 0x20 );
}
// Put the display into low power shutdown mode
void shutdown( short state, short wrt )
{
if( !state ) config_byte |= 0x01;
else config_byte &= 0xFE;
if( wrt ) write_config_register( config_byte );
}
// Put the display in test mode. Will illuminate all LEDs if state=TRUE.
// Does not affect plane data - original display is restored when set FALSE.
void display_test( short state )
{
i2c_start();
i2c_write( (device_address<<1) & 0xFE );
i2c_write( 0x07 );
if (state )
{
i2c_write( 1 );
}
else
{
i2c_write( 0 );
}
i2c_stop();
}
// Set the display intensity from 0-15. This routine sets all digits to
// the same value, if you want to set 'em individually then you need to
// implement your own function - I don't need that ability!
void set_intensity( int intens )
{
int tempd;
tempd = intens<<4; //set the most significant nybble
intens |= tempd;
i2c_start();
i2c_write( (device_address<<1) &0xFE );
i2c_write( 0x01 ); //first intensity register
i2c_write( intens );
i2c_write( intens ); //register addr autoincrements, so write second reg.
i2c_stop();
}
// Sets the number of digits to be displayed ( 2 or 4 ). Included just for
// the hell of it - I don't use this in my app.
void set_scan_limit( short state )
{
i2c_start();
i2c_write( (device_address<<1) &0xFE );
i2c_write( 0x03 );
if (state )
{
i2c_write( 1 );
}
else
{
i2c_write( 0 );
}
i2c_stop();
}
// Set the plane data for display. Normal characters should be written to
// PLANE0. See the Maxim datasheet for an explanation of the data planing
// system.
void write_display_character( int start, int length, char* string )
{
int n;
i2c_start();
i2c_write( (device_address<<1) &0xFE );
i2c_write( start ); //start address of write operation
for( n=0; n<length; n++ )
{
i2c_write( string[n] ); //write noninverted string, address
} //will autoincrement.
i2c_stop();
}
// As above, but displays an inverted ( background lit, char off ) character.
void write_inverted_display_character( int start, int length, char* string )
{
int n;
i2c_start();
i2c_write( (device_address<<1) &0xFE );
i2c_write( start ); //start address of write operation
for( n=0; n<length; n++ )
{
i2c_write( string[n] |= 0x80 ); //write inverted string, address
} //will autoincrement.
i2c_stop();
}
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=101896#m101897
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
|
|
I don't have the time right now, but SX/B does have I2C commands. I would recommend you start there.
Bean.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=101896#m101899
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
2005\12\26@163921 by oliverbn/a
|
|
It just so happens that CCS is working on the SX C compiler which we should see very soon. Many of the functions that exist in te PIC version will also be in the SX version. Your program would be an excellent sample program to test against providing you can wait a week or so. If not than by all means convert the program to SX/B. You will need to decide if the SX is going to be a master or slave I2C device. I2C is master controlled which means the master initiates all communications.
PS: The C documentation is already posted in another thread so you can see if the functions in your source will be supported.
Oliver Bailey
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=101896#m102306
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
More... (looser matching)
- Last day of these posts
- In 2005
, 2006 only
- Today
- New search...