Rotary Encoder Interfacing With MSP430 LaunchPad  
http://www.circuitvalley.com/2013/09/ro ... chpad.html


[ add comment ]   |  [ 0 trackbacks ]   |  permalink  |  related link
MSP430 i2c code 4 DCO 

/*
* This file is automatically generated and does not require a license
*
* ==== WARNING: CHANGES TO THIS GENERATED FILE WILL BE OVERWRITTEN ====
*
* To make changes to the generated code, use the space between existing
* "USER CODE START (section: <name>)"
* and
* "USER CODE END (section: <name>)"
* comments, where <name> is a single word identifying the section.
* Only these sections will be preserved.
*
* Do not move these sections within this file or change the START and
* END comments in any way.
* ==== ALL OTHER CHANGES WILL BE OVERWRITTEN WHEN IT IS REGENERATED ====
*
* This file was generated from
* C:/ti/grace_3_00_01_48_eng/packages/ti/mcu/msp430/csl/interrupt_vectors/InterruptVectors_init.xdt
*/
#include <msp430.h>

/* USER CODE START (section: InterruptVectors_init_c_prologue) */
#include <stdint.h>

extern unsigned char calibrate_flag;

struct Voice {

uint8_t osc_divider;
uint8_t osc_counter_lsb;
uint8_t osc_counter_msb;
uint8_t osc_dac_lsb;
uint8_t osc_dac_msb;

} voice;

unsigned int i2c_cntr = 0;
unsigned int virtual_TA0CCR0;
unsigned int virtual_TA0CTL;
unsigned char play_midi_note_toggle_bit;
/* USER CODE END (section: InterruptVectors_init_c_prologue) */

/*
* ======== InterruptVectors_graceInit ========
*/
void InterruptVectors_graceInit(void)
{
}


/* Interrupt Function Prototypes */



/*
* ======== USCI A0/B0 TX Interrupt Handler Generation ========
*
* Here are several important notes on using USCI_A0/B0 TX interrupt Handler:
* 1. User could use the following code as a template to service the interrupt
* handler. Just simply copy and paste it into your user definable code
* section.
* For UART and SPI configuration:

if (IFG2 & UCA0TXIFG) {

}
else if (IFG2 & UCB0TXIFG) {

}

* For I2C configuration:
if (IFG2 & UCA0/B0TXIFG) {

}
else if (IFG2 & UCA0/B0RXIFG) {

}


* 2. User could also exit from low power mode and continue with main
* program execution by using the following instruction before exiting
* this interrupt handler.
*
* __bic_SR_register_on_exit(LPMx_bits);
*/
#pragma vector=USCIAB0TX_VECTOR
__interrupt void USCI0TX_ISR_HOOK(void)
{
/* USER CODE START (section: USCI0TX_ISR_HOOK) */
if (IFG2 & UCB0TXIFG) { // callback to transmit bytes

UCB0TXBUF = 0xff;

} else if (IFG2 & UCB0RXIFG) { // callback for bytes received

switch(i2c_cntr) {

case 0:
voice.osc_divider = UCB0RXBUF;
i2c_cntr++;
break;

case 1:
voice.osc_counter_msb = UCB0RXBUF;
i2c_cntr++;
break;

case 2:
voice.osc_counter_lsb = UCB0RXBUF;
i2c_cntr++;
break;

case 3:
voice.osc_dac_msb = UCB0RXBUF;
i2c_cntr++;
break;

case 4:
voice.osc_dac_lsb = UCB0RXBUF;
i2c_cntr++;

virtual_TA0CCR0 = voice.osc_counter_msb; // (2) CCR0 - set CCR0 (compare register value)
virtual_TA0CCR0 = virtual_TA0CCR0 << 8;
virtual_TA0CCR0 |= voice.osc_counter_lsb;

if(voice.osc_divider == 1) {
// (4) TA0CTL - clock src & divider & mode
// start TIMER0_A0
// TASSEL_2 == Timer A clock source select: 2 - SMCLK
// ID_0 == Timer A input divider: none
virtual_TA0CTL = TASSEL_2 | ID_0 | MC_1; // MC_1 == Timer A mode control: 1 - Up to CCR0

} else if(voice.osc_divider == 2) {
// (4) TA0CTL - clock src & divider & mode
// TASSEL_2 -- SMCLK
// ID_1 -- Timer A input divider: 1 - /2 *
virtual_TA0CTL = TASSEL_2 | ID_1 | MC_1; // MC_1 -- Timer A mode control: 1 - Up to CCR0

} else if(voice.osc_divider == 4) {
// (4) TA0CTL - clock src & divider & mode
// TASSEL_2 -- SMCLK
// ID_2 -- Timer A input divider: 2 - /4 *
virtual_TA0CTL = TASSEL_2 | ID_2 | MC_1; // MC_2 -- Timer A mode control: 1 - Up to CCR0

} else if(voice.osc_divider == 8) {
// (4) TA0CTL - clock src & divider & mode
// TASSEL_2 -- SMCLK
// ID_2 -- Timer A input divider: 3 - /8
virtual_TA0CTL = TASSEL_2 | ID_3 | MC_1; // MC_2 -- Timer A mode control: 1 - Up to CCR0

} else if(voice.osc_divider == 16) {
// (4) TA0CTL - clock src & divider & mode
// TASSEL_2 -- SMCLK
// ID_2 -- Timer A input divider: 3 - /8
virtual_TA0CTL = TASSEL_2 | ID_3 | MC_3; // MC_3 -- Timer A mode control: 3 - Up/Down

} else if(voice.osc_divider == 0xff) { // calibration request (0xff)

calibrate_flag = 1; // set calibration flag
P1OUT |= BIT2; // ON LED; BIT0(P1) is MCU pin 2

}

}

if(!calibrate_flag) {

//
// TOGGLE play_midi_note_toggle_bit & SET
//

play_midi_note_toggle_bit ^= BIT7; // toggle play_midi_note_toggle_bit

if(play_midi_note_toggle_bit != 0) {

P1OUT |= BIT3; // BIT3(P1) is MCU pin 5

} else {

P1OUT &= ~(BIT3); // BIT3(P1) is MCU pin 5

};

//
// set voltages on R2R
//
if(voice.osc_dac_msb != 0) { // prevent ower-current when MSB state changes
// ie. 10 11111000 <-> 11 10000000
P3OUT = 0;

}

voice.osc_dac_msb |= 0xfc;
P2OUT &= voice.osc_dac_msb;

voice.osc_dac_msb &= 0x03;
P2OUT |= voice.osc_dac_msb;

P3OUT = voice.osc_dac_lsb;

}

}

/* USER CODE END (section: USCI0TX_ISR_HOOK) */
}

/*
* ======== USCI A0/B0 RX Interrupt Handler Generation ========
*
* Here are several important notes on using USCI_A0/B0 RX interrupt Handler:
* 1. User could use the following code as a template to service the interrupt
* handler. Just simply copy and paste it into your user definable code
* section.
* For UART and SPI configuration:

if (IFG2 & UCA0RXIFG) {

}
else if (IFG2 & UCB0RXIFG) {

}

* For I2C configuration:
if (UCB0STAT & UCSTTIFG) {

}
else if (UCB0STAT & UCSTPIFG) {

}
else if (UCB0STAT & UCNACKIFG) {

}
else if (UCB0STAT & UCALIFG) {

}

* 2. User could also exit from low power mode and continue with main
* program execution by using the following instruction before exiting
* this interrupt handler.
*
* __bic_SR_register_on_exit(LPMx_bits);
*/
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR_HOOK(void)
{
/* USER CODE START (section: USCI0RX_ISR_HOOK) */
if (UCB0STAT & UCSTTIFG) { // start condition interrupt (1 is pending)

i2c_cntr = 0; // transmission begins
UCB0STAT &= ~UCSTTIFG; // clear start condition int flag

} else if (UCB0STAT & UCSTPIFG) { // stop condition interrupt (1 is pending)

UCB0STAT &= ~UCSTPIFG; // clear stop condition int flag

} else if (UCB0STAT & UCNACKIFG) { // slave not acknowledge received data (if master)

UCB0STAT &= ~UCNACKIFG;

} else if (UCB0STAT & UCALIFG) { // two or more masters start trans. simultaneously

// master code

}
/* USER CODE END (section: USCI0RX_ISR_HOOK) */
}

/*
* ======== Timer0_A3 Interrupt Service Routine ========
*/
#pragma vector=TIMER0_A0_VECTOR
__interrupt void TIMER0_A0_ISR_HOOK(void)
{
/* USER CODE START (section: TIMER0_A0_ISR_HOOK) */

TA0CTL = virtual_TA0CTL;
TA0CCR0 = virtual_TA0CCR0;

/* USER CODE END (section: TIMER0_A0_ISR_HOOK) */
}




[ 7 comments ]   |  [ 0 trackbacks ]   |  permalink
Ženy v islámu  


[ add comment ]   |  [ 0 trackbacks ]   |  permalink
FWbuilder for CENTOS/RHEL5 QT problem 



Revive FWbuilder

# yum install qt-devel qt-config

# yum install autoconf

# yum install automake

# yum install libtool

# yum install gcc-c++

# yum install libxml2-devel

# yum install libxslt-devel

* download fwbuilder wget https://github.com/UNINETT/fwbuilder/archive/master.zip

* unzip and go to extracted dir, change constructor call for QCoreApplication app(argc, argv); there is no false parameter in call any longer


# ./autogen.sh

# ./runqmake.sh

# make clean

# make all


edit "./src/ipt/ipt.cpp" 204L, 5258C

int main(int argc, char **argv)
{
// QCoreApplication app(argc, argv, false);
QCoreApplication app(argc, argv); <-- replace



edit "./src/pf/pf.cpp" 198L, 4973C

int main(int argc, char **argv)
{
QCoreApplication app(argc, argv); // 3rd arg false deleted


edit "./src/ipf/ipf.cpp"

int main(int argc, char **argv)
{
QCoreApplication app(argc, argv); // 3rd arg false deleted

edit "./src/ipfw/ipfw.cpp"

int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);


edit "./src/nxosacl/nxosacl.cpp" 193L, 4781C written

int main(int argc, char **argv)
{
QCoreApplication app(argc, argv); // 3rd arg false deleted

edit "./src/pix/pix.cpp" 197L, 4857C written

int main(int argc, char **argv)
{
QCoreApplication app(argc, argv); // 3rd arg false deleted

edit "./src/procurve_acl/procurve_acl.cpp" 193L, 4784C written

int main(int argc, char **argv)
{
QCoreApplication app(argc, argv); // 3rd arg false deleted

--
compile
/usr/local/share/fwbuilder-5.2.0.3600/
/usr/local/bin/fwbuilder



[ add comment ]   |  [ 0 trackbacks ]   |  permalink  |  related link
Celni panel a uchyceni potu 
http://www.quickpanel.eu/wiki/engraving ... s-examples
http://www.plexiplast.cz/

[ add comment ]   |  [ 0 trackbacks ]   |  permalink
Razitka na panel 
http://www.razitka-razitko.cz/filtrovani/
https://www.youtube.com/watch?v=Yj0Bv4UEFSs
http://www.shenzhen2u.com/PCB


[ add comment ]   |  [ 0 trackbacks ]   |  permalink
synthlinks 
http://www.modularsynthesizers.nl/c-235 ... ck-skiffs/
http://www.creativegallery.nl/index.php ... ;Itemid=60
http://www.doepfer.de/home_e.htm
http://www.arpeggi8.com/synth/minimoog/mini.html
http://encon.fke.utm.my/nikd/Internet/opto-couplers.pdf
http://www.farnell.com/datasheets/1831001.pdf
http://www.bernacomp.com/elec/vcpan.html
http://www.korganalogue.net/korgother/D ... ervice.pdf
http://www.synthmuseum.com/magazine/linexpo.html
http://www.ti.com/ww/en/bobpease/assets/AN-31.pdf

[ add comment ] ( 1 view )   |  [ 0 trackbacks ]   |  permalink
Use a photoelectric-FET optocoupler as a linear voltage-controlled potentiometer 
Use a photoelectric-FET optocoupler as a linear voltage-controlled potentiometer
http://www.edn.com/design/analog/436889 ... entiometer

[ 1 comment ]   |  [ 0 trackbacks ]   |  permalink  |  related link
Writing and then Reading from Flash Memory on msp430g2553 
Writing and then Reading from Flash Memory on msp430g2553

http://e2e.ti.com/support/microcontroll ... 91331.aspx

[ add comment ]   |  [ 0 trackbacks ]   |  permalink  |  related link
Rotary Encoder Tutorial with Arduino Code 


[ add comment ] ( 1 view )   |  [ 0 trackbacks ]   |  permalink

<<First <Back | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Next> Last>>