Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all 22232 articles
Browse latest View live

MSP430G2332: How reliable is this device when subject to the following condition?

$
0
0

Part Number:MSP430G2332

Hello,

I need to know how long the device can survive under the following condition:

MSP430G2332 transmits a 2.2V signal on PIN 13 (P2.6) (Configured as Output) to another controller. However, the controller is not powered up when it sees this 2.2V signal, and this signal powers the controller through the ESD Diode. This pulls the PIN 13 on MSP down and we see a dip from 2.2V to about 1.5V for about 200us.

This condition occurs 50 times a day approximately. How reliable is the MSP430 when it is subject to 

Thanks.


MSP430F5229: More flash needed in small package

$
0
0

Part Number:MSP430F5229

I have been working with the audio sink board with the MSP430f5229. I have the A3DP demo project running on the board. I modified the HFP demo (as a headset) project to allow it establish a Bluetooth connection and answer/hang up calls without the command line entry and got it to run on the board. Now, I would like to have HFP and audio sink run together and it doesn't fit in the MSP430f5229. I will be using momentary push buttons so I don't need cap touch buttons. Is there a device available (or something in the pipeline being released soon) with the smaller DSBGA package (MSP430f5229IYFF 64 pin) that would have 256 kB of flash so that I can run the Bluetooth profiles I need (A3DP, AVRCP, HCI, HFP WBS)?  I don't have a lot of space which makes the DSBGA package attractive as well as the cost.

thanks,
Kim

RTOS/MSP432P401R: Uart max speed

$
0
0

Part Number:MSP432P401R

Tool/software:TI-RTOS

Hi,

I have a msp 432 which most of the time sleeps.

But when it wakes up it has to send some data as fast as possible over mobile network(UART) interface.

The uart is working perfectly at 115200 speed but if I try to a higher speed like 230400 it hangs. It is even possible to set this speed for the uart  at 48M clock.

Thank you for the help

MSP430F5529: I2C not working with Energia

$
0
0

Part Number:MSP430F5529

Feels like this should be a pretty easy problem to solve but it's giving me a headache. 

I have an MSP430F5529 launchpad with 7.5kohm resistors being used as pullups from 3V3. When I run the code and connect SDA and SCL directly to an oscilloscope, both SDA and SCL are held high.

I already found out that Wire.endTransmission() causes a hold up in the code so I commented it out. Also, when I leave in all the serial.print commands I can see based on the monitor that it is looping through the loop().

#include <Wire.h>

byte idle = 0x00; // Tidle min = 4 clk pulses but can be longer

byte Start =  0x05;
byte TIDhigh =  0x02;
byte TIDlow = 0x03;
byte CNTL =  0x7D;
byte CPTY =  1;
byte D1;
byte D2;

void setup() {
  
  Serial.begin(9600);           // start serial for output
  delay(100);
  Wire.begin();

}

void loop() {

  DataFormation();

/*
  Serial.print("D1: ");
  Serial.print(D1, HEX);
  Serial.print("\n");

  Serial.print("Start: ");
  Serial.print(Start, HEX);
  Serial.print("\n");

  Serial.print("TID: ");
  Serial.print(TIDlow, HEX);
  Serial.print("\n");

  Serial.print("CNTL: ");
  Serial.print(CNTL, HEX);
  Serial.print("\n");
*/
  
  Wire.beginTransmission(0x03);
  Wire.write(Start);
  //Wire.endTransmission();
  
}

void DataFormation(void) {

  byte temp;
  
  D1 = Start;
  temp = (D1 << 3) | TIDlow;
  D1 = (temp << 2) | (CNTL >> 6);

  
}

Starterware/MSP430FR6972: the question about SCG0 bit

$
0
0

Part Number:MSP430FR6972

Tool/software: Starterware

Hello master,

From the MSP430FR6972's user guide (Page 107), I got SCG0 bit's description "System clock generator 0. This bit may be used to enable or disable functions in the clock system depending on the device family; for example, FLL enable or disable " . However , I don't find FLL 's informations from user guide any more , except the part for descripting SCG0 bit. What is FLL for ? Do the  MSP430FR6972 have FLL function ?  Do the LPM0 and LPM1 's  functions be same in the MSP430FR6972 ? Also , LPM2 's function is same to  LPM3 's function ?  

Best regards

Jent

MSP432P401R: MSP432P401R I2C example for Keil uV5 not working

$
0
0

Part Number:MSP432P401R

As suggested by Vikas Chola from TI. We used i2ctmp007 example from C:\ti\simplelink_msp432_sdk_1_40_01_00\examples\nortos\MSP_EXP432P401R\drivers\i2ctmp007 in keil but we are unable to execute.

It is stucked in SystemInit.

Here I attached whole i2ctmp007 project ported into Keil.

Please provide the solution.(Please visit the site to view this file)

MSP430F447: Hardware design doubt

$
0
0

Part Number:MSP430F447

Hi 

i have drawn schematic and i have some unused pin should i have to connect to ground or to pull up , by doing so can i use it later if i want .

regards

senthil

MSP430F47187: Help required with initializing SPI on USCI B1

$
0
0

Part Number:MSP430F47187

Hello All, 

I am trying to interface a Microchip NOR flash (SST25VF080B) to the MSP43047187 on SPI port (USCI B1) . 

The same port was originally interfaced to an SD card. Pins used are P2.1, P2.2, and P2.3.

Currently the SD card holder has not been mounted , although the pull up resistors (10K) on all lines are in place.

I am using SPI in the 3 pin mode. The CE#  and WP# are derived from P1.3 and P1.4 in my hardware and bit banged when required. 

My problem is I am not able to initialize the SPI bus itself. I do not see any activity on either the CLK, SIMO or the SOMI pins. Only the Enable and WP pins get toggled since they are bit banged. 

Initialization code is attached below. 

// SPI Ports
#define SPI_SEL         P2SEL
#define SPI_DIR         P2DIR
#define SPI_OUT         P2OUT
#define SPI_REN         P2REN
// SPI pins
#define SPI_MOSI        BIT1
#define SPI_MISO        BIT2
#define SPI_CLK         BIT3

// NOR Flash Pins
#define NOR_CS          BIT3
#define NOR_WP          BIT4
#define NOR_HOLD        BIT7
// #define NOR_HOLD         BIT0

// NOR flash definitions
#define NOR_CS_SEL		P1SEL
#define NOR_CS_OUT		P1OUT
#define NOR_CS_DIR		P1DIR
#define	NOR_CS_REN		P1REN


void Init_SPI(void)
{
	// Initialize USCI_B1 for SPI Master operation
	UCB1CTL1 = UCSWRST;          	// Reset state machine

	UCB1CTL0 = UCCKPH + UCCKPL + UCMSB + UCMST + UCSYNC; // 3-pin, 8-bit SPI master
	UCB1CTL1 = UCSWRST + UCSSEL_2;  // Use SMCLK, hold in RESET condition


	UCB1BR0 = 80;                   // Initial SPI clock must be <400kHz
	UCB1BR1 = 0;                    // f_UCxCLK = 16MHz/40 = 400kHz

	// Port initialization for NOr Flash operation
	SPI_SEL |= SPI_CLK + SPI_MISO + SPI_MOSI; 	// Select SPI functions for pins allocated
	SPI_REN |= SPI_CLK + SPI_MISO + SPI_MOSI;	// Enable Internal Pull up on MISO
	SPI_OUT |= SPI_CLK + SPI_MISO + SPI_MOSI;	// Set Output state to High
	SPI_DIR |= SPI_CLK + SPI_MOSI;	// Configure as Output.
	SPI_DIR &= ~SPI_MISO;			// Configure as input.

	// Clock polarity select - The inactive state is high
	// MSB first
	UC1IE	=	0x00;
	UCB1CTL1 &= ~UCSWRST;           // Release USCI from reset state
	UC1IFG &= ~(UCB1RXIFG);
}	// end of Init SPI Bus
void Init_NOR_Flash(void)
{
	NOR_CS_SEL &= ~(NOR_CS + NOR_WP);	// CS is plain I/O port.
	NOR_CS_OUT |= NOR_CS + NOR_WP;		// Chip is Disabled mode
	NOR_CS_REN |= NOR_CS + NOR_WP;
	NOR_CS_DIR |= NOR_CS + NOR_WP;		// Chip Enable direction to Output mode.

	NOR_HOLD_SEL &= ~NOR_HOLD;
	NOR_HOLD_OUT |= NOR_HOLD;
	NOR_HOLD_DIR |= NOR_HOLD;

	NOR_ENABLE;
	_NOP();
	Send_NOR_Command(NOR_WRDI);
	NOR_DISABLE;
	_NOP();
	Flash_Lock();
	_NOP();
}

These are called in Main as follows:

void main(void)
{

   unsigned int i;

   WDTCTL = WDTPW + WDTHOLD;              // Stop watchdog timer

   FLL_CTL0 |= DCOPLUS;                   // DCO+ set, freq = xtal x D x N+1
   SCFI0 = FLLD_4+FN_4;                   // x4 DCO freq, 16MHz nominal DCO
   SCFQCTL = 31;                          //(31+1) x 32768 x 4 = 4 MHz
   FLL_CTL1 |= XT2OFF + LFXT1DIG;

   for (i = 0; i < 10; i++)
     delay(10000);

   // Wait for xtal to stabilize
   do
   {
     IFG1 &= ~OFIFG;                       // Clear OSCFault flag
     for (i = 500; i > 0; i--);            // Time for flag to set
   }
   while ((IFG1 & OFIFG));                 // OSCFault flag

   //wait for power to stabalize
   SVSCTL = 0xb0;
   for(i = 0; i < 10000; i++);

   while(SVSCTL & SVSFG)
   {
     SVSCTL &= ~SVSFG;
     for(i = 0; i < 10000; i++);
   }

   //switch to high speed
   FLL_CTL0 |= DCOPLUS;                   // DCO+ set, freq = xtal x D x N+1
   SCFI0 = FLLD_4+FN_4;                   // x4 DCO freq, 16MHz nominal DCO
   SCFQCTL = 124;                         //(124+1) x 32768 x 4 = 16 MHz
   FLL_CTL1 |= XT2OFF + LFXT1DIG;

   //Wait for xtal to stabilize
   do
   {
     IFG1 &= ~OFIFG;                       // Clear OSCFault flag
     for (i = 10000; i > 0; i--);          // Time for flag to set
   }
   while ((IFG1 & OFIFG));                 // OSCFault flag

   FCTL2 = FWKEY + FSSEL0 + FN5 + FN4;     // MCLK/41 for Flash Timing Generator


	P4SEL = 0x00;                             //i/o function selected for P4
	P4REN = 0x00;
	P4DIR = 0xff;                             //all output
	P4OUT = 0xff;
     Init_SPI();
     Init_NOR_Flash();

       while(1)

       {

       }

 

 


CCS/MSP430FR5994: Power consume with FR5994 DMA?

$
0
0

Part Number:MSP430FR5994

Tool/software: Code Composer Studio

Hi :

 I want to know the advantage of DMA in energy consume. But the datasheet do not give the DMA module current consumption like below:

Do anyone have the specific data for DMA?

What’s more when the DMA works the CPU has been halted in low-power mode as the user’s guide said as below:

And I don’t know the specific current of CPU in this mode.Does anyone have the specific data?

Can CapTIvate be applied to a touch mouse?

$
0
0

Hi,

I want to make a touch mouse using TI touch solution.

Can CapTIvate be applied to a touch mouse?

MSP430F67751A: SMCLK ( from DCO )Drift and ppm Calculation _ Transmit error for the eUART

$
0
0

Part Number:MSP430F67751A

Hi Everyone,

We are using MSP430F67751A for our application. In this we are giving clock using an External Clock using TCXO (32768 Hz).

I wanted to calculate the exact Main Clock and Sub Main Clock. So I have used the following formulae from User Guide to calculate exact clock output from PLL.

 From that calculation , I have Found MCLK and SMCLK which is shown below.

MCLK (Hz)

16023552

SMCLK (Hz)

16023552

It is not exactly 16Mhz.

Also calculated the DCO thermal and Vcore Voltage drift for that SMCLK from DCO , that shows around

Maximum Frequency for SMCLK (Hz)

16519480.93

Minimum Frequency for SMCLK (Hz)

15527623.07

is the above clock drift is acceptable ?? in ppm it is around 30950 ppm for the clock of 16023552 Hz. (Please Refer the attachment for the detailed Calculation)

Kindly Clarify it .

eUART Tx error : 

Also I have Calculated eUART Maximum Tx Error for this worst case SMCLK (from the above table ) and it shows the Tx error of maximum 25 % . (Please Refer the attachment for the detailed Calculation)

Is it acceptable for the successful UART communication ??

Kindly give if you have excel calculator for the Tx and Rx Error for eUART ..

Thanks and Regards ,

Rajesh K

Refer the Below attachment :

(Please visit the site to view this file)

MSP430F67751A: eUSCI_A0 UART

$
0
0

Part Number:MSP430F67751A

Hi 

I am using eUSCI_A0 UART. The baud rate is 115200

If I use external TCXO, HCMOS, 3.3V, 14.7456Mhz for eUSCI_A0 clock, 

BRCLK = 14.7456Mhz, OS16=1

N = fBRCLK/baud rate = 14.7456e6/115200 = 128

 UCBRx = INT(N/16), = 128/16 = 8

UCBRFx = INT([(N/16) – INT(N/16)] × 16) = 0

then 

BITCLK time  = (1/BRCLK)*N/2 = (1/1475600)*128/2 = 4.34us or BITLCK = 0.2304Mhz which is 1/64 times BRCLK

Will baud rate be accurate.

regards

Subbu

7372800

MSP432P401R: Best Practices hitting the 1 msps rate over 3 channels using DMA

$
0
0

Part Number:MSP432P401R

My Customer is having trouble hitting the 1 msps (actually needs 600khz) rate over 3 channels using the DMA.  

I’m working to get the ADC14 running at 200 kSPS per channel, alternating between 3 channels for a total of 600 kSPS. I’m running at 48 MHz, have the ADC samples being triggered by TIMER_A, cycling between 3 analog channels. I’m close to 600 kSPS rate using just using ADC interrupts & no DMA, but am missing samples, as expected. I started this way (without DMA) to get my input lines, clocks, & ADC doing what I want. Now, I’m trying to fold DMA into the mix.

I need DMA to handle 2 transfer scenarios:  (1) Directly into the SPI TX, and (2) Directly into a local RAM array (for pre-processing steps before SPI transfer).

I have scoured the Project|Examples|Resource Explorer, and don’t see anything this complex. Are there other sources of examples?

Apparently, there’s only 1 DMA channel that supports being triggered by the ADC (DMA Channel 7). If I’m sampling 3 channels (A0-A2), the DMA gets triggered after all 3 are scanned, so 3 transfers occur and the DMA interrupt goes off. Then, in the DMA interrupt, I have to update the destination address to move 3 entries down. This takes too long, so am missing samples.

What speed are you running the processor?     [48 MHz]

What resolution are you running the ADC?       [14-Bit]

What is your ADC14CLK?  [24 MHz]

What is your ADDC 14PDIV? [I don’t know what this is; Using ADC_DIVIDER_2) 

What clock Source are you using?  [MCLK]

SLAA707.pdf appeared relevant, but upon review was not useful to the customer.

Code available on request for internal review.

Thanks! 

Blake

 

CCS/MSP430FR2633: Timer doesn't start interrupt routine

$
0
0

Part Number:MSP430FR2633

Tool/software: Code Composer Studio

Hello, 

i am working with Captivate Design Center and tried to write the code to a CapaTouch Sensor to regulate the light of a LED. 
While I was succesfull realising to start the PWM signal for the LED with the touchsensor i am not able to realise a timer (in the Code: TIMER_A1_BASE) to make the duty cycle of the PWM signal time-dependent. My idea was to start the timer (like the PWM signal) as the apphandler is running and with every overflow of the counter the dutycycle should increase by 5. 
While the PWM signal is running as soon as i use the touchsensor, the timer i started in the line before doesn't seem to run. There isn't even 1 interrupt triggered to increase the duty cycle. 

Now my Question is: Did I falsely generate the timer or is the any issue with the interrupt? 

My Code:



#include
<msp430.h>                      // Generic MSP430 Device Include

#include"driverlib.h"                   // MSPWare Driver Library

#include"captivate.h"                   // CapTIvate Touch Software Library

#include"CAPT_App.h"                    // CapTIvate Application Code

#include"CAPT_BSP.h"                    // CapTIvate EVM Board Support Package

#include"timer_a.h"

#include"timer_b.h"

#define TIMER_A_PERIOD 524

#define TIMER_B_PERIOD 1000

//#define DUTY_CYCLE 393

int DUTY_CYCLE = 250;

 

voidmain(void)

{

       //

       // Initialize the MCU

       // BSP_configureMCU() sets up the device IO and clocking

       // The global interrupt enable is set to allow peripherals

       // to wake the MCU.

       //

       WDTCTL = WDTPW | WDTHOLD;

       BSP_configureMCU();

       __bis_SR_register(GIE);

 

       //

       // Start the CapTIvate application

       //

       CAPT_appStart();

       WDT_A_hold(WDT_A_BASE);

       //WDT_B_hold(WDT_B_BASE);

       //P1.1 as PWM output

       GPIO_setAsPeripheralModuleFunctionOutputPin(

               GPIO_PORT_P1,

               GPIO_PIN1,

               GPIO_SECONDARY_MODULE_FUNCTION

       );

       //int DUTY_CYCLE = 1;

       /*

       * Disable the GPIO power-on default high-impedance mode to activate

       * previously configured port settings

       */

       PMM_unlockLPM5();

       //Generate PWM - Timer runs in Up-Down mode

       Timer_A_outputPWMParam param = {0};

       param.clockSource = TIMER_A_CLOCKSOURCE_SMCLK;

       param.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_1;

       param.timerPeriod = TIMER_A_PERIOD;

       param.compareRegister = TIMER_A_CAPTURECOMPARE_REGISTER_1;

       param.compareOutputMode = TIMER_A_OUTPUTMODE_RESET_SET;

       //param.dutyCycle = DUTY_CYCLE;

 

       Timer_A_initUpModeParam paramB = {0};

       paramB.clockSource = TIMER_A_CLOCKSOURCE_ACLK;

       paramB.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_1;

       paramB.timerPeriod = TIMER_B_PERIOD;

       paramB.timerInterruptEnable_TAIE = TIMER_A_TAIE_INTERRUPT_ENABLE;

       paramB.captureCompareInterruptEnable_CCR0_CCIE = TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE;

       paramB.timerClear = TIMER_A_DO_CLEAR;

       paramB.startTimer =false;

 

 

 

       //Enter LPM0

       __bis_SR_register(LPM0_bits);

 

       // Background Loop

       //

       while(1)

       {

             //

             // Run the captivate application handler.

             // Set LED1 while the app handler is running,

             // and set LED2 if proximity is detected

             // on any sensor.

             //

             LED1_ON;

             if(CAPT_appHandler()==true)

             {

                 LED2_ON;

                 param.dutyCycle = DUTY_CYCLE;

                 Timer_A_startCounter(TIMER_A1_BASE, &paramB);

                 Timer_A_outputPWM(TIMER_A0_BASE, &param);

             }

             else

                         LED2_OFF;

                         LED1_OFF;

                         //Timer_A_stop(TIMER_A1_BASE);

 

             // This is a great place to add in any

             // background application code.

             //

             __no_operation();

 

              //

             // End of background loop iteration

             // Go to sleep if there is nothing left to do

             //

             CAPT_appSleep();

 

       } // End background loop

} // End main()

#pragma vector=TIMER0_A1_VECTOR

__interruptvoidTimer_A1 (void)

{

    if(DUTY_CYCLE < 500)

    DUTY_CYCLE= DUTY_CYCLE+5;

    else

        DUTY_CYCLE = 0;

}

RTOS/MSP432P401R: Rebuild thirty party drivers fat -> f_findfirst

$
0
0

Part Number:MSP432P401R

Tool/software:TI-RTOS

Hi,

I want to use this function: 

f_findfirst

for reading SD card.

  1. I've modified the file ffconf.h
    #define _USE_FIND 1
    /* This option switches filtered directory read feature and related functions,
    / f_findfirst() and f_findnext(). (0:Disable or 1:Enable) */

  2. In directory 
    ti/simplelink_msp432_sdk_1_40_01_00/source/third_party/fatfs

    I've run:

    ./../../../../xdctools_3_50_02_20_core/gmake -f makefile clean
    ./../../../../xdctools_3_50_02_20_core/gmake -f makefile all

    Everything is build fine.

But after running the program I still get this error:

 undefined   first referenced
  symbol         in file     
 ---------   ----------------
 f_findfirst ./sim.obj       
 f_findnext  ./sim.obj       

error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "xxx.out" not built

Is there something else I should do to rebuild the drivers?

I use simplelink 1.4.

Thank you

Miha





MSP430F5659: LED to p2.0 instead of P1.0 on TS430PZ5x100 Eval board

$
0
0

Part Number:MSP430F5659

Has anyone noticed that the LED is connected to P2.0 instead of P1.0 on the 100-pin eval board? I ordered the 100 pin eval board for the 'F5xx family from Mouser, and got a TS430PZ5x100. On the schematic, it says the LED is connected to P1.0, but it is connected to pin 17 which is P2.0 on the F5xx processors. 

Compiler/MSP430FR2532: MSP430FR2532 setting BSL signature

$
0
0

Part Number:MSP430FR2532

Tool/software: TI C/C++ Compiler

I under stand that the BSL Signature (0xFF84-0xFF87) can be set, and that if/when one wishes to use the BSL to interface to the part, one must supply a password that matches this signature.  (If I am wrong here, tell me.)  I understand that one signature (0x5555_5555) disables BSL, and other signatures erase the FRAM on a wrong password etc.  I can not determine from SLAU445G (See Table 1-5) or SLAU55I (and others) what the default signature is or how to set it, only where the signature is stored.

If my understanding above is correct, my questions is, how does one set the BSL signature in C code?  I assume it involves some compiler directive (dir-ec-tive -- shades of Wall-e) but the ones I have tired (e.g., location) were not accepted by CCS7.

(By-the-way, it appears that SLAU550I, Table 1, does not address the FR2532, but does come close.)

MSP430FR6989: Is the new Metering Test Interface (MTIF) able to measure other devices current consumption?

$
0
0

Part Number:MSP430FR6989

Hi,

I've been looking for a solution to measure current consumption of embedded systems without using a graphic interface such as Energy Trace. And I realized TI included this module (MTIF) to its User Guide, and I want to know if it is possible to use it for other devices also.

Thanks

Sara

MSP-FET: How to downgrade the FW, to force IAR to install the correct one.

$
0
0

Part Number:MSP-FET

Hi,

I recently installed IAR and MSPFlashProgrammer from Elprotronics. After connectin the MSP-FET to my computer, I launched Elprotronics SW first, and it asked if I wanted to upgrade the FET FW to match, and I chose yes, and this was my mistake :(.

Now the IAR SW will not work with the FW of the FET, however it will also not trigger the upgrade FW. I get the "can not set device voltage"/"failed to set VCC voltage" errors.

Could anyone please tell me how I can downgrade the FW to force maybe FW upgrade, or how I can upgrade the FW on the FET to work with IAR?

thank you,

Ara

additional information:

IAR version: 7.3.4

Elprotronic Flash programmer version: 3.4

I think i need my FET FW version to be 1.00.00.000

MSP430G2553: why the ADC ISR is not executed in LPM0 mode?

$
0
0

Part Number:MSP430G2553

Hello,

I have configured the GPIO P1.4 as input of the ADC10 (A4), the ADC10 executes 16 measurements on the A4 pin and the 2.5V internal voltage of  is used as reference voltage. The conversion works correctly. The problem is when entering and exiting the LPM0 mode. If before the while loop we enter LPM0 mode (__bis_SR_register (LPM0 + GIE)), the ADC10 ISR is never executed. Why? Thanks in advance.

#include <msp430g2553.h>

int ADC[16] = {0};
int avgADC = 0;
volatile int conversionFlag = 0;

int main(void) {

    WDTCTL = WDTPW | WDTHOLD;   // Stop watchdog timer
    BCSCTL1 = CALBC1_1MHZ; // Set range
    DCOCTL = CALDCO_1MHZ;

    ADC10CTL1 = CONSEQ_2 + INCH_4;                      // Repeat single channel, A4
    ADC10CTL0 = SREF_1 + REF2_5V + REFON + ADC10SHT_1 + MSC + ADC10ON + ADC10IE;   // Sample & Hold Time + ADC10 ON + Interrupt Enable
    ADC10DTC1 = 0x10;                                   // 16 conversions
    ADC10AE0 |= BIT4;                                   // P1.4 ADC option select

    ADC10CTL0 &= ~ENC;              // Disable Conversion
    while (ADC10CTL1 & BUSY);       // Wait if ADC10 busy
    ADC10SA = (int)ADC;             // Transfers data to next array
    ADC10CTL0 |= ENC + ADC10SC;     // Enable and start conversion
    __bis_SR_register(LPM0 + GIE); // Low Power Mode 0, ADC10_ISR

    while(1){
        if (conversionFlag){
            avgADC = ((ADC[0]+ADC[1]+ADC[2]+ADC[3]+ADC[4]+ADC[5]+ADC[6]+ADC[7]+
                    ADC[8]+ADC[9]+ADC[10]+ADC[11]+ADC[12]+ADC[13]+ADC[14]+ADC[15])  >> 4);

            conversionFlag = 0;
            __bis_SR_register(LPM0 + GIE);// Low Power Mode 0, ADC10_ISR
        }
    };
}

// ADC10 interrupt service routine
#pragma vector=ADC10_VECTOR
__interrupt void ADC10_ISR(void)
{
    conversionFlag = 1;
    __bic_SR_register_on_exit(CPUOFF);
}

Best regards,
Fran Martin.

Viewing all 22232 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>