The controller message has an argument that goes from -8192 to 8191 and in standard MIDI files this is supposed to cover the range from -200 cent to 200 cent, where 1 cent is 1/100 of semitone, i.e. a ratio of 2^(1/1200) = 1.000577789506555.
[ add comment ] | [ 0 trackbacks ] | permalink | related link
static int state = 0;
So if you need a variable that is only used within a function and only updated by that function and you need the value of that variable to remain for the next time that you call the function then you need to define it as a static variable.
[ add comment ] | [ 0 trackbacks ] | permalink
In many application, it is sometime necessary to place a variable in a specific memory location. This wiki shows a small guide to implement the specific variable placement for C programming language using most common compilers/IDEs for MSP430.
[ add comment ] | [ 0 trackbacks ] | permalink | related link
/*
* TA0CCTL0, Capture/Compare Control Register 0
*
* CM_1 -- Rising Edge
* CCIS_0 -- CCIxA
* ~SCS -- Asynchronous Capture
* ~SCCI -- Latched capture signal (read)
* ~CAP -- Compare mode
* OUTMOD_0 -- PWM output mode: 0 - OUT bit value
*
* Note: ~<BIT> indicates that <BIT> has value zero
*/
TA0CCTL0 = CM_1 | CCIS_0 | OUTMOD_0 | CCIE;
/* TA0CCR0, Timer_A Capture/Compare Register 0 */
TA0CCR0 = 31;
/*
* TA0CTL, Timer_A3 Control Register
*
* TASSEL_0 -- TACLK
* ID_0 -- Divider - /1
* MC_1 -- Up Mode
*/
TA0CTL = TASSEL_0 | ID_0 | MC_1;
[ add comment ] | [ 0 trackbacks ] | permalink
TIMER0_A1_VECTOR handles all Timer A0 interrupts except CCR0. TIMER0_A0_VECTOR handles the CCR0 interrupt.
Code for the TIMER0_A1_VECTOR should read TA0IV to clear the source of the interrupt (and perhaps decode it when multiple sources are enabled).
Code for the TIMER0_A0_VECTOR doesn't need to clear the source of its interrupt because the hardware automatically clears the single source.
/*
* ======== Timer0_A3 Interrupt Service Routine ========
*/
#pragma vector=TIMER0_A1_VECTOR
__interrupt void TIMER0_A1_ISR_HOOK(void)
{
/* USER CODE START (section: TIMER0_A1_ISR_HOOK) */
switch( TAIV ) {
case 2:
P1OUT ^= BIT0; /* Toggle LED on P1.0 */
break; // CCR1 not used
case 4: break; // CCR2 not used
case 10: break; // overflow break; }
}
/* USER CODE END (section: TIMER0_A1_ISR_HOOK) */
}
#pragma vector = TIMER0_A1_VECTOR
__interrupt void TIMER0_A1_ISR()
{
switch (__even_in_range(TA0IV, TA0IV_TAIFG)) // recommended syntax for TAIV handling
{
case TA0IV_TACCR1: // CCR1
count1++;
if (count1 == 25)
{
P1OUT ^= 0X01;
count1 = 0;
}
break;
case TA0IV_TACCR2: // CCR2 - unused
case TA0IV_6: // Reserved
case TA0IV_8: // Reserved
case TA0IV_TAIFG: // Timer overflow - unused
break;
}
}
The MSP430 uses various clock sources from external XTAL's and internal oscillators such as the DCO (Digital Control Oscillator), VLO (Very low frequency Oscillator) etc to generate 3 internal clock sources.
-------------------------------------------
internal clocks (ACLK, SMCLK)
ACLK (TACLK/ACKL)
The ACLK clock can be sourced from the external 32 KHz XTAL or internal 10 KHz VLO Oscillator.
SMCLK
Usually sourced from the MCLK
(MCLK Can be sourced from the external High frequency XTAL or internal DCO)
-------------------------------------------
external clocks ()
The above is general however other possibities exist and differ from device to device. Newer 5x parts have many more clocking options.
The timers on the MSP430 can be clocked from various internal clocks such as the ACLK, SMCLK etc. These can be divided down if required. The TACLK is an external pin that can be used to clock the internal timer.
[ add comment ] | [ 0 trackbacks ] | permalink | related link
http://www.ti.com/ww/en/launchpad/launchpad.html
[ 1 comment ] ( 6 views ) | [ 0 trackbacks ] | permalink | related link
http://siryoa.blogspot.cz/
[ add comment ] | [ 0 trackbacks ] | permalink | related link
<iframe width="420" height="315" src="//www.youtube.com/embed/411f0DvXu18" frameborder="0" allowfullscreen></iframe>
http://electronicdesign.com/analog/volt ... wo-op-amps
[ add comment ] | [ 0 trackbacks ] | permalink
with MSP430FR5969 FRAM Launchpad
[ add comment ] | [ 0 trackbacks ] | permalink | related link
MSP430ware's DriverLib
[ add comment ] | [ 0 trackbacks ] | permalink | related link