Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Reputation Activity

  1. Like
    Apaseo got a reaction from vtails in ADC and Voltage measurement   
    It would be awesome if you could elaborate with the temp. sensor.
    That is actually what I am trying to do, I got a sample of an LM335, and I was hoping to get it working.
  2. Like
    Apaseo got a reaction from Serginho in ADC and Voltage measurement   
    That makes sense, I did not considered that the msp430 runs on 3.6v. 
    And I had my multimeter hooked up wrong, so yes when the voltage reaches 3.6 the value on the LCD is 0x03FF.
    One more thing, I am printing hex values to my LCD, and I have been trying to figure out how to display the decimal equivalent.
    For example, If I get 0x0939 I would like to be able to display 2361. Better yet, it would be awesome to be able to display 2.36 .
    I know that there is a way, but it has been a while since I worked with LCD's.
  3. Like
    Apaseo reacted to enl in ADC and Voltage measurement   
    displaying decimal is straightforward, and there are several ways that are quick. The most appropriate depends on the available hardware.
    Presuming that you want something lighter than the standard C output tools (printf and the like declared in the stdio.h header)
    Three most common are recursive/stack based decomposition, decompose into an array, or use a table of powers.
    The first two require resources that are expensive on a low end MSP430 (need division, modulo, and extra RAM, and build the base ten value from the least significant end. On a higher power processor, they have the advantage of simplicity), so a table of powers it is...
    Fisrt, you know the greatest power of ten you need, so the table is easy:
    unsigned int powers[]={1,10,100,1000};
    Now, we use repeated subtarcation to find the digits. THey come out in high to low sig order, so we can print them as they come. Simplest method prints leading zeroes....
    (this is not the most elegant code, but it is, hopefully, clear)
    // n contains the value to print. it is destructed in the print process
    int i=3;  // most dig digit value
    char j;
    while (i>=0) { // count off digit weights
       while (n>=powers) {j++; n-=powers;} // count how many times weight can be subrtacted from value
       OUTPUT_CHAR(j); // whatever function you use to send digit char to output device
    Simple. functional. minimal code size. A little work with a flag to eliminate the leading zeroes.
    Putting the point in requires only an additional test in the outer loop, as it always goes the same place.
    The hardest part is converting from the int [0..1023] to the appropriate scaled value, if you are trying to produce the actual voltage measure. Depending on the scale you want, this can be easy or difficult. I try to avoid the need for this scaling if I can, but when I can't, my next choice is fix the scale to the most convenient I can, such as max reading is 10.23V using a voltage divider so I need only put the decimal point in the right place.

    Next choice of scale is one where power-of-two division arithmetic does the job, such as max at 5.115V.

    If I must use arbitrary scale, it gets interesting. I'll spend a bit of time trying to special case the job before going to mult and division, or, worse, floating point. That is beyond the scope of where I wnt to go now, but I can elaborate with an example from the DS18B20 temp sensor if you need. (produces degC. Conversion to degF is amazingly simple, but unobvious)
  4. Like
    Apaseo reacted to Serginho in ADC and Voltage measurement   
    AFAIK, MSP max input value for the ADC is Vcc, so I am surprised to see a table with a 5V reading value. You would normally need a resistor divider or something similar to "measure" DC values higher than Vcc.
    Another point is that I have normally seen that ADC gives HEX values near 3FF when input voltage is Vcc, but your table seems to be reverse order.
    So I would suggest to share  your basic circuit schema and ADC mapping.
    Best regards
  5. Like
    Apaseo reacted to chicken in 1ms Delay function or Similar help   
    _delay_cycles(), at least when working with CCS, might do the job.
    As it counts cycles, it's dependent on the CPU clock. For milliseconds, it would look something like this:
    _delay_cycles(MCU_clock_in_Hz / 1000 * wait_time_in_ms);
  6. Like
    Apaseo reacted to spirilis in Debugger step through code.   
    Not sure about IDEs but the mspgcc+mspdebug stack includes msp430-gdb; you run a gdbserver from inside mspdebug and start msp430-gdb, have it connect to that gdbserver.  Then it can integrate into IDEs that support GDB.  Might search around to see if anyone's got this working reliably with any IDEs... (I personally use mspdebug and step through code that way, rarely need to though so it's not a huge problem for me.)
  7. Like
    Apaseo reacted to simpleavr in mspgcc setup to compile using command line on Windows   
    I don't remember the details, I always have c/c++ development installed w/ cygwin.
    You definitely need libusb, or libusb development.
    I just rebuild it and check the -l (libraries) that is needed, you should search for related packages that provides them. I.e. libusb, libreadline?, libws2_32? don't know what it was.
    I would usually look at compile / link errors and go from there. If you are stucked, show us the compile error here.
    gcc -s  -o mspdebug.exe util/btree.o util/expr.o util/list.o util/sockets.o util/sport.o util/usbutil.o util/util.o util/vector.o util/output.o util/output_util.o util/opdb.o util/prog.o util/stab.o util/dis.o util/gdb_proto.o util/dynload.o drivers/device.o drivers/bsl.o drivers/fet.o drivers/fet_error.o drivers/fet_db.o drivers/flash_bsl.o drivers/gdbc.o drivers/olimex.o drivers/rf2500.o drivers/sim.o drivers/uif.o drivers/ti3410.o drivers/tilib.o drivers/olimex_iso.o formats/binfile.o formats/coff.o formats/elf32.o formats/ihex.o formats/symmap.o formats/srec.o formats/titext.o simio/simio.o simio/simio_tracer.o simio/simio_timer.o simio/simio_wdt.o simio/simio_hwmult.o simio/simio_gpio.o ui/gdb.o ui/rtools.o ui/sym.o ui/devcmd.o ui/reader.o ui/cmddb.o ui/stdcmd.o ui/aliasdb.o ui/main.o -lusb -lreadline -lws2_32
  8. Like
    Apaseo reacted to simpleavr in mspgcc setup to compile using command line on Windows   
    You need to specify the target device via -mmcu, also you should add the -o to specify the output file name, or else you would get a.out (as in all gcc one liners)
    The memory model is different for each device and the linker need those information.
    msp430-gcc -mmcu=msp430g2553 hello.c -o hello.elf You can then use mspdebug or msp430flasher (from TI) to flash the firmware into your launchpad.  
  9. Like
    Apaseo reacted to simpleavr in mspgcc setup to compile using command line on Windows   
    How did you use it? Via a makefile? So it failed and you try just type "C:>msp430-gcc"? You do need parameters though.
    I would say if you are serious w/ doing command line, install cygwin and you will have all utilities available (make, binutils, etc). And the install just take 10 minutes.
    I think I am using the same mspgcc built, plus I had cygwin installed, plus I built mspdebug from source under cygwin.
    chrisc@5A:~ > which make /usr/bin/make chrisc@5A:~ > which msp430-gcc /cygdrive/c/mspgcc-20120406-p20120502/bin/msp430-gcc chrisc@5A:~ > which mspdebug /usr/local/bin/mspdebug chrisc@5A:~ >
  10. Like
    Apaseo reacted to JWoodrell in TLC5940 and RGB led cube guidance   
    charlieplexing leads to incredibly dim LED light when many are lit at once, it is more usefull when you have a lot of LEDs and only light 1 or 2 at a time.  because your maximum on time for any LED is 1/n  since you are dividing you tome between them.  2 LEDs can only have 50% max brightnes,  10 LEDs can only have 10% max brightness.  unless you build some external latching circuit, but that adds a lot of complexity
  11. Like
    Apaseo reacted to oPossum in Sending 32 bits to cascaded 8 bit registers   
    unsigned long  First = 0xffffff40UL;
    #include <stdint.h>
    uint32_t First = 0xffffff40UL;
  12. Like
    Apaseo reacted to oPossum in Sending 32 bits to cascaded 8 bit registers   
    and also...
    void shiftOut(unsigned long val) -or- void shiftOut(uint32_t val) { unsigned i = 32; // Iterate over each bit, set data pin, and pulse the clock to send it // to the shift register do { pinWrite(DATA, val & 1); val >>= 1; pulseClock(); } while(--i); }
  13. Like
    Apaseo got a reaction from veryalive in Code for 14hc164 shift register   
    For developing my code I am using the latest version of code composer studio.
    I tried energia, but its too simple and doesn't have the debugging tools that code composer has. I also use CCS, because energia (arduino stuff), is not allowed at my school.
  • Create New...