mtlevine0 14 Posted December 11, 2011 Share Posted December 11, 2011 I've been working on a program that will scroll messages on an 8x8 LED matrix. I've been developing with CCS v4. After each compile the Console displays the usual nonsense and at the end of the build it displays: Code Size - Text: 532 bytes Data: 1084 bytes I thought I would be very limited by the amount of RAM available on the MSP430G2211 (128 bytes RAM, 2K bytes ROM) but instead I've found that its able to handle the entire 1024 byte 8x8 font file I found online. I believe this is possible because I am declaring the font as a const and its being placed into ROM instead of RAM by the compiler automatically. Anyone with experience with this I'd appreciate your input on whats happening here. Also anyone with knowledge of what exactly is meant by the "Text" and "Data" the console displays your input would be appreciated. Thanks, Matt The code: // Matt Levine // 12//11/2011 // 8x8 LED Matrix #include #include "font.h" #define LATCH BIT3 #define CLOCK BIT4 #define DATA BIT5 #define arrayLength 128 #define delayLoopAmount 10 void delay(unsigned int ms); void pulseClock(void); void shiftOut(char val); void pinWrite(unsigned char bit, unsigned char val); char displayBuffer[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; //Blank const char cathodeIndex[8] = {0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE}; void main (void){ //Initialize CPU and Peripherals BCSCTL1 = CALBC1_1MHZ; // Setup basic clock for 1MHZ DCOCTL = CALDCO_1MHZ; // Set DCO to 1MHZ WDTCTL = WDTPW + WDTHOLD; // Disable WDT P1DIR |= (CLOCK + DATA + LATCH); // Set P1DIR direction unsigned char shiftAmount,messageIndex,delayLoop,i; //main loop, run forever while(1){ for(messageIndex = 0; messageIndex < arrayLength; messageIndex++){ //Increment scroll for(shiftAmount = 0; shiftAmount < 8; shiftAmount++){ //Update buffer with scrolling for(i = 0; i < 8; i++){ displayBuffer[i] = (displayBuffer[i] << 1) | (fontData[messageIndex][i] >> (7 - shiftAmount)); }//i //Output buffer to display for(delayLoop = 0; delayLoop < delayLoopAmount; delayLoop++){ for(i = 0; i < 8; i++){ pinWrite(LATCH,0); // Latch must be set manually. shiftOut(cathodeIndex[i]); shiftOut(displayBuffer[i]); pinWrite(LATCH,1); // Latch must be set manually. }//i }//delayLoop }//shiftAmount }//messageIndex }//while(1) }//main void delay(unsigned int ms){ while (ms--){ __delay_cycles(1000); } } void pulseClock(void){ P1OUT |= CLOCK; P1OUT &= ~CLOCK; } void shiftOut(char val){ char i; for(i = 0; i < 8; i++){ pinWrite(DATA, (val & (1 << i))); pulseClock(); } } void pinWrite(unsigned char bit, unsigned char val){ if(val){ P1OUT |= bit; }else{ P1OUT &= ~bit; } } The font: //Library found at: //http://code.google.com/p/me214/ // Modified for C use by Matt Levine // 12/11/2011 #ifndef FONT_H_ #define FONT_H_ const char fontData[128][8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 , // 0 : // | | // | | // | | // | | // | | // | | // | | // | | 0x00, 0x3E, 0x41, 0x55, 0x41, 0x55, 0x49, 0x3E , // 1 : // | | // | ***** | // | * * | // | * * * * | // | * * | // | * * * * | // | * * * | // | ***** | 0x00, 0x3E, 0x7F, 0x6B, 0x7F, 0x6B, 0x77, 0x3E , // 2 : // | | // | ***** | // | ******* | // | ** * ** | // | ******* | // | ** * ** | // | *** *** | // | ***** | 0x00, 0x22, 0x77, 0x7F, 0x7F, 0x3E, 0x1C, 0x08 , // 3 : // | | // | * * | // | *** *** | // | ******* | // | ******* | // | ***** | // | *** | // | * | 0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x3E, 0x1C, 0x08 , // 4 : // | | // | * | // | *** | // | ***** | // | ******* | // | ***** | // | *** | // | * | 0x00, 0x08, 0x1C, 0x2A, 0x7F, 0x2A, 0x08, 0x1C , // 5 : // | | // | * | // | *** | // | * * * | // | ******* | // | * * * | // | * | // | *** | 0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x3E, 0x08, 0x1C , // 6 : // | | // | * | // | *** | // | ***** | // | ******* | // | ***** | // | * | // | *** | 0x00, 0x00, 0x1C, 0x3E, 0x3E, 0x3E, 0x1C, 0x00 , // 7 : // | | // | | // | *** | // | ***** | // | ***** | // | ***** | // | *** | // | | 0xFF, 0xFF, 0xE3, 0xC1, 0xC1, 0xC1, 0xE3, 0xFF , // 8 : // | ******** | // | ******** | // | *** ** | // | ** * | // | ** * | // | ** * | // | *** ** | // | ******** | 0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x1C, 0x00 , // 9 : // | | // | | // | *** | // | * * | // | * * | // | * * | // | *** | // | | 0xFF, 0xFF, 0xE3, 0xDD, 0xDD, 0xDD, 0xE3, 0xFF , // 10 : // | ******** | // | ******** | // | *** ** | // | ** *** * | // | ** *** * | // | ** *** * | // | *** ** | // | ******** | 0x00, 0x0F, 0x03, 0x05, 0x39, 0x48, 0x48, 0x30 , // 11 : // | | // | **** | // | ** | // | * * | // | *** * | // | * * | // | * * | // | ** | 0x00, 0x08, 0x3E, 0x08, 0x1C, 0x22, 0x22, 0x1C , // 12 : // | | // | * | // | ***** | // | * | // | *** | // | * * | // | * * | // | *** | 0x00, 0x18, 0x14, 0x10, 0x10, 0x30, 0x70, 0x60 , // 13 : // | | // | ** | // | * * | // | * | // | * | // | ** | // | *** | // | ** | 0x00, 0x0F, 0x19, 0x11, 0x13, 0x37, 0x76, 0x60 , // 14 : // | | // | **** | // | ** * | // | * * | // | * ** | // | ** *** | // | *** ** | // | ** | 0x00, 0x08, 0x2A, 0x1C, 0x77, 0x1C, 0x2A, 0x08 , // 15 : // | | // | * | // | * * * | // | *** | // | *** *** | // | *** | // | * * * | // | * | 0x00, 0x60, 0x78, 0x7E, 0x7F, 0x7E, 0x78, 0x60 , // 16 : // | | // | ** | // | **** | // | ****** | // | ******* | // | ****** | // | **** | // | ** | 0x00, 0x03, 0x0F, 0x3F, 0x7F, 0x3F, 0x0F, 0x03 , // 17 : // | | // | ** | // | **** | // | ****** | // | ******* | // | ****** | // | **** | // | ** | 0x00, 0x08, 0x1C, 0x2A, 0x08, 0x2A, 0x1C, 0x08 , // 18 : // | | // | * | // | *** | // | * * * | // | * | // | * * * | // | *** | // | * | 0x00, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66 , // 19 : // | | // | ** ** | // | ** ** | // | ** ** | // | ** ** | // | | // | ** ** | // | ** ** | 0x00, 0x3F, 0x65, 0x65, 0x3D, 0x05, 0x05, 0x05 , // 20 : // | | // | ****** | // | ** * * | // | ** * * | // | **** * | // | * * | // | * * | // | * * | 0x00, 0x0C, 0x32, 0x48, 0x24, 0x12, 0x4C, 0x30 , // 21 : // | | // | ** | // | ** * | // | * * | // | * * | // | * * | // | * ** | // | ** | 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F , // 22 : // | | // | | // | | // | | // | | // | ******* | // | ******* | // | ******* | 0x00, 0x08, 0x1C, 0x2A, 0x08, 0x2A, 0x1C, 0x3E , // 23 : // | | // | * | // | *** | // | * * * | // | * | // | * * * | // | *** | // | ***** | 0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x1C, 0x1C, 0x1C , // 24 : // | | // | * | // | *** | // | ***** | // | ******* | // | *** | // | *** | // | *** | 0x00, 0x1C, 0x1C, 0x1C, 0x7F, 0x3E, 0x1C, 0x08 , // 25 : // | | // | *** | // | *** | // | *** | // | ******* | // | ***** | // | *** | // | * | 0x00, 0x08, 0x0C, 0x7E, 0x7F, 0x7E, 0x0C, 0x08 , // 26 : // | | // | * | // | ** | // | ****** | // | ******* | // | ****** | // | ** | // | * | 0x00, 0x08, 0x18, 0x3F, 0x7F, 0x3F, 0x18, 0x08 , // 27 : // | | // | * | // | ** | // | ****** | // | ******* | // | ****** | // | ** | // | * | 0x00, 0x00, 0x00, 0x70, 0x70, 0x70, 0x7F, 0x7F , // 28 : // | | // | | // | | // | *** | // | *** | // | *** | // | ******* | // | ******* | 0x00, 0x00, 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00 , // 29 : // | | // | | // | * * | // | * * | // | ******* | // | * * | // | * * | // | | 0x00, 0x08, 0x1C, 0x1C, 0x3E, 0x3E, 0x7F, 0x7F , // 30 : // | | // | * | // | *** | // | *** | // | ***** | // | ***** | // | ******* | // | ******* | 0x00, 0x7F, 0x7F, 0x3E, 0x3E, 0x1C, 0x1C, 0x08 , // 31 : // | | // | ******* | // | ******* | // | ***** | // | ***** | // | *** | // | *** | // | * | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 , // 32 : // | | // | | // | | // | | // | | // | | // | | // | | 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18 , // 33 : ! // | | // | ** | // | **** | // | **** | // | ** | // | ** | // | | // | ** | 0x00, 0x36, 0x36, 0x14, 0x00, 0x00, 0x00, 0x00 , // 34 : " // | | // | ** ** | // | ** ** | // | * * | // | | // | | // | | // | | 0x00, 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36 , // 35 : # // | | // | ** ** | // | ** ** | // | ******* | // | ** ** | // | ******* | // | ** ** | // | ** ** | 0x00, 0x08, 0x1E, 0x20, 0x1C, 0x02, 0x3C, 0x08 , // 36 : $ // | | // | * | // | **** | // | * | // | *** | // | * | // | **** | // | * | 0x00, 0x60, 0x66, 0x0C, 0x18, 0x30, 0x66, 0x06 , // 37 : % // | | // | ** | // | ** ** | // | ** | // | ** | // | ** | // | ** ** | // | ** | 0x00, 0x3C, 0x66, 0x3C, 0x28, 0x65, 0x66, 0x3F , // 38 : & // | | // | **** | // | ** ** | // | **** | // | * * | // | ** * * | // | ** ** | // | ****** | 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00 , // 39 : ' // | | // | ** | // | ** | // | ** | // | ** | // | | // | | // | | 0x00, 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60 , // 40 : ( // | | // | ** | // | ** | // | ** | // | ** | // | ** | // | ** | // | ** | 0x00, 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06 , // 41 : ) // | | // | ** | // | ** | // | ** | // | ** | // | ** | // | ** | // | ** | 0x00, 0x00, 0x36, 0x1C, 0x7F, 0x1C, 0x36, 0x00 , // 42 : * // | | // | | // | ** ** | // | *** | // | ******* | // | *** | // | ** ** | // | | 0x00, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00 , // 43 : + // | | // | | // | * | // | * | // | ***** | // | * | // | * | // | | 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x60 , // 44 : , // | | // | | // | | // | | // | ** | // | ** | // | ** | // | ** | 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00 , // 45 : - // | | // | | // | | // | | // | **** | // | | // | | // | | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60 , // 46 : . // | | // | | // | | // | | // | | // | | // | ** | // | ** | 0x00, 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00 , // 47 : / // | | // | | // | ** | // | ** | // | ** | // | ** | // | ** | // | | 0x00, 0x3C, 0x66, 0x6E, 0x76, 0x66, 0x66, 0x3C , // 48 : 0 // | | // | **** | // | ** ** | // | ** *** | // | *** ** | // | ** ** | // | ** ** | // | **** | 0x00, 0x18, 0x18, 0x38, 0x18, 0x18, 0x18, 0x7E , // 49 : 1 // | | // | ** | // | ** | // | *** | // | ** | // | ** | // | ** | // | ****** | 0x00, 0x3C, 0x66, 0x06, 0x0C, 0x30, 0x60, 0x7E , // 50 : 2 // | | // | **** | // | ** ** | // | ** | // | ** | // | ** | // | ** | // | ****** | 0x00, 0x3C, 0x66, 0x06, 0x1C, 0x06, 0x66, 0x3C , // 51 : 3 // | | // | **** | // | ** ** | // | ** | // | *** | // | ** | // | ** ** | // | **** | 0x00, 0x0C, 0x1C, 0x2C, 0x4C, 0x7E, 0x0C, 0x0C , // 52 : 4 // | | // | ** | // | *** | // | * ** | // | * ** | // | ****** | // | ** | // | ** | 0x00, 0x7E, 0x60, 0x7C, 0x06, 0x06, 0x66, 0x3C , // 53 : 5 // | | // | ****** | // | ** | // | ***** | // | ** | // | ** | // | ** ** | // | **** | 0x00, 0x3C, 0x66, 0x60, 0x7C, 0x66, 0x66, 0x3C , // 54 : 6 // | | // | **** | // | ** ** | // | ** | // | ***** | // | ** ** | // | ** ** | // | **** | 0x00, 0x7E, 0x66, 0x0C, 0x0C, 0x18, 0x18, 0x18 , // 55 : 7 // | | // | ****** | // | ** ** | // | ** | // | ** | // | ** | // | ** | // | ** | 0x00, 0x3C, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x3C , // 56 : 8 // | | // | **** | // | ** ** | // | ** ** | // | **** | // | ** ** | // | ** ** | // | **** | 0x00, 0x3C, 0x66, 0x66, 0x3E, 0x06, 0x66, 0x3C , // 57 : 9 // | | // | **** | // | ** ** | // | ** ** | // | ***** | // | ** | // | ** ** | // | **** | 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00 , // 58 : : // | | // | | // | ** | // | ** | // | | // | ** | // | ** | // | | 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x30 , // 59 : ; // | | // | | // | ** | // | ** | // | | // | ** | // | ** | // | ** | 0x00, 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06 , // 60 : < // | | // | ** | // | ** | // | ** | // | ** | // | ** | // | ** | // | ** | 0x00, 0x00, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x00 , // 61 : = // | | // | | // | | // | **** | // | | // | **** | // | | // | | 0x00, 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60 , // 62 : > // | | // | ** | // | ** | // | ** | // | ** | // | ** | // | ** | // | ** | 0x00, 0x3C, 0x66, 0x06, 0x1C, 0x18, 0x00, 0x18 , // 63 : ? // | | // | **** | // | ** ** | // | ** | // | *** | // | ** | // | | // | ** | 0x00, 0x38, 0x44, 0x5C, 0x58, 0x42, 0x3C, 0x00 , // 64 : @ // | | // | *** | // | * * | // | * *** | // | * ** | // | * * | // | **** | // | | 0x00, 0x3C, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66 , // 65 : A // | | // | **** | // | ** ** | // | ** ** | // | ****** | // | ** ** | // | ** ** | // | ** ** | 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x7C , // 66 : B // | | // | ***** | // | ** ** | // | ** ** | // | ***** | // | ** ** | // | ** ** | // | ***** | 0x00, 0x3C, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3C , // 67 : C // | | // | **** | // | ** ** | // | ** | // | ** | // | ** | // | ** ** | // | **** | 0x00, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C , // 68 : D // | | // | ***** | // | ** ** | // | ** ** | // | ** ** | // | ** ** | // | ** ** | // | ***** | 0x00, 0x7E, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x7E , // 69 : E // | | // | ****** | // | ** | // | ** | // | ***** | // | ** | // | ** | // | ****** | 0x00, 0x7E, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x60 , // 70 : F // | | // | ****** | // | ** | // | ** | // | ***** | // | ** | // | ** | // | ** | 0x00, 0x3C, 0x66, 0x60, 0x60, 0x6E, 0x66, 0x3C , // 71 : G // | | // | **** | // | ** ** | // | ** | // | ** | // | ** *** | // | ** ** | // | **** | 0x00, 0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66 , // 72 : H // | | // | ** ** | // | ** ** | // | ** ** | // | ****** | // | ** ** | // | ** ** | // | ** ** | 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C , // 73 : I // | | // | **** | // | ** | // | ** | // | ** | // | ** | // | ** | // | **** | 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x6C, 0x6C, 0x38 , // 74 : J // | | // | **** | // | ** | // | ** | // | ** | // | ** ** | // | ** ** | // | *** | 0x00, 0x66, 0x6C, 0x78, 0x70, 0x78, 0x6C, 0x66 , // 75 : K // | | // | ** ** | // | ** ** | // | **** | // | *** | // | **** | // | ** ** | // | ** ** | 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7E , // 76 : L // | | // | ** | // | ** | // | ** | // | ** | // | ** | // | ** | // | ****** | 0x00, 0x63, 0x77, 0x7F, 0x6B, 0x63, 0x63, 0x63 , // 77 : M // | | // | ** ** | // | *** *** | // | ******* | // | ** * ** | // | ** ** | // | ** ** | // | ** ** | 0x00, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x63, 0x63 , // 78 : N // | | // | ** ** | // | *** ** | // | **** ** | // | ** **** | // | ** *** | // | ** ** | // | ** ** | 0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C , // 79 : O // | | // | **** | // | ** ** | // | ** ** | // | ** ** | // | ** ** | // | ** ** | // | **** | 0x00, 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60 , // 80 : P // | | // | ***** | // | ** ** | // | ** ** | // | ** ** | // | ***** | // | ** | // | ** | 0x00, 0x3C, 0x66, 0x66, 0x66, 0x6E, 0x3C, 0x06 , // 81 : Q // | | // | **** | // | ** ** | // | ** ** | // | ** ** | // | ** *** | // | **** | // | ** | 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x78, 0x6C, 0x66 , // 82 : R // | | // | ***** | // | ** ** | // | ** ** | // | ***** | // | **** | // | ** ** | // | ** ** | 0x00, 0x3C, 0x66, 0x60, 0x3C, 0x06, 0x66, 0x3C , // 83 : S // | | // | **** | // | ** ** | // | ** | // | **** | // | ** | // | ** ** | // | **** | 0x00, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x18, 0x18 , // 84 : T // | | // | ****** | // | * ** * | // | ** | // | ** | // | ** | // | ** | // | ** | 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3E , // 85 : U // | | // | ** ** | // | ** ** | // | ** ** | // | ** ** | // | ** ** | // | ** ** | // | ***** | 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18 , // 86 : V // | | // | ** ** | // | ** ** | // | ** ** | // | ** ** | // | ** ** | // | **** | // | ** | 0x00, 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63 , // 87 : W // | | // | ** ** | // | ** ** | // | ** ** | // | ** * ** | // | ******* | // | *** *** | // | ** ** | 0x00, 0x63, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x63 , // 88 : X // | | // | ** ** | // | ** ** | // | ** ** | // | *** | // | ** ** | // | ** ** | // | ** ** | 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18 , // 89 : Y // | | // | ** ** | // | ** ** | // | ** ** | // | **** | // | ** | // | ** | // | ** | 0x00, 0x7E, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x7E , // 90 : Z // | | // | ****** | // | ** | // | ** | // | ** | // | ** | // | ** | // | ****** | 0x00, 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E , // 91 : [ // | | // | **** | // | ** | // | ** | // | ** | // | ** | // | ** | // | **** | 0x00, 0x00, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00 , // 92 : \ // | | // | | // | ** | // | ** | // | ** | // | ** | // | ** | // | | 0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78 , // 93 : ] // | | // | **** | // | ** | // | ** | // | ** | // | ** | // | ** | // | **** | 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x00 , // 94 : ^ // | | // | * | // | * * | // | * * | // | * * | // | | // | | // | | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F , // 95 : _ // | | // | | // | | // | | // | | // | | // | | // | ******* | 0x00, 0x0C, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00 , // 96 : ` // | | // | ** | // | ** | // | ** | // | | // | | // | | // | | 0x00, 0x00, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E , // 97 : a // | | // | | // | | // | **** | // | ** | // | ***** | // | ** ** | // | ***** | 0x00, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x7C , // 98 : b // | | // | ** | // | ** | // | ** | // | ***** | // | ** ** | // | ** ** | // | ***** | 0x00, 0x00, 0x00, 0x3C, 0x66, 0x60, 0x66, 0x3C , // 99 : c // | | // | | // | | // | **** | // | ** ** | // | ** | // | ** ** | // | **** | 0x00, 0x06, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3E , // 100 : d // | | // | ** | // | ** | // | ** | // | ***** | // | ** ** | // | ** ** | // | ***** | 0x00, 0x00, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C , // 101 : e // | | // | | // | | // | **** | // | ** ** | // | ****** | // | ** | // | **** | 0x00, 0x1C, 0x36, 0x30, 0x30, 0x7C, 0x30, 0x30 , // 102 : f // | | // | *** | // | ** ** | // | ** | // | ** | // | ***** | // | ** | // | ** | 0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x3C , // 103 : g // | | // | | // | ***** | // | ** ** | // | ** ** | // | ***** | // | ** | // | **** | 0x00, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66 , // 104 : h // | | // | ** | // | ** | // | ** | // | ***** | // | ** ** | // | ** ** | // | ** ** | 0x00, 0x00, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3C , // 105 : i // | | // | | // | ** | // | | // | ** | // | ** | // | ** | // | **** | 0x00, 0x0C, 0x00, 0x0C, 0x0C, 0x6C, 0x6C, 0x38 , // 106 : j // | | // | ** | // | | // | ** | // | ** | // | ** ** | // | ** ** | // | *** | 0x00, 0x60, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0x66 , // 107 : k // | | // | ** | // | ** | // | ** ** | // | ** ** | // | **** | // | ** ** | // | ** ** | 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 , // 108 : l // | | // | ** | // | ** | // | ** | // | ** | // | ** | // | ** | // | ** | 0x00, 0x00, 0x00, 0x63, 0x77, 0x7F, 0x6B, 0x6B , // 109 : m // | | // | | // | | // | ** ** | // | *** *** | // | ******* | // | ** * ** | // | ** * ** | 0x00, 0x00, 0x00, 0x7C, 0x7E, 0x66, 0x66, 0x66 , // 110 : n // | | // | | // | | // | ***** | // | ****** | // | ** ** | // | ** ** | // | ** ** | 0x00, 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C , // 111 : o // | | // | | // | | // | **** | // | ** ** | // | ** ** | // | ** ** | // | **** | 0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60 , // 112 : p // | | // | | // | ***** | // | ** ** | // | ** ** | // | ***** | // | ** | // | ** | 0x00, 0x00, 0x3C, 0x6C, 0x6C, 0x3C, 0x0D, 0x0F , // 113 : q // | | // | | // | **** | // | ** ** | // | ** ** | // | **** | // | ** * | // | **** | 0x00, 0x00, 0x00, 0x7C, 0x66, 0x66, 0x60, 0x60 , // 114 : r // | | // | | // | | // | ***** | // | ** ** | // | ** ** | // | ** | // | ** | 0x00, 0x00, 0x00, 0x3E, 0x40, 0x3C, 0x02, 0x7C , // 115 : s // | | // | | // | | // | ***** | // | * | // | **** | // | * | // | ***** | 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x18 , // 116 : t // | | // | | // | ** | // | ** | // | ****** | // | ** | // | ** | // | ** | 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E , // 117 : u // | | // | | // | | // | ** ** | // | ** ** | // | ** ** | // | ** ** | // | ***** | 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3C, 0x18 , // 118 : v // | | // | | // | | // | | // | ** ** | // | ** ** | // | **** | // | ** | 0x00, 0x00, 0x00, 0x63, 0x6B, 0x6B, 0x6B, 0x3E , // 119 : w // | | // | | // | | // | ** ** | // | ** * ** | // | ** * ** | // | ** * ** | // | ***** | 0x00, 0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66 , // 120 : x // | | // | | // | | // | ** ** | // | **** | // | ** | // | **** | // | ** ** | 0x00, 0x00, 0x00, 0x66, 0x66, 0x3E, 0x06, 0x3C , // 121 : y // | | // | | // | | // | ** ** | // | ** ** | // | ***** | // | ** | // | **** | 0x00, 0x00, 0x00, 0x3C, 0x0C, 0x18, 0x30, 0x3C , // 122 : z // | | // | | // | | // | **** | // | ** | // | ** | // | ** | // | **** | 0x00, 0x0E, 0x18, 0x18, 0x30, 0x18, 0x18, 0x0E , // 123 : { // | | // | *** | // | ** | // | ** | // | ** | // | ** | // | ** | // | *** | 0x00, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18 , // 124 : | // | | // | ** | // | ** | // | ** | // | | // | ** | // | ** | // | ** | 0x00, 0x70, 0x18, 0x18, 0x0C, 0x18, 0x18, 0x70 , // 125 : } // | | // | *** | // | ** | // | ** | // | ** | // | ** | // | ** | // | *** | 0x00, 0x00, 0x00, 0x3A, 0x6C, 0x00, 0x00, 0x00 , // 126 : ~ // | | // | | // | | // | *** * | // | ** ** | // | | // | | // | | 0x00, 0x08, 0x1C, 0x36, 0x63, 0x41, 0x41, 0x7F // 127 : // | | // | * | // | *** | // | ** ** | // | ** ** | // | * * | // | * * | // | ******* | }; #endif /*FONT_H_*/ Quote Link to post Share on other sites
simpleavr 399 Posted December 11, 2011 Share Posted December 11, 2011 for "const" type data, as your font data are defined, u don't need to use ram as they are not going to change dynamically during program execution. i.e. u don't need to change values of these variables. the compiler (at least mspgcc that i use) will place your data along w/ your code and that occupies your programming flash space instead of ram space. also msp430 has only flash, there is no rom. and they are similar. mtlevine0 1 Quote Link to post Share on other sites
mtlevine0 14 Posted December 11, 2011 Author Share Posted December 11, 2011 Thanks for the response, that helps answer my questions. I was under the impression that manually storing data into the flash was a difficult process and not one the compiler would do automatically. Quote Link to post Share on other sites
gordon 229 Posted December 11, 2011 Share Posted December 11, 2011 The '430 is von Neumann architecture; there aren't many of the Harvard doohickeys (coughPROGMEMcough) needed here, making this less of a problem. It's just a matter of linking appropriately -- accessing it is no different than accessing any other part of the address space. Quote Link to post Share on other sites
kenemon 29 Posted December 12, 2011 Share Posted December 12, 2011 I think text refers to your raw code (with comments, etc) and data refers to the binary compiled code, is this agreeable? Quote Link to post Share on other sites
gordon 229 Posted December 12, 2011 Share Posted December 12, 2011 No, no. They refer to the various sections in the final binary (I'm making the connection with ELF here, this is what mspgcc uses anyway; the other compilers use different binary formats -- not exactly sure if they can be mapped 1:1 to ELF, but I'm guessing the principles can't be too far off): text is where the code (actual instructions) go (it's also likely constant (non-writeable) data go here as well), data is where writeable data (as in variables et all) go. There are other sections as well, things that contain debug symbols and stuff; get more about this at http://wiki.osdev.org/ELF for example, but read this with a grain of salt -- this article describes things from a perspective of a full-blown CPU with memory management and the like, quite some of the sections in this article simply make no sense in an MCU-context (no separate .text and .rodata for example, you simply have both of them in flash, whereas on a full-blown CPU things get a tad bit more complicated than that). mtlevine0 1 Quote Link to post Share on other sites
bluehash 1,581 Posted December 12, 2011 Share Posted December 12, 2011 Credit: DrMag, gordon and mtlevine0 3 Quote Link to post Share on other sites
gordon 229 Posted December 12, 2011 Share Posted December 12, 2011 Indeed, but do note that this table (and the referenced page) is heavily GNU toolchain-(thus ELF-)centric. What you will find in the binaries IAR or CCS emits may or may not be an entirely different thing. Just found out that CCS comes with this tool ofd430.exe, which says CCS-emitted binaries are TI-COFF, and lists mostly familiar section names (remember that both COFF and ELF are basically container formats and are extendable to the toolchain writers' heart's content); for one reason or another I seem to remember that IAR uses a completely closed and proprietary binary format. Quote Link to post Share on other sites
mtlevine0 14 Posted December 13, 2011 Author Share Posted December 13, 2011 Thanks for all the information this gives me a lot to look in to. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.