Jump to content


  • Content Count

  • Joined

  • Last visited

Reputation Activity

  1. Like
    moonshadow got a reaction from JMLB in delay function   
    I usually use

    #define GCC_BARRIER asm("":::"memory")
    GCC will not reorder reads and writes across GCC_BARRIER, will not retain values in registers across GCC_BARRIER (so globals etc. will be refetched), and will not optimise away loops containing a GCC_BARRIER, so

    int i; for (i = 0; i < 1000; i++) GCC_BARRIER;
    is a nice concise delay loop.
  2. Like
    moonshadow got a reaction from bluehash in Remote volume control   
    Click for larger photo
    The two voltage regulators at the front provide 3.3v and 5v from a 12v wall wart I had lying around. A gearmotor is driven by a TB6612FNG (the red breakout board in the photo; PWMA is tied high, A0IN/A1IN are tied to P1.6/P1.7 on the msp430, vcc/vmotor/gnd/reset are connected as appropriate). The IR receiver demodulates at 38khz (it was surprisingly difficult to find one that operates at 3.3v, 5v seems to be standard); it is connected to P1.5 on the MSP430. The circuit was built on a breadboard initially, with the launchpad attached and reporting infrared samples to the PC via the USB serial port emulation; this enabled me to reverse engineer the protocol of a spare remote control I had lying around, and cause appropriate buttons to rotate the motor one way or the other.
    The final source code (for mspgcc) contains separate modules for decoding the infrared signal and sending debug data over USB; the latter might be of use to someone perhaps I guess. Either of the processors supplied with the Launchpad will work.
    A very simple result for all of you I'm sure, but I'm a software guy - this is the first bit of serious electronics I've done in my life! So quite exciting for me
  • Create New...