Reply by Ken Bueltmann June 20, 20112011-06-20
Would it be possible to use PORT CONNECT in CCS?

On Mon, Jun 20, 2011 at 3:31 AM, Anders Lindgren wrote:

> On 2011-06-18 19:08, Saira wrote:
> > hi! i am a final year student working on project based on MSP430f5437.
> > we are tring to build a pulseoximeter following besed on the design
> > given on TI site but with a few alterations and added applications. we
> > need to check a simple C code that configures the uart, adc and the
> > timer and is used to sample the input at 1024sps and transmit the
> > samples via uart. the problem is that we cannot figure out how to
> > simulate the interrupts on the IAR workbench so that we can verify the
> > code by simulating it before verifying it by burning onto the hardware.
> > when the following code is run in the debig session the registers of the
> > timer are configured but the timer does not count. any help would be
> > extremely appreciated!
>
> Unfortunately, the IAR tools does not simulate peripheral units.
>
> If you really would like to run your system in the simulator, it is
> possible to build a model of peripheral units using advanced breakpoints
> and the C-SPY macro system.
>
> However, as this is not an easy task, I would recommend that you use
> real hardware to debug the low-level parts of your application and use
> the simulator for higher-level verification (whenever it's possible to
> use stubs instead of the real functions).
>
> On the other hand, I would like to point out that unlike TI's own tools,
> IAR do come with a simulator.
> While we're on the subject of simulating peripheral units -- I've always
> thought that it would be a perfect community project to implement macro
> modules for simulating peripheral units. I'm sure many of you has put
> together macros for some modules, all that is needed to do is to share
> them between each other.
>
> -- Anders Lindgren, IAR Systems
> --
> Disclaimer: Opinions expressed in this posting are strictly my own and
> not necessarily those of my employer.
>
>

Beginning Microcontrollers with the MSP430

Reply by Anders Lindgren June 20, 20112011-06-20
On 2011-06-18 19:08, Saira wrote:
> hi! i am a final year student working on project based on MSP430f5437.
> we are tring to build a pulseoximeter following besed on the design
> given on TI site but with a few alterations and added applications. we
> need to check a simple C code that configures the uart, adc and the
> timer and is used to sample the input at 1024sps and transmit the
> samples via uart. the problem is that we cannot figure out how to
> simulate the interrupts on the IAR workbench so that we can verify the
> code by simulating it before verifying it by burning onto the hardware.
> when the following code is run in the debig session the registers of the
> timer are configured but the timer does not count. any help would be
> extremely appreciated!

Unfortunately, the IAR tools does not simulate peripheral units.

If you really would like to run your system in the simulator, it is
possible to build a model of peripheral units using advanced breakpoints
and the C-SPY macro system.

However, as this is not an easy task, I would recommend that you use
real hardware to debug the low-level parts of your application and use
the simulator for higher-level verification (whenever it's possible to
use stubs instead of the real functions).

On the other hand, I would like to point out that unlike TI's own tools,
IAR do come with a simulator.
While we're on the subject of simulating peripheral units -- I've always
thought that it would be a perfect community project to implement macro
modules for simulating peripheral units. I'm sure many of you has put
together macros for some modules, all that is needed to do is to share
them between each other.

-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.

Reply by Saira June 19, 20112011-06-19
hi! i am a final year student working on project based on MSP430f5437. we are tring to build a pulseoximeter following besed on the design given on TI site but with a few alterations and added applications. we need to check a simple C code that configures the uart, adc and the timer and is used to sample the input at 1024sps and transmit the samples via uart. the problem is that we cannot figure out how to simulate the interrupts on the IAR workbench so that we can verify the code by simulating it before verifying it by burning onto the hardware. when the following code is run in the debig session the registers of the timer are configured but the timer does not count. any help would be extremely appreciated!

include "msp430x54x.h"
unsigned char temp[20];
unsigned int count = 0;
unsigned int led=0; //variable to identify which led should be on
//when led is 0 switch RED led ON
//When led is 1 switch IR LED ON

//volatile unsigned char red;
//volatile unsigned char IR;

void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT

//configure I/O ports
P1DIR = 0xFF; //configure port 1 as output
P1OUT = 0x00; //both leds off
//P1.0 is for RED LED
//P1.2 is for IR LED

///ADC SETTINGS SINGLE CHANNEL SINGLE COVERSION

ADC12CTL0 = ADC12SHT0_0 + ADC12ON + ADC12REFON + ADC12REF2_5V ; // Sampling time, ADC12 on
ADC12CTL1 = ADC12SHP + ADC12SHS_1 + ADC12SSEL_1; // Use sampling timer, use ACLK as clock source,

ADC12MCTL0C12INCH_0 + ADC12SREF0;
ADC12CTL0 &= ~ADC12ENC;
ADC12IE = 0x01; // Enable interrupt

///TIMER A1 SETTINGS

TA1CTL = TASSEL_1 + TACLR;

//TA1CCTL1 = OUTMOD_2;

TA1CCR0 = 31;
//TA1CCR1 = 10;

TA1CTL |= MC_1;
TA1CTL |= TAIE;
//TA1CCTL0 |= CCIE;

//UART CONFIGURATION

P3SEL = 0x30;

UCA0CTL0=0x0000;
UCA0CTL1 |= UCSWRST + UCSSEL_2; //Select SMCLK
UCA0BR0 = 0x23;
UCA0BR1 = 0x08;
UCA0MCTL = 0x04;

P6SEL |= 0x01; // P6.0 ADC option select photodiode
P1DIR |= BIT0; // P1.0 output

__delay_cycles(10000);

__bis_SR_register(GIE); // LPM0, ADC12_ISR will force exit
while(1)
{
//ADC12CTL0 |= ADC12SC; // Start sampling/conversion

__no_operation(); // For debugger
}
}
#pragma vector = TIMER1_A1_VECTOR
__interrupt void TIMER1_A1_ISR(void)
{

if (led==0)
{
P1OUT = 0x01; // switch ON RED LED.
led=1;
}

else if (led==1)
{
P1OUT = 0x02; // switch ON IR LED.
led=1;
}

ADC12CTL0 |= ADC12ENC;
ADC12CTL0 |= ADC12SC;
// ADC12CTL0 &= ~ADC12ENC;
__bis_SR_register(GIE);
}