Hello,
I am trying to learn SPI by configuring one 7 segment display to the MSP430G2231 using the MAX7219. I have been able to get it working with Arduino, but I am having no luck with my launchpad. I have been modifying fj604's code that was for the as1106 since the two chips are suppose to be compatible. http://forum.43oh.com/topic/1936-launchpad-as1106-8x8-led-matrix-fun/
/*
* main.c
*/
#include <msp430g2231.h>
#include <stdlib.h>
#define DATA_PIN BIT4 // data for max7219
#define LOAD_PIN BIT5 // load for max7219
#define CLOCK_PIN BIT6 // clock for max7219
#define MAX_DELAY 2500 // Slowest speed
#define MIN_DELAY 1000 // Fastest speed
#define STEP_DELAY 300 // Speed step
void max7219_init(void)
{
P1DIR |= (DATA_PIN | LOAD_PIN | CLOCK_PIN);
P1OUT |= LOAD_PIN;
P1OUT &= ~CLOCK_PIN;
max7219(0x0C, 0x00); // shutdown
display();
max7219(0x0F, 0x01); // Test on
_delay_cycles(400000);
max7219(0x0F, 0x00); // Test off
_delay_cycles(200000);
max7219(0x0E, BIT1); // Reset all control registers
_delay_cycles(100);
max7219(0x0E, 0); // Normal operation
max7219(0x09, 0x00); // No decode
max7219(0x0A, 0x0F); // full brightness
max7219(0x0B, 0x0F); // display all rows
max7219(0x0C, 0x81); // No shutdown
}
void main(void) {
WDTCTL = WDTPW + WDTHOLD; // Disable watchdog timer (WDT)
max7219_init();
}
So far I have tried the code above, which from reading the datasheet should run a test pattern.
However I cannot get any feedback from the display and this line produces an error max7219(0x0F, 0x01); // Test on <a href="file:/C:/ti/ccsv5/tools/compiler/dmed/HTML/225.html">#225-D</a> function declared implicitly
I would really appreciate it if someone could explain to me the proper way to configure the MAX7219 and get dig0 and dig1 to display a double digit number like 13