Jump to content

Search the Community

Showing results for tags 'inputs'.



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 1 result

  1. Hello, I am basically new to msp430 and CCS, and I am having a hard time trying to understand code, interrupts and timers. Background info: Goal.- read and interpret a dual 7 segment LED display with 10 pins. So after playing around with this part I found out that the way this works is the driver pins (9, 6) toggle each other really fast ~4khz, 9 is on while 6 is of etc. My idea was to use the MSP430G2553 to read A-G on PORT1 and the 2 drivers (9, 6) on PORT2. I read on interrupts and saw that there is a way to set up an interrupt for when your input signal (in this case 9 or 6 on the diagram) goes from high to low or low to high. SO if I could read all A-G segments when 9 is "on" it would correspond to digit 1, when 9 goes to "off" and 6 turns "on" i would read all A-G segments again and that would correspond to digit 2... I thought it would be easy but apparently there is a lot that I am overlooking. Here is my attempt to code: (worked from an example from TI Resource Explorer) #include <msp430.h> volatile int flag = 0; int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop Watchdog timer if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF) { while(1); //trap for the Digitally controlled O. } BCSCTL1 = CALBC1_1MHZ; //set range for the O. DCOCTL = CALDCO_1MHZ; //set DCO step modulation 1MHZ P1DIR = 0; // Set P1.0 - P1.7 as input P2DIR = 0XF9; // set P2.1 AND P2.2 as inputs P2OUT = BIT4; // set P2.4 to start as on P2IE |= BIT2; // P2.2 interrupt enabled P2IES = 1; // Flag is set with a high-to-low transition P2IFG &= ~BIT2; // P2.2 interrupt flag cleared __bis_SR_register(GIE); // Enable all interrupts while(1) //Loop forever { } } #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { if(P1IN == 0x79) //check if P1IN= 01111001 means, p1.0=1, p1.1=0, p1.2=0, p1.3=1... etc { P2OUT = 0; // turn off bit 4 on port 2 (added to see if i recognize 01111001) } P2IFG &= ~BIT2; // P2.1 interrupt flag cleared } I am attempting to read all inputs in PORT1 and check if they match 01111001 which corresponds to the digit displaying "1" inverted so my zeros mean the segment is "on" so for example if i wanted to display "7" segments a, b, and c should be 0 the rest 1. or (01111000) I am ignoring the DP. The code compiles but my LED at BIT4 never turns off which means the interrupt is never happening? Any feedback is very much appreciated.
×
×
  • Create New...