
fairwind
-
Content Count
4 -
Joined
-
Last visited
Posts posted by fairwind
-
-
You could get a serial converter backpack for your LCD's
With the limited pins of these chips 1 wire is the way to go.
This is 1 link:
http://www.sparkfun.com/commerce/produc ... cts_id=258
There are other serial backpacks out there, just Google
-
Hi NJC,
Thanks for the comments. They are all good ideas. They will most likely solve my missing
3rd button press. In the debugger the program is hung somewhere and pressing the button
again brings it back. Strange...
I look forward to any tut you might post, I am new to C++ and there is much to learn!!
How about showing us some interrupt code like you suggested.
Thanks again
Fairwind
-
MSP-EXP430G2 Launchpad Board - Chip is a G2231
This code will print 'Hello World !!' to your terminal each time you push the p1.3 button, the first push you might get some garbage till they sync.
Easy enough to fix however the button works 2 times and skips the 3 then works 2 times and skips the 3rd.
Any help here would be great.
Modified by Nicholas J. Conn - http://msp430launchpad.blogspot.com
Date Modified: 07-25-10
Modified by Larry N Critchfield 9600-8-N-1-N
Hello World !! Interrupt on P1.3 requests output to Terminal
#include "msp430g2231.h" #define TXD BIT1 // TXD on P1.1 #define Bitime 104 //9600 Baud, SMCLK=1MHz (1MHz/9600)=104 unsigned char BitCnt; // Bit count, used when transmitting byte unsigned int TXByte; // Value sent over UART when Transmit() is called // Function Definitions void Transmit(void); void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= 0x01; // Set P1.0 to output direction P1IE |= 0x08; // P1.3 interrupt enabled P1IES |= 0x08; // P1.3 Hi/lo edge P1IFG &= ~0x08; // P1.3 IFG cleared _BIS_SR(LPM4_bits + GIE); // Enter LPM4 w/interrupt } // Port 1 interrupt service routine #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { P1IFG &= ~0x08; // P1.3 IFG cleared unsigned int uartUpdateTimer = 10; // Loops until byte is sent unsigned int i = 0; // Transmit value counter 33 = ! BCSCTL1 = CALBC1_1MHZ; // Set range DCOCTL = CALDCO_1MHZ; // SMCLK = DCO = 1MHz P1SEL |= TXD; // P1DIR |= TXD; // __bis_SR_register(GIE); // interrupts enabled\ int arInteger[14] = {72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 32, 33, 33}; /* Main Application Loop */ while(1) { if (i > 13) // { i = 0; P1OUT = 0x00; main(); } if ((--uartUpdateTimer == 0)) { P1OUT = 0x01; TXByte = arInteger[i]; Transmit(); i++; uartUpdateTimer = 10; } } } // Function Transmits Character from TXByte void Transmit() { CCTL0 = OUT; // TXD Idle as Mark TACTL = TASSEL_2 + MC_2; // SMCLK, continuous mode BitCnt = 0xA; // Load Bit counter, 8 bits + ST/SP CCR0 = TAR; CCR0 += Bitime; // Set time till first bit TXByte |= 0x100; // Add stop bit to TXByte (which is logical 1) TXByte = TXByte << 1; // Add start bit (which is logical 0) CCTL0 = CCIS0 + OUTMOD0 + CCIE; // Set signal, intial value, enable interrupts while ( CCTL0 & CCIE ); // Wait for TX completion TACTL = TASSEL_2; // SMCLK, timer off (for power consumption) } // Timer A0 interrupt service routine #pragma vector=TIMERA0_VECTOR __interrupt void Timer_A (void) { CCR0 += Bitime; // Add Offset to CCR0 if ( BitCnt == 0) // If all bits TXed, disable interrupt CCTL0 &= ~ CCIE ; else { CCTL0 |= OUTMOD2; // TX Space if (TXByte & 0x01) CCTL0 &= ~ OUTMOD2; // TX Mark TXByte = TXByte >> 1; BitCnt --; } }
Free eZ430-F2013, just pay shipping
in Programmers and Debuggers
Posted
I just tried, the code is good but could not get free shipping :?