Jump to content

GeekDoc

Members
  • Content Count

    1,391
  • Joined

  • Last visited

  • Days Won

    13

Reputation Activity

  1. Like
    GeekDoc reacted to jsolarski in delay function   
    This Delay function is for mspgcc, this is the one suggested by mspgcc to use instead of
    int i = 1237; while(1--); or
    int i; for (i = 0; i <1234; i++);
    mspgcc will usually remove delays like this thinking it is a wast of space.
     
    mspgcc suggest to use an inline function like this example taken from the mspgcc user guide.

    static void __inline__ msp_delay(register unsigned int n) { __asm__ __volatile__( " 1: \n" " dec %[n] \n" " jne 1b \n" : [n] "+r"(n)); }
    call this function when ever you need to do a short delay(or long one lol)
    example

    //"your code" msp_delay(15); //delay //"your code"
     
    you may be able to use this in CCS or IAR but I'm not sure, since I do not have the windows box to run those programs.
  2. Like
    GeekDoc reacted to cde in LCD-I2C For HD44780 LCDs and PCF8574 Expanders   
    Soo, I got busy. Tested the lcd out with my i2c explorer, and then coded up a i2c based lcd controller. It works well enough to initialize and write to an lcd, even commands. At this point, it just runs a test, and that's it. Will be trying to add a RX uart soon (since the biggest code hog was the i2c read routine [i2c.c was about 1k in i2c-explorer] it should fit fine), but it is all setup for 4bit lcd control, and separate functions for lcd commands and lcd data. Two port pins on the expander are still free, and could be used for a larger lcd with 2 enable pins, or reseting the lcd (with a pnp? needs some testing to figure out how to force it to hardware reset) or the same for the led backlight (5v, nearly 300ma from what I read. Could use an extra resistor and/or npn for control.). But you can't do all three from the i2c expander (6 used, 2 free). But the launchpad still has 4 free gpio (5 if you dont need RX)
     
    Did add a small bit of debug tool to it. The expander_write function will turn on led1, go into a while loop, then send the actual data. If the i2c system does not receive an ACK, it will keep looping, trying to send the data again and again, and will keep the led on until a ack is received. So this serves two purposes. If you see the led on for an extended period of time, something is up (It really shouldn't even be fast enough for you to see. i2c is running at a [snail-worthy] 8khz, and 8 bits at a time...), and it allows for some form of error-prevention (Some i2c devices will ignore extra read/write commands when processing internal data, so retrying until it responds is standard procedure).
     
    Allows you to control a HD44780 compatible LCD through a simple I2C Port Expander.
    Tested on DV-16100-S1FBLY LCD (16x1 lcd, 2 Lines of 8 Characters at a time [Weaksauce, sure, but free. Will test a 40x4 lcd after RX works.])
    Used with a TI PCF8574(A for alternative slave addresses) 8bit port expander. No special setup needed for this Port Expander. Others need you to write a port address, and possible setup as outputs.
    Created for a MSP430G2231. ~900 bytes of code, so can fit on smaller ones. Created on IAR Kickstart.
     
    Displays "cde 43oh" on Line 1, " ^___^ " on Line 2.
     

     
    I2C control based on my own work.
     
    Based on work by Michael Bok of http://www.nighsoft.com found at:
    http://forum.sparkfun.com/viewtopic.php?t=13656
    http://hestia.nighsoft.net/files/L1682_MSP430_code.zip
    He wrote up a direct gpio to lcd program for the comparable msp430f2012.
    lcd-i2c.zip
  3. Like
    GeekDoc reacted to RobG in LaunchPad IR Receiver   
    Since I did the IR transmitter, I figured I need a receiver, so here's my first iteration.
    For this project, I am using Vishay's TSOP38238, which takes care of detecting, amplifying, filtering, and demodulating IR signal.
    Output from IR module is connected directly to port P1.1, which is configured as capture input.
    Timer's capture/compare capability is used to process the signal.
    P1.3-P1.5 are connected to LEDs to show the result (LEDs are toggled so sometimes they stay on, it's not a bug.)
    The only problem with this design is that some remotes could have shorter off period, which would screw up the logic (at least that's what I've read somewhere, but then again, you cannot always believe what you read on the net.)




    #include "msp430g2231.h" #define T05 300 #define T65 T05*13 #define T2 T05*4 #define T3 T05*6 unsigned int rxData = 0; // received data: A4-A0 and C6-C0 0000 AAAA ACCC CCCC unsigned int bitCounter = 0; void main(void) { WDTCTL = WDTPW + WDTHOLD; // stop WDT BCSCTL1 = CALBC1_1MHZ; // load calibrated data DCOCTL = CALDCO_1MHZ; P1DIR &= ~BIT1; // P1.1 input P1SEL = BIT1; // P1.1 Timer_A CCI0A P1OUT &= ~(BIT3 + BIT4 + BIT5); // P1.3-1.5 out P1DIR |= (BIT3 + BIT4 + BIT5); TACTL = TASSEL_2 | MC_2; // SMCLK, continuous mode CCTL0 = CM_2 | CCIS_0 | CAP | CCIE; // falling edge capture mode, CCI0A, enable IE __bis_SR_register(LPM0_bits + GIE); // switch to LPM0 with interrupts } #pragma vector=TIMERA0_VECTOR __interrupt void Timer_A (void) { if(CCTL0 & CAP) { // start bit bitCounter++; // start counting bits CCR0 += T65; // add 6.5 bits to counter CCTL0 &= ~ CAP; // compare mode } else { switch (bitCounter) { case 0x1000: // received all bits bitCounter = 0; // reset counter // process received data, for example toggle LEDs switch (rxData & 0x001F) { // mask device number case 19: // Volume - 0010011 = 19 P1OUT ^= BIT3; break; case 18: // Volume + 0010010 = 18 P1OUT ^= BIT4; break; case 21: // Power 0010101 = 21 P1OUT ^= BIT5; break; } rxData = 0; // end process received data CCTL0 |= CAP; // capture mode break; default: // data bit if (CCTL0 & SCCI) { // bit = 1 CCR0 += T2; // add 2 bits to counter } else { // bit = 0 rxData |= bitCounter; // set proper bit of rxData CCR0 += T3; // add 3 bits to counter } bitCounter <<= 1; // increase (shift) bit counter break; } } }
    The first diagram shows how the current code works, the second one shows how it should work to be more reliable (new code to follow.)
  4. Like
    GeekDoc reacted to znanev in Cheap C2000 Piccolo: F2806x MCU - $11   
    Hi all,
     
    Browsing through DangerousPrototypes blog today, I saw Ian posted some info about TI's floating-point Piccolo MCUs. Texas Instruments has development boards with F28069 in memory stick form factor on promotion now ($11 if using the promo code Piccolo11 at checkout).
     
    It seems those Piccolo MCUs have far more capabilities than I'll ever use in my simplistic projects, but there are a lot of clever people in this forum who may find it useful
     
    You can see and order the dev board here:
    https://estore.ti.com/TMDX28069USB-F28069-Piccolo-controlSTICK-P2257C43.aspx?DCMP=F2806x&HQS=Other+EM+f2806x_em1_es
     
    Here is where I got this tip from:
    http://dangerousprototypes.com/2011/01/13/c2000-piccolo-f2806x-mcu/
     
    Cheers,
    zn
  5. Like
    GeekDoc reacted to nobody in Maris on Hackaday   
    New ideas are just lost memories...
     
    Many years ago I found these ontopic websites:
    http://www.shumatech.com/support/chinese_scales.htm
    http://www.nerdkits.com/videos/digital_calipers_dro/
     
    They are full of useful informations.
  6. Like
    GeekDoc reacted to RobG in Wrong calibrated DCO or wrong code?   
  7. Like
    GeekDoc reacted to cde in Talking to the Internet   
    The first is a two parter. The Arduino (or in our case, the Launchpad) is programmed as a simple serial device, parsing input and running whatever the input tells it to. The second part of it is the computer python-serial program, which does the internet parsing, and throws it to the usb-serial connection.
     
    Essentially, both parts are independent, and you can swap either for a comparable part/program. You can that the gmail python script As-Is, no modification needed, and by programing the launchpad with the same general coding, you would get the same exact thing.
     
    The second project is different as it is outputing to the web instead of receiving. It does this with the Arduino Ethernet Shield (Wiznet part) that handles most of the tcp-ip stuff, so essentially it could be done with launchpad valueline parts. All it does is when it senses a button press, it requests a website that is being run on your computer, which does the rest. Very simple.
     
    As far as current projects go, Joby's SPI-Explorer (And my derivate I2C-Explorer, natch) has a good serial parsing code in it, which you can easily modify to switch on an led when it receives a certain character.
  8. Like
    GeekDoc reacted to frozencarbonite in Basic Examples   
    Hi again,
     
    Thought I would share some links I found very helpful as a beginner
     
    I went through this C++ tutorial a while back and it has greatly helped me understand how to code basic programs for a variety of platforms like the arduino, Microsoft Visual C++ and now the MSP430 Launchpad. I think if you are a total newcomer you should start by completing this tutorial:
    http://cplusplus.com/doc/tutorial/
     
    Particularly I keep going to this page as a good reference of what is going on when looking at examples for sometimes the simplest things are not explained:
    http://cplusplus.com/doc/tutorial/operators/
     
    Here is a great explanation of how I/O works on the Launchpad and what got my head out of arduino land:
    http://andrewroycarter.com/?s=msp430
     
    Follow that up with this and memorizing the important bitwise operators:
    http://en.wikipedia.org/wiki/Bitwise_operator
     
    Cde's link seems very promising for newcomers but needs fleshed out especially the analog section:
    http://processors.wiki.ti.com/index.php ... _Community
     
    and then the more advanced projects and blogs
     
    Oh and of course 43oh forum :!: The community here seems very knowledgeable and helpful find what info you need rather than pouring over the fragmented bits of info strewn across the web.
     
    Thanks again
  9. Like
    GeekDoc got a reaction from markey1979 in Share pics of your workspace setup   
    Man, I need an o-scope!
    *jealous*
  10. Like
    GeekDoc reacted to cde in Free eZ430-F2013, just pay shipping   
    EZFREE2013 works for multiple quantities too. You are limited 3 per order, but the code will take off all 3. So 3 ez430s for free with free shipping. Awesome!
     
    But you can only use the code once per account.
  11. Like
    GeekDoc reacted to timotet in I am a Noob and I need help.   
    Don't give up! Everybody had to start somewhere.
    This forum is an awesome place to begin.
  12. Like
    GeekDoc reacted to RobG in IR remote control help   
    Here's working example using the code above, TV Volume Down command is sent over and over:


  13. Like
    GeekDoc reacted to bluehash in [ REMINDER ] Please Thank Members that help you out.   
    Hello everyone,
     
    There has been alot of good questions going on in the past few weeks - accompanied with very good discussions. One way you can show your appreciation is by using the "Thanks" or "Thumbs up " button on the top right. It may be hard to notice but a screenshot always helps:

     
    Use it if you have received something useful from a member. It takes time to write those posts and code. Consider it as karma, that's as good as it can get. :mrgreen:
     
    Thanks everyone..and wish you a happy new year.
  14. Like
    GeekDoc got a reaction from NJC in I am a Noob and I need help.   
    I second the recommendation to read NJC's blog. He's VERY good at explaining the concepts and what each part of the code does.
     
    I also suggest having a look around the internet for C++ tutorials. There are several good ones that start you from the beginning.
     
    Welcome, and best of luck!
  15. Like
    GeekDoc reacted to hvontres in MSP430G2xx2 Parts are coming :)   
    After you login to your account, hit the "Get Free Samples" button in this box:

  16. Like
    GeekDoc reacted to simpleavr in MSP430 and Nokia 6100 LCD   
    it's this one, kind of like a test board for "a lot" of different phone types.
     
    http://rossum.posterous.com/screen-play ... or-microco
     
    i really don't want to do smd / pcb, will find another old phone to and try my soldering skills again. if i ask, i always get phones to play w/. people are switching phones every 6 months now.
     
    i am sure i can wire a nokia 1208 (w/ 0.5mm 10 pin connector, 128x96, 4096 color), but that also seems to be "too old" and hard to get by.
  17. Like
    GeekDoc reacted to simpleavr in ezprobe, ez430 based logic probe   
    here is my entry to the december project of the month. comments welcomed.
     

     
    description
     
    this is a simple logic probe project based on TI Launchpad. i took advantage of a free offer on a couple of ez430s from TI in september 2010. they are very handy and fun in trying out small code snippets and watch the led blink. they had since been laying around my desk and i have to come up with something for them. and i want to stop people coming up and ask to borrow my "memory stick".
     
    well, this is no memory stick, 16bit MCU w/ multi-channel ADCs, adaquate 2K programming memory and runs up to 16Mhz. all packed up with the debugging programming interface board in a nice usb device package.
     
    my main design goal is to limit my intervention to the original ez430. in that i don't want do alter it too much physically and i want to retain it's programming / debugging function for other target board projects. all this while serve additional useful purposes.
     
    this is a linux project, as usual, i had given attention with my best knowledge to make provisions so that it can be built under windows. however i do not have the time and resources to try out everything under windows.
     
    most of my electronics projects are done on very small breadboards and i usually work on tight spaces (kitchen table, half a borrowed desk, etc). there are many instances that i need to check circuit logic levels and i've been using a multimeter (size of a brick) to check things out. it always annoys me as my projects are much smaller than my multimeter and i found it always gets in my way. i need an alternative, a small logic probe will do.
     
    the ez430 is perfect for this task. to begin with, it's already shaped like a probe, i just need to add a nail and some leds. as i mentioned earlier, i want to make this project simple and non-destructive. and i made use of what's available already.
     
    instead of building the project on a pcb / pref-board, i build this on a target msp430f2012 board, employing the 14 pin header thru holes as my prototyping area. this is where the tiny leds goes. i do not want to drill holes on the plastic casing, i don't want to run too many wire nor add additional contact points. all i need is a probe io contact and a button input for function select, plus gnd and vcc. the usb connection looks perfect for this task. i will power the probe via the usb (the programmer circuit will regulate a around 3v potential for me) and use the D+ and D- usb connects for my probe and switch.
     
    since the ez430 is slave / client device, upon initialization, it won't do a thing except a pull-up on D+ (to indicate it's a "hi-speed" usb). i use the floating D- as my probe io and D+ as my tactile button input (i don't even need to setup a pull-up resistor for that, it's already there)
     
    features and application
     
    * supply from circuit via usb connector
    * 3 operating modes rotating between logic read, pulse output, pwm output
    * long button press (about 1.5 sec) rotates through the 3 operating modes
    * p1.0 original green led as mode indicator, off - probe, on - output, blink - pwm
     
    logic probe
     
    * logic probe red - hi, green - low, none - floating
    * logic probe red / green blinks on continous pulse reads > 100hz
    * 4 yellow leds shows detected frequencies in 8 steps, blinking yellows indicate hi-range (i.e. step 5-8)
    * shows detected pulse frequences for 100hz+, 500hz+, 1khz+, 5khz+, 10khz+, 50khz+, 100khz+, 500khz+
    * for non-continous single pulse bursts, the red / green leds stays on and subsequent pulse counts are displayed incrementally on the leds, will count up to 8 pulse
     
    continuous pulse output, frequency setting
     
    * indicated by p1.0 original green led on
    * 4 yellow leds shows output pulse frequencies in 9 steps, blinking yellows indicate hi-range (i.e. step 5-8)
    * pulse frequences output for 100hz, 500hz, 1khz, 5khz, 10khz, 50khz, 100khz, 500khz, 1mhz
    * short button press rotates the 9 different frequency settings.
    continuous pulse output, pwm setting
     
    * indicated by p1.0 original green led blinking
    * same as previous operation mode, except pwm values are show (and be setup) instead of frequency
    * 4 yellow leds shows output pwm percentages in 9 steps, blinking yellows indicate hi-range (i.e. step 5-8)
    * pwm percentages for 0%, 12.5%, 25%, 37.5%, 50%, 62.5%, 75%, 87.5%, 100%
    * short button press rotates the 9 different pwm settings.
     
    schematic

     
    source file
    ezprobe.zip
     


     
    project page, construction details, schematics, etc.
    http://www.simpleavr.com/msp430-projects/ezprobe
     
    [EDIT] source code and schematic added, update more correct schematic
  18. Like
    GeekDoc reacted to RobG in LaunchPad, 74HC165, Switches   
    *******************
    Also checkout this post
    *******************
     
    In this example, I am demonstrating how to connect switches using parallel-serial shift register 74HC165.
    You can daisy chain as many 165s as you want.
    In my example I have 2 of them, which allowes me to connect up to 16 switches.
    In the video, I am using small 6 position DIP switch and all unused inputs are grounded and do not have pull-up resistors.
    Also, the state of switches is displayed on a 7 segment display (see my other post for how to connect 7 segment display.)
    De-bouncing is accomplished by comparing previous state with current (switchReady.)
     


     

    #include unsigned int data = 0; // data to be displayed unsigned int digitCounter = 0; // Digit counter unsigned char digit = 0; // Single digit to be displayed unsigned char hex7digit[16] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x77,0x7C,0x58,0x5E,0x79,0x71}; // Hex to 7 digit map unsigned char digitSelector[4] = {0x01, 0x02, 0x04, 0x08}; // Digit selector map unsigned int switchReady = 0x0; // When BITn is 0, means switch is unstable H->L or L->H unsigned int switchStatus = 0x0; // Pressed or released void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT P1OUT |= 0x01; // Port P1.0 will be used to latch both, 74HC165 and 74HC595 P1DIR |= 0x01; USICTL0 |= USIPE7 + USIPE6 + USIPE5 + USIMST + USIOE; // In, out & clk enable, SPI Master USICTL1 |= USICKPH + USIIE; // Counter interrupt, flag remains set USICKCTL = USIDIV_4 + USISSEL_2; // /16 SMCLK USICTL0 &= ~USISWRST; // USI released for operation USICNT = USI16B; // Enable 16 bit CCTL0 = CCIE; // CCR0 interrupt enabled CCR0 = 625; // Approx. 5ms TACTL = TASSEL_2 + MC_1 + ID_3; // SMCLK/8, upmode _bis_SR_register(LPM0_bits + GIE); // Enter LPM0 w/ interrupt WDTCTL = WDTPW + WDTHOLD; // Stop WDT } // Timer A0 interrupt service routine #pragma vector = TIMERA0_VECTOR __interrupt void Timer_A (void) { //P1OUT &= ~0x01; // You could latch input right now //P1OUT |= 0x01; if(digitCounter == 0) { // Update switch status every 20 ms switchReady = ~(USISR ^ switchStatus); // Copy USI's register to switchReady and switchStatus switchStatus = USISR; if((switchReady & 0x3F) == 0x3F) { // When all 6 switches are ready... data = switchStatus; // move input to data } } digitCounter++; // Increase digit counter digitCounter &= 0x03; // Mask, counter range is 0-3 digit = data>>(4 * digitCounter); // Shift digits right digit &= 0x0F; // Mask, we need first digit only USISRL = hex7digit[digit]; // Get segments from the map USISRH = digitSelector[digitCounter]; // USICNT |= 16; // Start USI } // USI interrupt service routine #pragma vector = USI_VECTOR __interrupt void USI_TXRX (void) { USICTL1 &= ~USIIFG; // Clear pending flag P1OUT &= ~0x01; // Latch data display (& input for next timer interrupt) P1OUT |= 0x01; }
     
    Schematic:

  19. Like
    GeekDoc got a reaction from bluehash in Another Design Contest!   
    Well, I entered and forgot about this project, and guess what came via FedEx today!
     

     
    Their site says they are out of the 1000 free boards, so I must have been one of the last to get one. This board is pure geek pr0n! It has everything! I wonder if I'll ever learn to use it properly, let alone finish my entry in the contest!
     
    For a "little" help, Renesas also included a very nice book:
     

     
    Look at the size of that book! (LaunchPad included for scale). If it takes this much to understand this platform, I don't think I have much of a chance at a prize. No matter, I feel like I've already won and received a $110 dev board and an expensive book as prizes!
  20. Like
    GeekDoc got a reaction from rivalslayer in Launchpad+Accelerometer+Processing=Snake game!!!   
    I just did that very thing for some rumble motors.
     
    Total from one controller: 2 rumble motors (1 with smaller weight, 1 larger), 2 analog joysticks with push switch, 2 small PCBs with traces for silicone type buttons (and the contacts for them), a few through-hole capacitors, a bunch of surface-mount devices (including some that look like inductors), cable with USB-A end.
     
    I love when I can scrounge usable parts!
  21. Like
    GeekDoc got a reaction from rivalslayer in Need a favicon?   
    Do you want/need a favicon.ico for the site? I was making one for my blog, and thought I'd whip one up for you using your theme colors. Use it or trash it; you won't hurt my feelings. It took all of a couple of minutes.
     
    16x16px, looks like this:

     
    43oh-favicon.ico.zip
     
    -Doc
  22. Like
    GeekDoc got a reaction from YanuarPrijadi in Eagle parts for MSP430G22xx   
    Here's an EagleCAD library for the 14-pin DIP value-line chips (probably good for any 14-pin DIP MSP430). I just corrected/modified the one bluehash posted from Enrico (his package design was too narrow [so to speak]).
     
    There is only the one part, with two package variants: oval pads and round pads. Hope this helps someone.
     
    (Seems odd to zip a 6KB file, but system won't tale a ".lbr" file. :? )
     
    MSP430G22xxEagleLibrary.zip
  23. Like
    GeekDoc got a reaction from juani_c in Eagle parts for MSP430G22xx   
    ---=== EDIT: PLEASE IGNORE THIS POST - I MEASURED INCORRECTLY! ===---
     
    I'm not experienced enough with the other packages to tell if the footprint is correct but, for some reason, TI has all the DIP packages at a 0.3" width between rows of pins. DIP packages should be 0.4" between rows.
     
    Just editing (widening) the N14 package should fix the whole thing.
     
    EDIT: Just looked at the LaunchPad board's Eagle file (from TI), and they have the socket at 0.3" too! Good thing they didn't manufacture from the Eagle files!
     
    Or, maybe they did. Then they had to dump an entire run of boards, resulting in a huge shortage of LaunchPads at *ahem* launch! That explains it! theory>
  24. Like
    GeekDoc reacted to juani_c in Eagle parts for MSP430G22xx   
    Here it is, if anyone found problems with the symbols please tell me in order to correct them
    TI_MSP430G_v1.rar
  25. Like
    GeekDoc got a reaction from rivalslayer in Eagle parts for MSP430G22xx   
    Here's an EagleCAD library for the 14-pin DIP value-line chips (probably good for any 14-pin DIP MSP430). I just corrected/modified the one bluehash posted from Enrico (his package design was too narrow [so to speak]).
     
    There is only the one part, with two package variants: oval pads and round pads. Hope this helps someone.
     
    (Seems odd to zip a 6KB file, but system won't tale a ".lbr" file. :? )
     
    MSP430G22xxEagleLibrary.zip
×
×
  • Create New...