Jump to content

fatihinanc

Members
  • Content Count

    56
  • Joined

  • Last visited

  • Days Won

    2

Reputation Activity

  1. Like
    fatihinanc got a reaction from bluehash in RS-485 Transceiver   
    I am using RS-485 for this(SN75176B);
    It is possible to supply voltage = 5v and Rx-Tx = 3v3.


  2. Like
    fatihinanc reacted to RobG in T6963 Graphical LCD libraries   
    Still rough and slow. Some borrowed code that needs to be improved and optimized.
    Here you can find cubeberg's version of T6963 library.




    t6963.hpg128128a.h
    UPDATED 1/22/2012
    msp430_t6963.h
     
    Reuploaded on 11/26/2014 (looks like files were corrupt during 43oh migration)
    msp430_t6963.c
    main.c
  3. Like
    fatihinanc got a reaction from bluehash in LaunchPad Experimenter's Board   
    How is it ?

     

  4. Like
    fatihinanc got a reaction from RobG in LaunchPad Experimenter's Board   
    How is it ?

     

  5. Like
    fatihinanc reacted to RobG in Comparator_A+ Based Schmitt Trigger   
    Do you have to use comparator? All inputs have Schmitt triggers.
    In any case, you will have to protect inputs from negative voltage.
     

     
    If you need a different duty cycle, you'll have to offset input voltage using methods described here for example.
     
    If you do need to use a comparator, here's an example from TI (you still have to protect the input from negative voltage or offset):
     
     

    //****************************************************************************** // MSP430G2x13/G2x53 Demo - Comp_A, Detect Threshold, Set P1.0 if P1.1 > 0.25*Vcc // // Description: Use Comparator_A to detect a voltage threshold. // Using an external potentiometer, an unknown voltage is applied to P1.1. // Comparator_A compares the unknown voltage to an internal reference // voltage, in this example 0.25*VCC. If the unknown voltage is higher // than 0.25*VCC, P1.0 is set, if not, P1.0 is reset. // ACLK = n/a, MCLK = SMCLK = default DCO // // MSP430G2x13/G2x53 // ----------------- // /|\ | XIN|- // | | | // ---|RST XOUT|- // | | | // R<-|P1.1/CA1 P1.0|-->LED // | | | // ---|VSS // // D. Dang // Texas Instruments Inc. // December 2010 // Built with CCS Version 4.2.0 and IAR Embedded Workbench Version: 5.10 //****************************************************************************** #include void main (void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT P1DIR |= 0x01; // P1.0 output CACTL1 = CARSEL + CAREF0 + CAON; // 0.25 Vcc = -comp, on CACTL2 = P2CA4; // P1.1/CA1 = +comp while (1) // Test comparator_A output { if ((CAOUT & CACTL2)) P1OUT |= 0x01; // if CAOUT set, set P1.0 else P1OUT &= ~0x01; // else reset } }
  6. Like
    fatihinanc reacted to RobG in CC2500 Breakout/BoosterPack   
    Here's the tutorial
     


  7. Like
    fatihinanc got a reaction from oPossum in Launchpad as external programmer   
    Yes. FET430 wire pinout(SBW) explain that

    BTW I have tested with 1nF capacitor too. Works
  8. Like
    fatihinanc got a reaction from gordon in Launchpad as external programmer   
    Yes. FET430 wire pinout(SBW) explain that

    BTW I have tested with 1nF capacitor too. Works
  9. Like
    fatihinanc reacted to RobG in CC2500 Breakout/BoosterPack   
    After going back and forth all weekend on what jumpers to include, here's the "final" design.
    The board includes:
    1 Booster pack
    2 G2xx3/CC2500 boards
    2 breakout boards compatible with booster pack
    1 breakout board with single row header
    (I know this is one board too many, so if Seeed rejects it, I will remove single row breakout.)
     
    Booster pack is designed to work with G2xx3 chips (is there any need for G2xx1/2 compatibility?)
     
    Port mapping:
    P1.1 - MISO (CC2500/SPI 2)
    P1.2 - MOSI (CC2500/SPI 2)
    P1.4 - SCLK (CC2500/SPI 2)
    P1.5 - SCLK (CC2500/SPI 1, Memory)
    P1.6 - MISO (CC2500/SPI 1, Memory)
    P1.7 - MOSI (CC2500/SPI 1, Memory)
    P2.0 - CS (CC2500/SPI 1)
    P2.1 - GDO0 (CC2500/SPI 1)
    P2.2 - GDO2 (CC2500/SPI 1)
    P2.3 - GDO2 (CC2500/SPI 2) or Memory Hold
    P2.4 - GDO0 (CC2500/SPI 2) or Memory CS
    P2.5 - CS (CC2500/SPI 2)
     
    When memory is not used, CS should be jumpered to Vcc, same with Hold.
     
    What thickness are we going with?
    1.0mm would be great for MCU boards, but might be too thin for the booster pack. 1.2mm should be perfect.
     
    I will post the complete set of files later today.
     

  10. Like
    fatihinanc reacted to oPossum in 16 channel software PWM using a single timer   
    This is a method of generating multichannel PWM using a single timer.

    A linked list of events is used to allow a very efficient ISR and very low CPU usage.

    This is the linked list entry structure...
    typedef struct { // PWM ISR info struct unsigned time; // Time for on/off action to occur unsigned port_off; // Port pins to turn off unsigned port_on; // Port pins to turn on void *next; // Next entry in linked list } TPWM; // ...and the ISR...
    (written in C for clarity, using assembly would reduce the size and execution time by half)
    __interrupt void Timer0_A1 (void) { volatile unsigned x = TAIV; // Clear interrupt flag P1OUT &= ~pa->port_off; // Port pins off P2OUT &= ~pa->port_off >> 8; // P1OUT |= pa->port_on; // Port pins on P2OUT |= pa->port_on >> 8; // pa = pa->next; // Next entry in list TACCR1 = pa->time; // Update timer compare time } When an interrupt occurs, the ports are updated, the timer is updated, and the next linked list entry is made the active entry. An interrupt will only occur when port pin(s) have to be changed. Very simple and efficient.

    The tradeoff is a rather complex chunk of code to maintain the linked list. The code shown here uses a simple, but rather crude, method of reducing glitches that can occur when the linked list is manipulated. The code will wait for the current pulse to complete before removing the list entry for it. There are better ways to do this, but the code is much more complex due to the many corner cases that must be handled. There is no disruption in the PWM output when PWM values are changed. All PWM outputs are active as long as the timer and global interrupt are enabled.

    The PWM period is 2^16 / SMCLK and the resolution is 2^8 / SMCLK (8 bit resolution).
    So for a 16 MHz clock:
    period = 65,536 / 16,000,000 = 4.096 ms
    resolution = 256 / 16,000,000 = 16 us
    frequency = 16,000,000 / 65,536 = 244.24 Hz

    An interrupt will occur no more than 17 times the base frequency when all 16 channels are active and set to different non-zero/non-max values. So at 16 MHz there will be no more than 4151 interrupts per second. Assuming 100 cycles per interrupt (the C compiler should be able to do better than that) would be 415,100 cycles per second of 16,000,000 or 2.6% CPU usage (worst case).

    The resolution can be increased as long as there are not other interrupts that use too many cycles. Consider the worst case scenario of two back-to-back PWM interrupts with another interrupt in between. The maximum time allowed for other interrupts is the PWM resolution minus the PWM ISR time - it has to squeeze in between back-to-back PWM interrupts.

    Complete code with test case...
    #include "msp430g2553.h" #include "string.h" typedef struct { // PWM ISR info struct unsigned time; // Time for on/off action to occur unsigned port_off; // Port pins to turn off unsigned port_on; // Port pins to turn on void *next; // Next entry in linked list } TPWM; // TPWM pw[17], *pi; // Array and inactive list head volatile TPWM *pa; // Active list entry void pwm_set(const unsigned pin, const unsigned time) { const unsigned mask = 1 << pin; // const unsigned tm = time & 0xFF00; // Limit closeness of entries TPWM *b, *p, *n; // // // -- Try to find existing active entry for this pin for(b = &pw[0], p = b->next; p != &pw[0]; b = p, p = b->next) { if(p->port_off & mask) { // Found it if(p->time == tm) return; // - Time is the same, nothing to do, return... while(pa != p); // Wait for this entry to be active while(pa == p); // Wait for this entry to become inactive // Safe to remove now if(p->port_off == mask) { // - Entry is only used for this pin, remove it b->next = p->next; // Remove link p->next = pi; // Add to inactive list pi = p; // } else { // - Entry is used for multiple pins p->port_off &= ~mask; // Remove this pin from the entry } // break; // Found the pin, so stop searching } // } // // - Update first entry in list if(tm == 0) { // If time is 0, turn off and return pw[0].port_on &= ~mask; // pw[0].port_off |= mask; // return; // } else { // If time is non-zero, turn on pw[0].port_on |= mask; // pw[0].port_off &= ~mask; // if(time == 0xFFFF) return; // If max, no need to turn off, so return } // // // Find where the new turn off entry will go for(b = &pw[0], p = b->next; p != &pw[0]; b = p, p = b->next) if(p->time >= tm) break; // Stop when an entry of >= time is found // if(p->time == tm) { // If same time, use existing entry p->port_off |= mask; // Add this pin return; // All done... } // // n = pi; // Get an entry from the inactive list pi = n->next; // // n->port_off = mask; // Setup new entry n->port_on = 0; // n->time = tm; // // n->next = p; // Insert in to active list b->next = n; // } void pwm_detach(unsigned pin) { const unsigned mask = 1 << pin; TPWM *b, *p; // Try to find existing active entry for this pin for(b = &pw[0], p = b->next; p != &pw[0]; b = p, p = b->next) { if(p->port_off & mask) { // Found it if(p->port_off == mask) { // Entry is only used for this pin, remove it _DINT(); if(pa == p) pa = p->next; b->next = p->next; _EINT(); p->next = pi; pi = p; } else { p->port_off &= ~mask; // Remove this pin from the entry } break; } } pw[0].port_on &= ~mask; // Don't turn on or off pw[0].port_off &= ~mask; } void pwm_init(void) { unsigned n; memset(pw, 0, sizeof(pw)); // Clear entire array pa = &pw[0]; // Active list always begins with first array element pa->next = &pw[0]; // Begin with only 1 entry in list pi = &pw[1]; // First inactive entry is second array element for(n = 1; n < sizeof(pw)/sizeof(TPWM) - 1; ++n) // Link the inactive entries pw[n].next = &pw[n + 1]; // // TACTL = TASSEL_2 + MC_2 + ID_0; // Setup timer, continuous mode, SMCLK/1 TACCTL1 = CCIE; // Enable timer interrupt _EINT(); // Enable interrupts } #pragma vector = TIMER0_A1_VECTOR __interrupt void Timer0_A1 (void) { volatile unsigned x = TAIV; // Clear interrupt flag P1OUT &= ~pa->port_off; // Port pins off P2OUT &= ~pa->port_off >> 8; // P1OUT |= pa->port_on; // Port pins on P2OUT |= pa->port_on >> 8; // pa = pa->next; // Next entry in list TACCR1 = pa->time; // Update timer compare time } // Test case for 2 channels - Launchpad LEDs void main(void) { unsigned n, o; WDTCTL = WDTPW | WDTHOLD; // Disable watchdog DCOCTL = 0; // Run at 16 MHz BCSCTL1 = CALBC1_16MHZ; // DCOCTL = CALDCO_16MHZ; // P1DIR = BIT0 | BIT6; // Enable outputs for LEDs on Launchpad pwm_init(); // Initialize software PWM for(;;-) { pwm_set(0, n); pwm_set(6, o); n += 100; o += 123; __delay_cycles(100000); } } // Test case for all 16 channels void main(void) { unsigned n; unsigned w[16]; unsigned r[16] = { 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145 }; WDTCTL = WDTPW | WDTHOLD; // Disable watchdog DCOCTL = 0; // Run at 16 MHz BCSCTL1 = CALBC1_16MHZ; // DCOCTL = CALDCO_16MHZ; // P2SEL = 0; // Allow P2.6 and P2.7 to be used as GPIO P1DIR = P2DIR = 0xFF; // Enable all P1 and P2 pins as output pwm_init(); // Initialize software PWM for(;;-) { for(n = 0; n < 16; ++n) { pwm_set(n, w[n]); w[n] += r[n]; } __delay_cycles(100000); } } Two PWM outputs with the pulse with changing at different rates (lower trace is faster). The two outputs are the Launchpad LEDs.




    All 16 channels.

  11. Like
    fatihinanc reacted to SugarAddict in Need help with crystals   
    Crystal Required Capacitance * 2 - 2 = Capacitor Value
     
    SLAA322 shows this:
    Crystal requires 12 pF load.
    Parasitic capacitance per pin is 2 pF.
    CL1 = (2 x CLoad)
  12. Like
    fatihinanc got a reaction from moihussain in Need help with crystals   
    Due to the integrated capaticance, don't require use an external capacitor.
    You only need to a 32.768kHZ crystal.
    As shown in the picture on below;

     
    For the UART. You simply reference to code examples from TI.
    http://www.ti.com/lit/zip/slac015
  13. Like
    fatihinanc got a reaction from pfactorial in IAR Code Size   
    This image will helps you.
     

  14. Like
    fatihinanc reacted to oPossum in DIP package breadboard breakout   
    This is a breakout board for 20 pin DIP package MSP430. It is intended to plug in to a solderless breadboard.
     
    Dimensions are 50.0 mm x 24.6 mm, so two will fit on a 50 x 50 mm panel.
     
    It is SIL style rather than the more common DIL style so that all the pins can be clearly labeled and logically ordered. This style also allows 4 of the 5 holes in a column be be used. Can be used with straight or right angle header strip.
     
    The circuit is minimalist with just a bypass cap and resistor on /Reset. Optional xtal and power LED.
     
    Provision for 50 mil and/or 100 mil program/debug/UART headers. Selectable soft or hard UART configuration.
     
    In addition to the 18 pin header on the bottom, there is an optional 2 pin header that connects to the power rails of the breadboard.
     

    dip_breadboard.brd
    dip_breadboard.sch
×
×
  • Create New...