Jump to content
43oh

oPossum

Members
  • Content Count

    925
  • Joined

  • Last visited

  • Days Won

    103

Posts posted by oPossum

  1. For powering the the board I wanted to use the existing 12volt supply for the printer, so I put a couple of LDO's on

    board for that. I of course used TI parts that I sampled from TI. (as a matter of fact I sampled the msp430 too thanks TI!!!)

    For the 3.6 volt side I used the TPS70936 and for the 5 volt side I used the LP2989. Both of the LDO's are able according to

    the data sheets to handle a 12 volt input.The 3.6 volt side worked out as expected but I must have done something

    wrong with the LP2989. The data sheet says the part will provide up to 500mA continuously, the WS2812 at full brightness

    pulls 60mA. I put 4 leds on the board so thats 240mA if they are all full blast. When I have all the leds on full the LDO gets

    HOT! As far as the layout goes I copied the shematic from the data sheet, and used the recommended parts.

    12V - 5V = 7V

     

    7V * 0.5A = 3.5W

     

    So you need a heatsink that will get rid of that 3.5 watts with acceptable temperature rise. It's in a SOIC package, so that's not really possible.

     

    So... use a TO-220 package regulator with a heatsink or a switching regulator.

  2. BTW I would also mentioned that I am direct driving / multiplexing the led at 1/8 rate, so it won't work well outdoors (or beside a window). But works fine indoors. It's not designed for heavy use.

    Maybe you could design the PCB to allow for an LED bubble display or a 1x8 LCD display. The LCD would be less authentic, but allow for better battery life and better readability under bright light.

     

    http://www.mouser.com/ds/2/291/NHD-0108FZ-RN-YBW-33152.pdf

  3. DS1000Z series has intensity grading ('digital phosphor'), faster screen updates, ethernet, serial decode options, optional function generator. It is comparable to the Agilent 2000 series in many ways. It has the look and feel of an analog 'scope - something very difficult to do with digital.

     

    The E series was great 5 years ago, but today it's like a toy compared to the Z series.

     

  4. May I suggest using uint8_t instead of int?

    When the max value is less than 2^8 (256): uint_fast8_t

    When the max value is less than 2^16 (65536): uint_fast16_t

    When the max value is less than 2^32 (4,294,967,296): uint_fast32_t

    When the max value is less than 2^64 (aprox 1.8E19): uint_fast64_t

     

    These fast variants will be promoted to the best suitable integer type. That will typically be an integer multiple of the register width. So on the MSP430, uint_fast8_t becomes unsigned [16 bit]. On x86 it would be 16, 32 or 64 bits depending on target operating mode. This doesn't matter much on the MSP430, but it does on some others such as 16 bit PIC.

  5. 
    

    #include <msp430.h>

    #include <stdint.h>

     

    static const unsigned long smclk_freq = 16000000UL; // SMCLK frequency in hertz

    static const unsigned long bps = 9600UL; // Async serial bit rate

     

    static uint32_t upd = 0; // Ultrasonic Pulse Duration (500 ns resolution)

    //

    #pragma vector = TIMER1_A1_VECTOR // Timer 1A vectored interrupt

    __interrupt void timer1_a1_isr(void) //

    { //

    static uint32_t rise = 0; // Pulse rise time

    static uint32_t fall; // Pulse fall time

    //

    switch(TA1IV) { // TA0IV must be read to reset interrupt

    case 0x02: // 0x02 == CCR1 (capture/compare)

    if(TA1CCTL1 & CCI) { // - Rising edge

    rise = TA1CCR1; // Save rise time

    fall = 0; // Reset fall time

    } else { // - Falling edge

    if(rise) { // Make sure rising edge has occurred

    // Handle possible pending overflow interrupt

    if((TA1CTL & TAIFG) && (TA1CCR0 < 0x1000))

    fall += TA1CCR0; //

    fall += TA1CCR1; // Get fall time, add to overflow time

    if(!upd) upd = fall - rise; // Update time if mainline code is ready for it

    rise = 0; // Clear rise time to ensure next rising edge is used

    } //

    } //

    break; //

    case 0x0A: // 0x0A == TAIFG (overflow)

    fall += TA1CCR0; // Update overflow time

    break; //

    } //

    } //

     

    void putc(const unsigned c) // Output single char to serial

    { //

    while(!(IFG2 & UCA0TXIFG)); // Wait for ready (not busy)

    IFG2 &= ~UCA0TXIFG; // Reset busy flag

    UCA0TXBUF = c; // Tx char

    } //

    //

    void puts(const char *s) { while(*s) putc(*s++); } // Output string to serial

    //

    void print_u32(uint32_t n, const unsigned dp) // Print 32 bit unsigned with optional decimal place

    // 6 decimal digits (0 -> 999999)

    { //

    unsigned c; //

    c = '0'; while(n >= 100000UL) n -= 100000UL, ++c; putc(c);

    if(dp == 5) putc('.'); //

    c = '0'; while(n >= 10000) n -= 10000, ++c; putc(c);

    if(dp == 4) putc('.'); //

    c = '0'; while(n >= 1000) n -= 1000, ++c; putc(c);

    if(dp == 3) putc('.'); //

    c = '0'; while(n >= 100) n -= 100, ++c; putc(c);

    if(dp == 2) putc('.'); //

    c = '0'; while(n >= 10) n -= 10, ++c; putc(c); //

    if(dp == 1) putc('.'); //

    c = '0'; while(n) --n, ++c; putc(c); //

    } //

     

    void main(void) //

    { //

    WDTCTL = WDTPW | WDTHOLD; // Disable watchdog reset

    DCOCTL = 0; // Run at 16 MHz

    BCSCTL1 = CALBC1_16MHZ; //

    DCOCTL = CALDCO_16MHZ; //

    //

    P1DIR = BIT2; // Setup GPIO

    P1SEL = BIT1 | BIT2; // UART

    P1SEL2 = BIT1 | BIT2; //

    //

    P2OUT = 0; //

    P2DIR = BIT0; // Timer 1 capture/compare IO

    P2SEL = BIT0 | BIT1; //

    P2SEL2 = 0; //

    //

    const unsigned long brd = (smclk_freq + (bps >> 1)) / bps; // Bit rate divisor

    UCA0CTL1 = UCSWRST; // Hold USCI in reset to allow configuration

    UCA0CTL0 = 0; // No parity, LSB first, 8 bits, one stop bit, UART (async)

    UCA0BR1 = (brd >> 12) & 0xFF; // High byte of whole divisor

    UCA0BR0 = (brd >> 4) & 0xFF; // Low byte of whole divisor

    UCA0MCTL = ((brd << 4) & 0xF0) | UCOS16; // Fractional divisor, oversampling mode

    UCA0CTL1 = UCSSEL_2; // Use SMCLK for bit rate generator, release reset

    //

    // Timer 1 compare 0

    TA1CCR0 = (16000000UL / (8 * 2 * 20)) - 1; // 20 Hz (50 ms)

    TA1CCTL0 = OUTMOD_4; // Toggle mode

    // Timer 1 capture 1

    TA1CCTL1 = CM_3 | SCS | CAP | CCIE; // Rising and falling, sync, capture, interrupt

    // Timer 1 config

    TA1CTL = TASSEL_2 | ID_3 | MC_1 | TAIE; // SMCLK, /8, count up, overflow interrupt

    //

    _enable_interrupts(); // Enable interrupts

    //

    for(;;) { // For-ever

    if(upd) { // Check for pulse duration measuement available

    // Calculate inches

    const uint32_t in = ((upd * 5534) + (upd >> 1)) >> 14;

    // Calculate mm

    const uint32_t mm = (upd * 5623) >> 16;

    //

    print_u32(in, 2); // Print inches

    puts(" in "); //

    print_u32(mm, 0); // Print mm

    puts(" mm"); //

    puts("\r\n"); //

    upd = 0; // Ready for next

    } //

    } //

    } //

  6. I set the incoming signal (sine wave = 162 MHz, amp=3V) as the clock for TimerA0.

    If that's not a typo - then it is probably way to high for the MSP430 to count reliably. You should have a front end circuit that presents a 16 MHz max square wave to the MSP430.

     

    Here is a simple frequency counter that uses Timer A0 to do the counting, and the watchdog timer as the gate timer: http://forum.43oh.com/topic/1913-frequency-counter-using-launchpad-nokia-5110-lcd/

     

    The bottom half of main() is the code that does the counting.

  7. Ordinary ceramic monolithic caps.

     

    Make sure your LCD module does not have a pullup resistor on the reset line - some do, some don't. If it does, you will have to remove it. The LCD reset circuit used by this project will not work with a pullup resistor on the LCD reset line.

×
×
  • Create New...