Jump to content

Search the Community

Showing results for tags 'g2231'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks

Calendars

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests


Sparkfun


Github

Found 2 results

  1. VTL On the Hackaday Forums was able to use a 2kb Msp430 to trick a Audi Concert Stereo into thinking it has a CD-Changer connected, enabling Aux Inputs. The code is a Port of a Arduino Port of a AVR Port of the VWCDPIC project (PIC Based). Using a MSP430G2231, VTL was able to implement two different Uni-Direction Protocols, through Timer_A1 and the Watchdog Timer using extra software delays. The same protocol is used in B5, B6 and B7 Audi A4s i.e. Generation I, Generation II and Generation II+ Audi head units. Unfortunately, the code is no longer available, but the post is still a nice writeup on reverse engineering a stereo and porting of code found on the internet, with good pictures too. http://forums.hackaday.com/viewtopic.php?f=3&t=123
  2. Hi all! I was wondering if anyone has used this algorithm with the G2231 before? I'm trying to use it but I keep getting an error message saying: "program will not fit into available memory. placement with alignment fails for section ".text" size 0x142e ." The reason I am trying to implement this is so I can represent exact colours for RGB LEDS in a large-ish matrix. Does anyone know a method to decrease the amount of memory being consumed by this algorithm, or increase the amount of memory allocated to ".text"? Any advice would be greatly appreciated. Here is the code I am using: #include <msp430g2231.h> #include <math.h> // TLC inputs #define SCLK_PIN BIT5 #define MOSI_PIN BIT7 #define GSCLK_PIN BIT4 #define BLANK_PIN BIT2 #define XLAT_PIN BIT1 #define VPRG_PIN BIT0 // 595 Inputs #define DATA BIT6 // DS -> P2.6 #define LATCH BIT6 // ST_CP -> 1.6 #define CLOCK BIT7 // 11 -> 2.7 // -------------- MACROS ------------------------------------------// #define setHigh(n) ( P1OUT |= n ) // Only for TLC! #define setLow(n) ( P1OUT &= ~n ) // TLC!! #define pulse(n) do { setHigh(n); setLow(n); } while(0) // ---------------------------------------------------------------------// typedef unsigned char u_char; typedef unsigned int u_int; typedef unsigned short int us_int; // Prototypes void init(void); void updateTLC(); void sendMOSI(u_int data); void pulseClock ( void ); void pinWrite ( unsigned int, int ); void shiftOut(unsigned char); void shift(unsigned int); void allrowsON(void); void allrowsOFF(void); void allcolsON(void); void delay (unsigned int); void bounce (int); void knight(int); void HSV2RGB(u_char *r, u_char *g, u_char *b, signed int h, u_char s, u_char v); #define NUMBER_OF_LEDS 24 #define NUMBER_OF_COLUMNS 8 #define NUMBER_OF_ROWS 8 u_int leds[NUMBER_OF_LEDS] = { 0, }; // 0 - 7 Red Rows, 8 - 15 Green Rows, 16 - 23 Blue Rows u_int rows[NUMBER_OF_ROWS] = { 0, }; u_char timerCounter = 0; short int icount = 0; void init(void) { WDTCTL = WDTPW + WDTHOLD; // disable WDT DCOCTL |= DCO0 + DCO1; // DCO = 15.25MHz BCSCTL1 |= RSEL0 + RSEL1 + RSEL2 + RSEL3; // as above BCSCTL2 |= DIVS_2; // divide clock by 8 P1OUT &= ~(VPRG_PIN + BLANK_PIN + XLAT_PIN + SCLK_PIN + MOSI_PIN ); P1DIR |= VPRG_PIN + BLANK_PIN + XLAT_PIN + SCLK_PIN + MOSI_PIN; // 595 P2SEL &= ~(CLOCK + LATCH); P1DIR |= DATA; // Setup pins as outputs P2DIR |= (CLOCK + LATCH); P1DIR |= GSCLK_PIN; // port 1.4 configured as SMCLK out P1SEL |= GSCLK_PIN; // setup timer CCR0 = 0xFFF; TACTL = TASSEL_2 + MC_1 + ID_0; // SMCLK, up mode, 1:1 CCTL0 = CCIE; // CCR0 interrupt enabled } void main(void) { init(); updateTLC(); pulse(XLAT_PIN); _bis_SR_register(GIE); bounce(300); knight(300); int loopCounter = 0; int p,hue; for(; { // this loop will be executed every 16.384ms, ~61Hz //leds[0-7] = Red //leds[8-15] = Green //leds[16-23] = Blue for( hue = 0 ; hue < 360 ; hue ++) // this is where the problem lies! { HSV2RGB(0,0,0,hue,1,1); } allcolsON(); if (loopCounter < 512) {//512 for( p = 0 ; p < 8 ; p++) // R (0-7) { leds[p]++; } } else if (loopCounter < 1024) { // G (8-15) for( p = 8 ; p < 16 ; p++) { leds[p]++; } } else if (loopCounter < 1536) { //dim R (0-7) for( p = 0 ; p < 8 ; p++) { leds[p]--; } } else if (loopCounter < 2048) { // B (16 - 23) for( p = 16 ; p < 24 ; p++) { leds[p]++; } } else if (loopCounter < 2560) { //dim G (8-15) for( p = 8 ; p < 16 ; p++) { leds[p]--; } } else if (loopCounter < 3072) { // R (0-7) for( p = 0 ; p < 8 ; p++) { leds[p]++; } } else if (loopCounter < 3584) { //dim B (16-23) for( p = 16 ; p < 24 ; p++) { leds[p]--; } } else if (loopCounter < 4096) { //dim R (0-7) for( p = 0 ; p < 8 ; p++) { leds[p]--; } } else { loopCounter = 0; } // do not edit below loopCounter++; // sleep _bis_SR_register(LPM0_bits); } } void updateTLC() { u_char ledCounter = NUMBER_OF_LEDS >> 1; while (ledCounter-- > 0) { u_char i = ledCounter << 1; sendMOSI(leds[i + 1]); sendMOSI(leds[i]); } } // the HSV algorithm void HSV2RGB(u_char *r, u_char *g, u_char *b, signed int h, u_char s, u_char v) { int i,z; float f, p, q, t, hf, sf, vf; hf=(float)h; sf=(float)s; vf=(float)v; sf /=255; if( sf == 0 ) { // achromatic (grey) *r = *g = *b = vf; return; } hf /= 60; // sector 0 to 5 i = floor( hf ); f = hf - i; // factorial part of h p = (u_char)(v * ( 1 - sf )); q = (u_char)(v * ( 1 - sf * f )); t = (u_char)(v * ( 1 - sf * ( 1 - f ) )); switch( i ) { case 0: *r = v; *g = t; *b = p; break; case 1: *r = q; *g = v; *b = p; break; case 2: *r = p; *g = v; *b = t; break; case 3: *r = p; *g = q; *b = v; break; case 4: *r = t; *g = p; *b = v; break; default: // case 5: *r = v; *g = p; *b = q; break; } for( z = 0 ; z < 8 ; z++) { leds[z] = *r; // red pins leds[z+8] = *g; // green pins leds[z+16] = *b; // blue pins } } void allcolsON(void) { for( icount = 0; icount < NUMBER_OF_COLUMNS ; icount++ ) { shiftOut(1 << icount); //1 << } for( icount = NUMBER_OF_COLUMNS-1; icount >= 0 ; icount-- ) { shiftOut(1 << icount); //1 << } } void allrowsON(void) { int x; for( x = 0; x < 8 ; x++ ) { leds[x] = 4095; } for( x = 7; x >= 0 ; x-- ) { leds[x] = 4095; } } void allrowsOFF(void) { int x; for( x = 0; x < 8 ; x++ ) { leds[x] = 0; } for( x = 7; x >= 0 ; x-- ) { leds[x] = 0; } } void delay(unsigned int ms) { while (ms--) { __delay_cycles(2000); // set for 16Mhz change it to 1000 for 1 Mhz } } void bounce (int time) { int a; allcolsON(); for( a = 0; a < 8 ; a++) // red { leds[a] = 4095; delay(time); leds[a] = 0; } for( a = 7 ; a >= 0 ; a--) { leds[a] = 4095; delay(time); leds[a] = 0; } for( a = 0; a < 8 ; a++) // yellow { leds[a] = 4095; leds[a+8] = 3500; delay(time); leds[a] = 0; leds[a+8] = 0; } for( a = 7 ; a >= 0 ; a--) { leds[a] = 4095; leds[a+8] = 3500; delay(time); leds[a] = 0; leds[a + 8] = 0; } for( a = 0; a < 8 ; a++) // green { leds[a+8] = 4095; delay(time); leds[a+8] = 0; } for( a = 7 ; a >= 0 ; a--) { leds[a+8] = 4095; delay(time); leds[a+8] = 0; } for( a = 0; a < 8 ; a++) // cyan { leds[a+8] = 4095; leds[a+16] = 4095; delay(time); leds[a+8] = 0; leds[a+16] = 0; } for( a = 7 ; a >= 0 ; a--) { leds[a+8] = 4095; leds[a+16] = 4095; delay(time); leds[a+8] = 0; leds[a+16] = 0; } for( a = 0; a < 8 ; a++) // blue { leds[a+16] = 4095; delay(time); leds[a+16] = 0; } for( a = 7 ; a >= 0 ; a--) { leds[a+16] = 4095; delay(time); leds[a+16] = 0; } for( a = 0; a < 8 ; a++) // magenta { leds[a] = 4095; leds[a+16] = 4095; delay(time); leds[a] = 0; leds[a+16] = 0; } for( a = 7 ; a >= 0 ; a--) { leds[a] = 4095; leds[a+16] = 4095; delay(time); leds[a] = 0; leds[a+16] = 0; } for( a = 0; a < 8 ; a++) // white { leds[a] = 4095; leds[a+8] = 4095; leds[a+16] = 4095; delay(time); leds[a] = 0; leds[a+8] = 0; leds[a+16] = 0; } for( a = 7 ; a >= 0 ; a--) { leds[a] = 4095; leds[a+8] =4095; leds[a+16] = 4095; delay(time); leds[a] = 0; leds[a+8] = 0; leds[a+16] = 0; } } void knight(int time) { int x; allrowsON(); for( x = 0 ; x < 8 ; x++) { shift(1 << x); delay(time); } for( x = 7 ; x >= 0 ; x--) { shift(1 << x); delay(time); } allrowsOFF(); } #pragma vector = TIMER0_A0_VECTOR __interrupt void Timer_A0(void) { setHigh(BLANK_PIN); pulse(XLAT_PIN); setLow(BLANK_PIN); timerCounter++; if (timerCounter == 8) { // 0x08 - 2ms * 8 = 16.384ms, ~61Hz updateTLC(); timerCounter = 0; _bic_SR_register_on_exit(LPM0_bits); } } void sendMOSI(u_int mosi) { u_char c = 0; while (c < 12) { (mosi & 0x0800) ? (P1OUT |= MOSI_PIN) : (P1OUT &= ~MOSI_PIN); pulse(SCLK_PIN); mosi <<= 1; c++; } } void shiftOut(unsigned char val) { P2OUT &= ~LATCH; pinWrite(DATA, val); pulseClock(); P2OUT |= LATCH; P2OUT &= ~LATCH; } void shift(unsigned int val) { P2OUT &= ~LATCH; int i; for (i = 0; i < 8; i++) { pinWrite(DATA, (val & (1 << i))); pulseClock(); } P2OUT |= LATCH; P2OUT &= ~LATCH; } void pinWrite( unsigned int bit, int val ) { if (val){ P1OUT |= bit; } else { P1OUT &= ~bit; } } // Pulse the clock pin void pulseClock( void ) { P2OUT |= CLOCK; P2OUT ^= CLOCK; }
×
×
  • Create New...