Jump to content
43oh

PowerX

Members
  • Content Count

    18
  • Joined

  • Last visited

Reputation Activity

  1. Like
    PowerX got a reaction from joshferns in IRremote   
    You need to modify IRremote.cpp under "\hardware\msp430\libraries\IRremote".
    After the TIMER_PIN_SELECT();
    Comment these lines :
     
    // pinMode(TIMER_PWM_PIN, OUTPUT);
    // digitalWrite(TIMER_PWM_PIN, LOW); // When not sending PWM, we want it low
     
    The pin output is P2_3. For the demo you need to send something on serial to transmit.
     
    PS: Tested and working IRrecv and IRsend with 2xmsp430g2553.
     
    Hope it helps,
    Have fun
  2. Like
    PowerX got a reaction from pivden in IRremote   
    You need to modify IRremote.cpp under "\hardware\msp430\libraries\IRremote".
    After the TIMER_PIN_SELECT();
    Comment these lines :
     
    // pinMode(TIMER_PWM_PIN, OUTPUT);
    // digitalWrite(TIMER_PWM_PIN, LOW); // When not sending PWM, we want it low
     
    The pin output is P2_3. For the demo you need to send something on serial to transmit.
     
    PS: Tested and working IRrecv and IRsend with 2xmsp430g2553.
     
    Hope it helps,
    Have fun
  3. Like
    PowerX got a reaction from imminajinia in Hello from Romania   
    Hello,
     
    I just recieved the c2k launchpad today, looking forward to test and learn more about it, i`m glad i found this forum
    Mihai
  4. Like
    PowerX reacted to CorB in Interrupt based button and PORT_A leds   
    Hi,
     
    Here's a simple example (based on a crossover of TI;s example code External_interrupt and LaunchpadDemo) that detects a buttonpress on the C2000 Launchpad (GPIO12), processes the press in an interrupt and shows the no of buttonpresses using the Port_A LED setup. The button isnt properly debounced yet it seems but its working. The code isnt the shortest possible I guess.
     
    regards
    CorB
     

    //############################################################################# // // File: /Example_F2802xButtonInterrupt.c // // Title: F2802x Button Interrupt test program, will show successive presses on PORT_A leds // // Group: C2000 Launchpad // Target Device: TMS320F28027 // // Code based on TIs examples External_interrupt and LaunchpadDemo // ########################################################################### #include "DSP28x_Project.h" // Device Headerfile and Examples Include File #include "f2802x_common/include/clk.h" #include "f2802x_common/include/flash.h" #include "f2802x_common/include/gpio.h" #include "f2802x_common/include/pie.h" #include "f2802x_common/include/pll.h" #include "f2802x_common/include/pwr.h" #include "f2802x_common/include/wdog.h" // Prototype statements for functions found within this file. interrupt void xint1_isr(void); char counter; // the counter showing the no of button presses CLK_Handle myClk; FLASH_Handle myFlash; GPIO_Handle myGpio; PIE_Handle myPie; void main(void) { CPU_Handle myCpu; PLL_Handle myPll; WDOG_Handle myWDog; // Initialize all the handles needed for this application myClk = CLK_init((void *)CLK_BASE_ADDR, sizeof(CLK_Obj)); myCpu = CPU_init((void *)NULL, sizeof(CPU_Obj)); myFlash = FLASH_init((void *)FLASH_BASE_ADDR, sizeof(FLASH_Obj)); myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj)); myPie = PIE_init((void *)PIE_BASE_ADDR, sizeof(PIE_Obj)); myPll = PLL_init((void *)PLL_BASE_ADDR, sizeof(PLL_Obj)); myWDog = WDOG_init((void *)WDOG_BASE_ADDR, sizeof(WDOG_Obj)); // Perform basic system initialization WDOG_disable(myWDog); CLK_enableAdcClock(myClk); (*Device_cal)(); //Select the internal oscillator 1 as the clock source CLK_setOscSrc(myClk, CLK_OscSrc_Internal); // Setup the PLL for x10 /2 which will yield 50Mhz = 10Mhz * 10 / 2 PLL_setup(myPll, PLL_Multiplier_10, PLL_DivideSelect_ClkIn_by_2); // Disable the PIE and all interrupts PIE_disable(myPie); PIE_disableAllInts(myPie); CPU_disableGlobalInts(myCpu); CPU_clearIntFlags(myCpu); // If running from flash copy RAM only functions to RAM #ifdef _FLASH memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize); #endif // Setup a debug vector table and enable the PIE PIE_setDebugIntVectorTable(myPie); PIE_enable(myPie); // Register interrupt handlers in the PIE vector table PIE_registerPieIntHandler(myPie, PIE_GroupNumber_1, PIE_SubGroupNumber_4, (intVec_t)&xint1_isr); // Enable XINT1 in the PIE: Group 1 interrupt 4 // Enable INT1 which is connected to WAKEINT PIE_enableInt(myPie, PIE_GroupNumber_1, PIE_InterruptSource_XINT_1); CPU_enableInt(myCpu, CPU_IntNumber_1); // Enable Global Interrupts CPU_enableGlobalInts(myCpu); // Configure GPIO 0-3 as outputs GPIO_setMode(myGpio, GPIO_Number_0, GPIO_0_Mode_GeneralPurpose); GPIO_setMode(myGpio, GPIO_Number_1, GPIO_0_Mode_GeneralPurpose); GPIO_setMode(myGpio, GPIO_Number_2, GPIO_0_Mode_GeneralPurpose); GPIO_setMode(myGpio, GPIO_Number_3, GPIO_0_Mode_GeneralPurpose); GPIO_setDirection(myGpio, GPIO_Number_0, GPIO_Direction_Output); GPIO_setDirection(myGpio, GPIO_Number_1, GPIO_Direction_Output); GPIO_setDirection(myGpio, GPIO_Number_2, GPIO_Direction_Output); GPIO_setDirection(myGpio, GPIO_Number_3, GPIO_Direction_Output); // GPIO12 input GPIO_setMode(myGpio, GPIO_Number_12, GPIO_12_Mode_GeneralPurpose); GPIO_setDirection(myGpio, GPIO_Number_12, GPIO_Direction_Input); GPIO_setPullUp(myGpio, GPIO_Number_12, GPIO_PullUp_Disable); // important !! // GPIO12 is XINT1 GPIO_setExtInt(myGpio, GPIO_Number_12, CPU_ExtIntNumber_1); // Configure XINT1 PIE_setExtIntPolarity(myPie, CPU_ExtIntNumber_1, PIE_ExtIntPolarity_FallingEdge); // Enable XINT1 PIE_enableExtInt(myPie, CPU_ExtIntNumber_1); counter=0; GPIO_setPortData(myGpio, GPIO_Port_A, (~(counter) & 0x0F)); for(; { /// forever loop } } interrupt void xint1_isr(void) { //GPIO_toggle(myGpio, GPIO_Number_0); // toggle LED0 counter++; GPIO_setPortData(myGpio, GPIO_Port_A, (~(counter) & 0x0F)); DELAY_US(100000); // Acknowledge this interrupt to get more from group 1 PIE_clearInt(myPie, PIE_GroupNumber_1); } //=========================================================================== // No more. //===========================================================================
  5. Like
    PowerX got a reaction from Oppa in Hello world led+button   
    Hello,
    This is my first very simple test with the c2k launchpad, it simply lights up a led (gpio0) a turns it off when the button (gpio12) is pressed.
    Below is my code for it. Hope you like it.
     

    // // c2k launchpad led Hello world 1.0 + button // //includes #include "DSP28x_Project.h" #include "f2802x_common/include/clk.h" #include "f2802x_common/include/gpio.h" #include "f2802x_common/include/pll.h" #include "f2802x_common/include/wdog.h" #ifdef _FLASH memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize); #endif //main void main() { //wdog WDOG_Handle myWDog; myWDog = WDOG_init((void *)WDOG_BASE_ADDR, sizeof(WDOG_Obj)); WDOG_disable(myWDog); //clk&pll CLK_Handle myClk; PLL_Handle myPll; myClk = CLK_init((void *)CLK_BASE_ADDR, sizeof(CLK_Obj)); myPll = PLL_init((void *)PLL_BASE_ADDR, sizeof(PLL_Obj)); CLK_setOscSrc(myClk, CLK_OscSrc_Internal); PLL_setup(myPll, PLL_Multiplier_12, PLL_DivideSelect_ClkIn_by_2); //set gpio GPIO_Handle myGpio; myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj)); //set led gpio0 GPIO_setMode(myGpio, GPIO_Number_0, GPIO_0_Mode_GeneralPurpose); GPIO_setDirection(myGpio, GPIO_Number_0, GPIO_Direction_Output); GPIO_setHigh(myGpio, GPIO_Number_0); //set button gpio12 GPIO_setMode(myGpio, GPIO_Number_12, GPIO_12_Mode_GeneralPurpose); GPIO_setDirection(myGpio, GPIO_Number_12, GPIO_Direction_Input); GPIO_setPullUp(myGpio, GPIO_Number_12, GPIO_PullUp_Disable); //loop for(; { // if gpio12 button is pressed led on-off once if(GPIO_getData(myGpio, GPIO_Number_12) == 1) { GPIO_setLow(myGpio, GPIO_Number_0); DELAY_US(1000000); GPIO_setHigh(myGpio, GPIO_Number_0); } } }
  6. Like
    PowerX got a reaction from james1426471350 in [Closed]Tell us your idea and win a free C2000 Launchpad.   
    I would use it to control stair lightings with led`s on every stair and 3 ir sensors, bottom, top and in the middle, if one of them is activated the led`s will light up in order depending in witch direction you are going and wait untill you reach the seccond sensors then power down in the direction you went, if both sensors are activated in an amount of time the led`s will all light up. Manual control will also be posible and seting up the delay, a future desired project will be comunicating with my ez430 chronos watch, manual overwrite control of the stairs and detection if a person activates one of the sensors.
    Another project that i would like control my shower lights, audio(radio or mp3), and fan control if it gets too hot, by saved presets ( one for me, one for my girlfriend and one for both ) interfaced with the pc.
  7. Like
    PowerX got a reaction from msptest6 in Hello from Romania   
    Yes google showed me the way after searching all around ti.com for resources
  8. Like
    PowerX got a reaction from CorB in Hello world led+button   
    Hello,
    This is my first very simple test with the c2k launchpad, it simply lights up a led (gpio0) a turns it off when the button (gpio12) is pressed.
    Below is my code for it. Hope you like it.
     

    // // c2k launchpad led Hello world 1.0 + button // //includes #include "DSP28x_Project.h" #include "f2802x_common/include/clk.h" #include "f2802x_common/include/gpio.h" #include "f2802x_common/include/pll.h" #include "f2802x_common/include/wdog.h" #ifdef _FLASH memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize); #endif //main void main() { //wdog WDOG_Handle myWDog; myWDog = WDOG_init((void *)WDOG_BASE_ADDR, sizeof(WDOG_Obj)); WDOG_disable(myWDog); //clk&pll CLK_Handle myClk; PLL_Handle myPll; myClk = CLK_init((void *)CLK_BASE_ADDR, sizeof(CLK_Obj)); myPll = PLL_init((void *)PLL_BASE_ADDR, sizeof(PLL_Obj)); CLK_setOscSrc(myClk, CLK_OscSrc_Internal); PLL_setup(myPll, PLL_Multiplier_12, PLL_DivideSelect_ClkIn_by_2); //set gpio GPIO_Handle myGpio; myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj)); //set led gpio0 GPIO_setMode(myGpio, GPIO_Number_0, GPIO_0_Mode_GeneralPurpose); GPIO_setDirection(myGpio, GPIO_Number_0, GPIO_Direction_Output); GPIO_setHigh(myGpio, GPIO_Number_0); //set button gpio12 GPIO_setMode(myGpio, GPIO_Number_12, GPIO_12_Mode_GeneralPurpose); GPIO_setDirection(myGpio, GPIO_Number_12, GPIO_Direction_Input); GPIO_setPullUp(myGpio, GPIO_Number_12, GPIO_PullUp_Disable); //loop for(; { // if gpio12 button is pressed led on-off once if(GPIO_getData(myGpio, GPIO_Number_12) == 1) { GPIO_setLow(myGpio, GPIO_Number_0); DELAY_US(1000000); GPIO_setHigh(myGpio, GPIO_Number_0); } } }
  9. Like
    PowerX got a reaction from msptest6 in Hello world led+button   
    Hello,
    This is my first very simple test with the c2k launchpad, it simply lights up a led (gpio0) a turns it off when the button (gpio12) is pressed.
    Below is my code for it. Hope you like it.
     

    // // c2k launchpad led Hello world 1.0 + button // //includes #include "DSP28x_Project.h" #include "f2802x_common/include/clk.h" #include "f2802x_common/include/gpio.h" #include "f2802x_common/include/pll.h" #include "f2802x_common/include/wdog.h" #ifdef _FLASH memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize); #endif //main void main() { //wdog WDOG_Handle myWDog; myWDog = WDOG_init((void *)WDOG_BASE_ADDR, sizeof(WDOG_Obj)); WDOG_disable(myWDog); //clk&pll CLK_Handle myClk; PLL_Handle myPll; myClk = CLK_init((void *)CLK_BASE_ADDR, sizeof(CLK_Obj)); myPll = PLL_init((void *)PLL_BASE_ADDR, sizeof(PLL_Obj)); CLK_setOscSrc(myClk, CLK_OscSrc_Internal); PLL_setup(myPll, PLL_Multiplier_12, PLL_DivideSelect_ClkIn_by_2); //set gpio GPIO_Handle myGpio; myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj)); //set led gpio0 GPIO_setMode(myGpio, GPIO_Number_0, GPIO_0_Mode_GeneralPurpose); GPIO_setDirection(myGpio, GPIO_Number_0, GPIO_Direction_Output); GPIO_setHigh(myGpio, GPIO_Number_0); //set button gpio12 GPIO_setMode(myGpio, GPIO_Number_12, GPIO_12_Mode_GeneralPurpose); GPIO_setDirection(myGpio, GPIO_Number_12, GPIO_Direction_Input); GPIO_setPullUp(myGpio, GPIO_Number_12, GPIO_PullUp_Disable); //loop for(; { // if gpio12 button is pressed led on-off once if(GPIO_getData(myGpio, GPIO_Number_12) == 1) { GPIO_setLow(myGpio, GPIO_Number_0); DELAY_US(1000000); GPIO_setHigh(myGpio, GPIO_Number_0); } } }
×
×
  • Create New...