terjeio

Members
  • Content count

    107
  • Joined

  • Last visited

  • Days Won

    17

terjeio last won the day on January 2

terjeio had the most liked content!

About terjeio

  • Rank
    Level 1

Profile Information

  • Location
    Norway
  • Interests
    Electronic design, motion control, programming
  1. I have not switched to CCS 7 yet, in CCS 6 you can find examples via View > Getting Started > Browse Examples - same in CCS 7? Since many MSP430 processors have limited resources I prefer to implement the interfaces myself, reusing snippets of code from earlier projects.
  2. Does port 6 support interrupts? - check the documentation for your processor. I know this is not always so for the processors I have used.
  3. What is the requirement which is not met? Bouncing issues? Button matrix scanning? You need to use NMI?
  4. "On the edge" - I finally got around to port the latest GRBL version (1.1f) to ARM, in the process HALifying and making a library out of it. I then integrated it into my Tiva C based CO2-laser controller card codebase - next step is to hook it up to the laser proper to verify everything is working outside the test setup. I have to spend some time to learn git - currently I use Subversion for source control, running on my local server. I will not swich to git, Subversion works great for me, but for making code available to the community git is the way forward? Implementing a HAL-driver should be relatively straightforward, the core GRBL code in my port is nearly 100% hardware agnostic and all hardware related code can reside in one file (the HAL - Hardware Abstraction Layer). A preliminary version of my port can be found in the tread "Portability Experiments (ARM M4)" over at https://github.com/gnea/grbl/issues Test rig, from the edge... Terje
  5. A Google search - and I found this: https://github.com/fmilburn3/RTClib I find solutions for most of the questions I have by searching - if that fails then the manuals are great. This processor even has driverlib support it seems.
  6. Maybe wrong processor selected? Will it work if you remove #include <driverlib/rom.h>?, I believe that will force the linker to link the complete library functions into your program - IIRC when using the ROM version only a dispatch table and some stubs are added. If this does not help you may copy the GPIOIntRegister implementation into your code...
  7. You have to register your interrupt handler with GPIOIntRegister.
  8. @@NurseBob Sure have to do that, from table 8.2 in the user guide: "Port Select P2SEL 02Eh Read/write 0C0h with PUC" 0Ch means pins 6 and 7 are configured for primary peripheral module function on power up, not i/o.
  9. Printing a holder for a aiming laser for my CO2 laser on my new homemade 3D printer. The printer controller contains a Raspberry Pi running OctoPrint, an Arduino with a Ramps shield and an "intelligent power switch" based on a MSP430G2553 circuit of my design for booting/shutting down the Pi. I am using FreeCad & Slic3r for the 3D workflow - a lot of new stuff to learn...
  10. Ok, here we go - @@Fmilburn it is not my code, I have just "translated" it from assembly to C - I have to admit I did not understand much when I started coding for MCUs... In my application the processor is running at 1MHz, timing parametes (BIT_50 and BIT_75) must be adjusted different. The header file: // // Philips RC-5 IR protocol decoder library for MSP340G2553 // #include <msp430.h> #include <stdint.h> #include <stdbool.h> // The following bit timings are for a 1MHz clock #define BIT_50 890 // 890 #define BIT_75 1348 // 1348 #define IRDATA BIT2 // IR receiver input (P1) void initRC (void); void startRC (void); uint8_t getAddress (void); uint8_t getCommand (void); bool getToggle (void); Functions: // // Philips RC-5 IR protocol decoder library for MSP340G2553 // // Adapted from assembly code published in Texas Instruments Application Report SLAA134 // http://www.ti.com/litv/pdf/slaa134 // // by Terje Io // #include "rc5recv.h" static volatile uint8_t count; static volatile uint16_t data; // returns device address (5 bits) uint8_t getAddress (void) { return count == 0 ? (data >> 6) & 0x1F : 0; } // returns device command (6 bits) uint8_t getCommand (void) { return data & 0x3F; } // returns toggle status - changes when a new remote key is pressed or a key is pressed, released and pressed again bool getToggle (void) { return (data & 0x800) != 0; } // Init input pin and Timer 0 void initRC (void) { P1DIR &= ~IRDATA; P1SEL |= IRDATA; TA0CTL = TASSEL_2|MC1|TACLR|TAIE; } // Start receiving data - call must be followed by LPM0 in main code (to wait for command) void startRC (void) { data = 0; count = 14; TA0CCTL1 = CM1|SCS|CAP|CCIE; } #pragma vector = TIMER0_A1_VECTOR; void __interrupt TimerA0 (void) { switch(__even_in_range(TAIV, 14)) { case 0: break; // No interrupt case 2: // CCR1 not used #ifdef DEBUG P1OUT ^= DEBUG_PIN; #endif if(TA0CCTL1 & CAP) { TA0CCTL2 = 0; TA0CCTL1 = CCIE; TA0CCR1 += BIT_75; } else if(--count == 0) { TA0CCTL1 = 0; if(data & 0x1000) { // second startbit ok? data &= 0xFFF; LPM0_EXIT; } else startRC(); } else { data = data << 1; data |= (TA0CCTL1 & SCCI) >> 10; TA0CCTL1 = CM1|CM0|SCS|CAP|CCIE; TA0CCR2 = TA0CCR1 + BIT_50; TA0CCTL2 = CCIE; } #ifdef DEBUG P1OUT ^= DEBUG_PIN; #endif break; case 4: // Handle overruns by resetting TA0CCTL2 = 0; startRC(); break; default: break; } } Snippet from my application showing usage: startRC(); // set up IR receiver for next message while(1) { LPM0; toggled = toggle != getToggle(); toggle = getToggle(); if((address = getAddress()) == 16) { switch(getCommand()) { case 0: selectBtn(PHONO); if(isMuted()) // If muted then selectBtn(MUTE); // demute break; ... case 12: if(toggled) selectBtn(STDBY); break; case 13: if(toggled) selectBtn(MUTE); break; ... } } if(address != 0) // if IR receiver command processed startRC(); // set it up for next message } } I have code (and schematics) for a RC5 transmitter based on MSP430G2312 as well, again based on someone elses work but cannot remember where I found it. I run it off a CR2025 cell so it has limited range (4-5m), still battery life is 1 year+ with my (daily) use.
  11. SLAA134 may also be of interest: http://www.ti.com/litv/pdf/slaa134 I have recoded the RC5 receiver algoritm in C (for CCS) - I like it because it does not use much RAM. I can post the code but I need to make it postable first - it is part of one of my very first MCU projects. Terje
  12. I agree with greeg too, I did not even try to mill PCBs even if I own a CNC mill - dismissed out of hand due to poor resolution, cumbersome setup and involved workflow. However, for single sided designs I am very happy with my laser exposer now that I have mastered the process. This PCB took 1h30min to make from plotting (from KiCad) to developed soldermask. It then needs one hour in the reflow oven for "hardening" the soldermask before drilling and milling the edges (I am using Mach3 for my mill). The soldermask is not perfect - most likely due to it beeing way past it "best before" date. BTW the footprint in the middle is for a 2553. "Inexpensive"? - for me, yes - as I make quite a few one-offs and small runs (typically < 5).
  13. I'm going to use the latest I aquired in my new build, a 3D printer. Will be running Octoprint. Others are running OSMC, a multimedia player, and RiscOS.
  14. The standard Windows calculator in Programmer mode (Alt+3) is quite handy too...
  15. @@SimpleThings : Glad to hear you got it working. The code above is for the Philips RC5 protocol and it runs on a G2553 @ 1MHZ , Samsung uses a modified NEC protocol (at least my TV does). The code I modified is for Tiva C, I added decoding and converted some commands (volume and muting) to the RC5 equivalent so I can use both my own and the Samsung remote to control the multimedia center. If of interest I can post the Tiva code as well.