Quantcast
Channel: MSP430 Technical Forums
Viewing all 2077 articles
Browse latest View live

gcc asm output for rrc absolute mode

$
0
0

I'm puzzled as to why gcc is producing code for rrc as follows:

 

    f97e: 1f 42 02 02 mov &0x0202,r15
    f982: 12 c3       clrc
    f984: 0f 10       rrc r15
    f986: 82 4f 02 02 mov r15, &0x0202
 
whereas bit set is:
 
    f96c: b2 d0 80 00 bis #128, &0x0164 ;#0x0080
    f970: 64 01 
 
 
slau144 seems to indicate that rrc supports absolute mode; am I missing something here (besides possible lost clock cycles). Why the extra mov instructions?
 
(note: for the variable at 0x202, I have tried with and without the volatile keyword and get the same result)

energia no unused fet error, ubuntu 14.04

$
0
0

So, I recently had to do a reinstall of ubuntu, and I'm unable to get energia working again with the fr5969 (wolverine). I downloaded energia, and can start it fine. Code compiles without issues. But it won't detect my board. If I go to tools > board I can select the fr5969, but tools > serial port is greyed out. When I try and upload code I get

 

MSP430_GetNumberOfUsbIfs
MSP430_GetNameOfUsbIf
No unused FET found.
 
What I've done so far: 
 
lsusb shows Bus 002 Device 008: ID 2047:0013 Texas Instruments
 
so the board is connected properly,
 
going to energia-0101E0012/hardware/tools/msp430/bin and typing ./mspdebug tilib returns
 
tilib: can't find libmsp430.so: libmsp430.so: cannot open shared object file: No such file or directory
 
even though energia just says 'no unused fet'. So, I copied energia-0101E0012/hardware/tools/msp430/bin/libmsp430.so to /usr/lib, and tried again. Now ./mspdebug tilib says
 
MSP430_GetNumberOfUsbIfs
MSP430_GetNameOfUsbIf
No unused FET found.
 
Exactly what energia was already saying, so I'm not sure if this helped or not, but I'll leave it for now. So, I typed ./mspdebug --fet-list and a bunch of stuff shows up (MSP430F1232, MSP430F2418,  MSP430F5438A, etc) but the fr5969 is not listed in there, so I'm guessing it is not supported by this version of mspdebug? Do I just need to upgrade it somehow?
 
 
EDIT:
 
All better, I just didn't have the proper permissions. Adding my user to dialout fixed this

MSP430 Part # difference

$
0
0

Hi,

 

What is the difference (last character) between part# MSP430G2553IRHB32R and MSP430G2553IRHB32T? Part# link here.

 

Is the last character designator related to package quantity/carrier or indicates some other parameter relating to device?

 

Appreciate any help.

 

Regards,

Ravi

WIZnet ioShield-L Ethernet Booster Pack

$
0
0

I came across this and had not heard anyone mention it.  http://wizwiki.net/wiki/doku.php?id=osh:ioshield-l:start

 

ioShield-L is an Ethernet BoosterPack for MSP430 LaunchPad development board(MSP-EXP430G2, TI). The ioShield-L allows a MSP430 LaunchPad board to connect to the internet. It consists of WIZ550io for ethernet connectivity and an interface board to LaunchPad.

 

 

 

 

 

 

 

 

Oversampling, averaging and getting confused.

$
0
0
I see things like 'sample the sensor 16 times then divide by 16' to reduce errors and influence caused by noise.

Is that any better than running continuous 'sample the sensor and add it to the result and divide by two'?

Problem with analogRead()

$
0
0

Hello,

 

I have the MSP-EXP430FR5969 Wolverine Launchpad (Rev 1.6) and I'm trying to read the voltage output of a LM35 temperature sensor. I went on and used adafruit's code and adapted it to the launchpad. However, I'm not getting the correct voltage values. I verified the sensor is working as I used a multimeter to measure the voltage and it is working.

 

Here's a snippet of the code

 

static uint8_t analogInPin = A7 ;
int sensorValue = 0;       
int voltage = 0;        
int temp = 0;
 
.
.
.
.
.

 

sensorValue = analogRead(analogInPin);

voltage=sensorValue*(3600/1023.0);
  temp=(voltage-500)/10.0;
  // print the results to the serial monitor:
  Serial.print("Voltage = " );                       
  Serial.print(voltage);
  Serial.print("mV \t"); 
   
  Serial.print("Temp = ");  
  Serial.print(temp);
  Serial.print("C \n"); 
 
 
All I'm getting in the serial monitor is 929mV 41 C , but the room temperature isn't 41C and the multimeter shows around 281.7mV
I even tried changing pins and it still doesn't work. Did I just fry the board?
 
Thanks a lot

Using TivaC TM4C123GXL + Energía + Ubuntu 14.04

$
0
0

Hi everyone

I recently left behind windows to emigrate to Ubuntu 14.04, but I'm in troubles, I started using energia and a tiva C tm4c123gxl on windows, I did all the instalation, and a lot of programs on windows, but I can't find a way to do so in ubuntu, I've managed from installing energia (thanks to this site), and getting rid off the "grayed "serial port" option", but when I try to upload my programs, I get:

 

Unable to open USB device: LIBUSB_ERROR_ACCESS
Unable to find any ICDI devices
 
I'd searched in a lot of forums, pages, but it's driving me crazy not to find an answer. Does anyone know what I'm missing or doing wrong? exist a forum somewhat called "getting started with energia + ubuntu +etc for dummies?" Thanks for your answers.

TLV Die record - how is it set?

$
0
0

On some series of the MSP430, as we all know, there is a chip-series-unique serial number that can made from the lot/wafer ID plus the die X & Y positions - a total of 8 bytes.

 

How are the X & Y positions & lot/wafer ID (and the other die-specific data) changed for each die - the masks can't be changed easily, so I would assume that some sort of fusible link was used that is programmed in after testing and before its sawn into individual die... are they fusible links or some other mechanism? e.g. the DS2401 uses a laser-programmed ROM.... 

 

Thanks


Listing of all booster packs?

$
0
0

Is there a resource somewhere that lists all booster packs (Both TI and third party) and cross references them to the boards they will work with?

another gcc asm mystery: extra register pushed but never used

$
0
0

Given the following C code:

static uint16_t rx_buffer = 0;

__attribute__((interrupt(TIMER0_A0_VECTOR)))
static void SoftUART_RX(void){
 register int16_t tmp = TA0CCTL0;

 TA0CCR0 += rx_ticks_per_bit;

 if(tmp & CAP){
  TA0CCR0 += rx_ticks_per_bit_2;
  tmp = 0x0100;
  TA0CCTL0 &= ~CAP;
 }
 else{
  tmp &= SCCI;
  tmp |= rx_buffer;
  tmp >>= 1;

   if(tmp & 0x1){
    /* Shift to align with byte. */
    tmp >>= 3;
    __bic_SR_register_on_exit(CPUOFF);
    TA0CCTL0 |= CAP;
   }
  }
 rx_buffer = tmp;
}

I get the following assembler

0000f92e <SoftUART_RX>:
    f92e:	0f 12       	push	r15		
    f930:	0e 12       	push	r14		
    f932:	1f 42 62 01 	mov	&0x0162,r15	
    f936:	92 52 08 02 	add	&0x0208,&0x0172	
    f93a:	72 01 
    f93c:	3f b0 00 01 	bit	#256,	r15	;#0x0100
    f940:	09 24       	jz	$+20     	;abs 0xf954
    f942:	92 52 0c 02 	add	&0x020c,&0x0172	
    f946:	72 01 
    f948:	b2 f0 ff fe 	and	#-257,	&0x0162	;#0xfeff
    f94c:	62 01 
    f94e:	3f 40 80 00 	mov	#128,	r15	;#0x0080
    f952:	10 3c       	jmp	$+34     	;abs 0xf974
    f954:	3f f0 00 04 	and	#1024,	r15	;#0x0400
    f958:	1f d2 04 02 	bis	&0x0204,r15	
    f95c:	0f 11       	rra	r15		
    f95e:	1f b3       	bit	#1,	r15	;r3 As==01
    f960:	09 24       	jz	$+20     	;abs 0xf974
    f962:	0f 11       	rra	r15		
    f964:	0f 11       	rra	r15		
    f966:	0f 11       	rra	r15		
    f968:	b1 c0 10 00 	bic	#16,	4(r1)	;#0x0010, 0x0004(r1)
    f96c:	04 00 
    f96e:	b2 d0 00 01 	bis	#256,	&0x0162	;#0x0100
    f972:	62 01 
    f974:	82 4f 04 02 	mov	r15,	&0x0204	
    f978:	3e 41       	pop	r14		
    f97a:	3f 41       	pop	r15		
    f97c:	00 13       	reti			

r14 is never used...why the push?

 

I'm using msp430-gcc 4.6.3, same flags as in my previous post.

MeArm - DIY robotic arm

bitRead() always returns 1 on LM4F120 (Launchpad stellaris)

$
0
0

Remove post, stupid error on user side....

FLASH, RAM and usage calculation

$
0
0

Suppose you have an application like SimpliciTi that says:" low memory needs(<8kB flash and 1kB RAM depending on the configuration)", you also have in your program the Petit FAT file system: "Very small RAM consumption (44 bytes work area + certain stack), Very small code size (2K-4K bytes)", finally you have some inertial sensors to calculate some angles, like in Nine-Axis Sensor Fusion Using the Direction Cosine Matrix Algorithm on the MSP430F5xx Family AppNote, where you need RAM ~ 0.75 kB, Flash ~ 11.7 kB.

Summarizing:

flash 8kB       + RAM 1 kB

flash 4kB       + RAM 44 B

flash 11.7kB  + RAM 0.75 kB

 

How do you choose the memory requirements for the microcontroller. The flash should be big enough to acomodate all the applications. Is the same case with the RAM? should I add together those values? Is the RAM used only when I'm using that particular app, for example I need 0.75kB only when I'm doing the math for the sensor fusion?

 

Thanks!

Arduino Uno, I2C cannot communicate with digitalpotentiometer~~!!!

$
0
0

I'm using AD5258 digitalpot, but my arduino cannot control it, and my program always freeze at Wire.endTransmission(); My code is quite simple, I just want to use arduino to control digitalpot so as to supply a specific voltage. I need ur help~~  Thx a lot~ :blink: 

#include <Wire.h>

int dt = 500;
byte rval = 0;
int led =13;
//boolean ledOn=LOW;


void setup()
{
  Wire.begin();
  Serial.begin(9600);
  pinMode(led,OUTPUT);
}

void loop()
{

    Wire.beginTransmission(0x18);
    Wire.write(byte(0x00));            
    Wire.write(rval);
    Wire.endTransmission();
    //ledOn=!ledOn;
    //digitalWrite(led,ledOn);
    Serial.print(" sent - ");
    Serial.println(rval,HEX);

    rval++;        // increment value
    if(rval == 64) // if reached 64th position (max)
    {
      rval = 0;    // start over from lowest value
    }
    delay(dt);
   
}

Arduino Uno, I2C cannot communicate with digitalpotentiometer~~!!!

$
0
0

I'm using AD5258 digitalpot, but my arduino cannot control it, and my program always freeze at Wire.endTransmission(); My code is quite simple, I just want to use arduino to control digitalpot so as to supply a specific voltage. I need ur help~~  Thx a lot~ :blink: 

#include <Wire.h>

int dt = 500;
byte rval = 0;
int led =13;
//boolean ledOn=LOW;


void setup()
{
  Wire.begin();
  Serial.begin(9600);
  pinMode(led,OUTPUT);
}

void loop()
{

    Wire.beginTransmission(0x18);
    Wire.write(byte(0x00));            
    Wire.write(rval);
    Wire.endTransmission();
    //ledOn=!ledOn;
    //digitalWrite(led,ledOn);
    Serial.print(" sent - ");
    Serial.println(rval,HEX);

    rval++;        // increment value
    if(rval == 64) // if reached 64th position (max)
    {
      rval = 0;    // start over from lowest value
    }
    delay(dt);
   
}

A higher performing timer UART snippet

$
0
0

This code snippet demonstrates a timer based UART running on a 1MHz G2231.

The code starts by outputting "RESET\n" and going into full duplex loopback mode.

Both the transmit and receive interrupts are processed fast enough for bidirectional communication.

 

Thanks to @Rickta59 for giving me a starting point for the assembler in SoftUART_TX.

(A few clock cycles could be shaved off SoftUART_TX

(NOTE the pin mapping for RX/TX follows the G2553 convention!)

/* If you use this code in your project or product make sure to credit the authors. */

#include <stdint.h>
#include <msp430g2231.h>

#define BAUD 9600

enum {
	/* P1 */
	P1_STATUS_LED_BIT  = BIT0
	,P1_TX = BIT2
	,P1_RX = BIT1
};

volatile uint16_t tx_char = 0;
volatile uint16_t rx_ready  = 0;

/* TODO Could use constants here for efficiency..
 * but it would be nice to design for runtime set baud rates. */
uint16_t rx_ticks_per_bit = F_CPU / BAUD;
uint16_t rx_ticks_per_bit_3_2 = 3 * F_CPU / BAUD / 2;

inline void ser_init(void){
	TA0CTL = TASSEL_2 | MC_2 | TACLR;
	TA0CCTL0 = SCS | CM_2 | CAP | CCIE;
	TA0CCTL1 = OUTMOD_0 | OUT;

	P1SEL |= P1_RX | P1_TX;
}

/* For some reason static prevents inlining... */
void xmit_char(uint16_t c){
	/* Wait for current xmit to stop. */
	while(tx_char);

	/* Start output ASAP. */
	TA0CCTL1 = OUTMOD_0;
	TA0CCR1 = TAR;
	TA0CCR1 += rx_ticks_per_bit;

	/* Add proper stop bit timing (2 bits since last one is cutoff) */
	int16_t value = c;
	value |= 0x300;

	/* Assume next bit is 0; * toggle if not.*/
	TA0CCTL1 = OUTMOD_5 | CCIE;
	if(value & 0x1)
		TA0CCTL1 ^= OUTMOD2;
	value >>= 1;
	tx_char = value;
}

__attribute__((interrupt(TIMER0_A1_VECTOR)))
void TimerUART_TX(void){
	__asm__ (
		/* Clear TAIV; only TA0.1 is enabled so no read necessary. */
		" tst &0x012e\n"

		" bis %2,%[cctl]\n"
		" add %[TICKS],%[ccr]\n"
		" rra %[tx_buf]\n"
		" jnc 3f\n"
		" bic %2,%[cctl]\n"
		"3:\n"
		" jnz 4f\n"
		" and %5,%[cctl]\n"
		"4:\n"
		:
		:
		[TICKS] "m" (rx_ticks_per_bit), /* 0 */
		[ccr] "m" (TA0CCR1),      /* 1 */
		[mod2] "i" (OUTMOD2),      /* 2 */
		[cctl] "m" (TA0CCTL1),     /* 3 */
		[tx_buf] "m" (tx_char),     /* 4 */
		"i" (~CCIE)                /* 5 */
		:
		"cc"
	);
}

__attribute__((interrupt(TIMER0_A0_VECTOR)))
void TimerUART_RX(void){
	static uint16_t rx_buffer;
	register int16_t tmp = TA0CCTL0;

	if(tmp & CAP){
		TA0CCR0 += rx_ticks_per_bit_3_2;
		tmp = 0x0100;
		TA0CCTL0 &= ~CAP;
	}
	else{
		TA0CCR0 += rx_ticks_per_bit;
		tmp &= SCCI;
		tmp |= rx_buffer;
		tmp >>= 1;

		if(tmp & 0x1){
			TA0CCTL0 |= CAP;
			__bic_SR_register_on_exit(CPUOFF);
			rx_ready = tmp;
			return;
		}
	}
	rx_buffer = tmp;
}

int main(void){
	WDTCTL = WDTPW | WDTHOLD;

	/* Set to 1 MHz. */
	BCSCTL1 = CALBC1_1MHZ;
	DCOCTL = CALDCO_1MHZ;

	/* SMCLK = DCO / DIVS = nMHz */
	/* ACLK = VLO = ~ 12 KHz */
	BCSCTL2 &= ~(DIVS_0);
	BCSCTL3 |= LFXT1S_2; 

	/* Disable external crystal. */
	P2SEL = 0;

	/* Enable RX pullup */
	P1REN = BIT1;
	P1OUT = P1_TX | P1_RX;
	P1DIR = P1_STATUS_LED_BIT | P1_TX;

	/* Set up serial. */
	ser_init();
	__eint();

	/* Test sending multiple in a row */
	xmit_char('R');
	xmit_char('E');
	xmit_char('S');
	xmit_char('E');
	xmit_char('T');
	xmit_char('\n');

	while(1){
		LPM0;

		/* Handle rx. */
		int16_t tmp = rx_ready;
		if(tmp){
			/* Shift to align with byte. */
			tmp >>= 2;
			tmp &= 0xFF;

			/* Send back received character. */
			xmit_char(tmp);

			rx_ready = 0;

			/* Toggle LED on each transmit. */
			P1OUT ^= P1_STATUS_LED_BIT;
		}
	}
}

One sketch multiple architectures

$
0
0

This is probably an FAQ but I can't find the answer anywhere - sorry.

 

I have several Launchpads, an MSP430, TM4C123 and a TM4C129. I have the same sketch that I'd like to target at each of them but since the pin names are different for each of them I need to edit the sketch repeatedly or have three different copies (well two really for the MSP/ARM types).

 

I'm guessing there's already macro defined somewhere so I could do something like:

 

#ifdef MSP430

int pin=P1_0;

#endif

 

#ifdef TM4C123 || TM4C129

int pin=PB_5;

#endif

 

....and choosing the correct board from the drop down menu in energia will set the appropriate macro.

 

Do these exist and if so where are they documented? Apologies if the answer is obvious.

 

Peter

How to work with a non official github branch in Energia

$
0
0

I have downloaded Energia for Windows.  I want to program a board with a CC430, which is not officially supported by Energia. But the code is available in github:

https://github.com/energia/Energia/tree/panstamp

The code was developed for panStamp NRG board which is based on a CC430.

I downloaded the code in my PC, and also the latest version of Energia for Windows.

I don’t know how to proceed at this point. How can I use this code from Energia.

Any help will be appreciated (tutorial, etc).

I have another doubt, I would like to program my board using TI FET430UIF. Is this possible with Energia?

 

I guess that are basic question, but I didn't find a clear answer...Thank you!

How can I write Symbols into LCD with MSP430G2553?

$
0
0
Hello guys, 
I'm building a Holter ECG, and would like put one symbol on the LCD.

Need to inform the user the level of charge that the battery has.

And I would put the battery symbol so that information was given. But I am not getting, someone can give me an example of how I can put a symbol in a particular line of lcd

"spikes" in the ultrasonic reading

$
0
0

hi, 

i'm trying to build an array of unltrasonic sensors, i'm currently using two maxbotic sensors on the msp430G2553 launchpad.

i'm switching between them using a mux (MM74HC151 multiplexer)  using ports 1.3,1.4.15  as control for the mux.

 

my problem is that the reading are'nt stable, every few cycles they "jump" to a very low (low number , as in small distance) and gradually climb back to the right value.

i'm clueless why.

ideas?

 

 

the algorithm is

i= 0 

choose sensor i

enable interrupts 

{do nothing x 5} 

measure using interrupts  sensor's PWM

disable interrupts 

send to PC using UART

i++

 

i've attached an example of a spike in both sensors

 

and the full code:

#include <msp430.h>
#include <stdint.h>
#include <stdlib.h>

static const unsigned long smclk_freq = 16000000UL; // SMCLK frequency in hertz
static const unsigned long bps = 9600UL;            // Async serial bit rate


void Outputinit();
static uint32_t upd = 0;                            // Ultrasonic Pulse Duration (500 ns resolution)
                                                    //
#pragma vector = TIMER1_A1_VECTOR                   // Timer 1A vectored interrupt
__interrupt void timer1_a1_isr(void)                //
{                                                   //
    static uint32_t rise = 0;                       // Pulse rise time
    static uint32_t fall;                           // Pulse fall time
                                                    //
    switch(TA1IV) {                                 // TA0IV must be read to reset interrupt
        case 0x02:                                  // 0x02 == CCR1 (capture/compare)
            if(TA1CCTL1 & CCI) {                    // - Rising edge
                rise = TA1CCR1;                     // Save rise time
                fall = 0;                           // Reset fall time
            } else {                                // - Falling edge
                if(rise) {                          // Make sure rising edge has occurred
                                                    // Handle possible pending overflow interrupt
                    if((TA1CTL & TAIFG) && (TA1CCR0 < 0x1000))
                        fall += TA1CCR0;            //
                    fall += TA1CCR1;                // Get fall time, add to overflow time
                    if(!upd) upd = fall - rise;     // Update time if mainline code is ready for it
                    rise = 0;                       // Clear rise time to ensure next rising edge is used
                }                                   //
            }                                       //
            break;                                  //
        case 0x0A:                                  // 0x0A == TAIFG (overflow)
            fall += TA1CCR0;                        // Update overflow time
            break;                                  //
    }                                               //
}                                                   //

void putc(const unsigned c)                         // Output single char to serial
{                                                   //
    while(!(IFG2 & UCA0TXIFG));                     // Wait for ready (not busy)
    IFG2 &= ~UCA0TXIFG;                             // Reset busy flag
    UCA0TXBUF = c;                                  // Tx char
}                                                   //
                                                    //
void puts(const char *s) { while(*s) putc(*s++); }  // Output string to serial
                                                    //
void print_u32(uint32_t n, const unsigned dp)       // Print 32 bit unsigned with optional decimal place
                                                    // 6 decimal digits (0 -> 999999)
{                                                   //
    unsigned c;                                     //
    c = '0'; while(n >= 100000UL) n -= 100000UL, ++c; putc(c);
    if(dp == 5) putc('.');                          //
    c = '0'; while(n >= 10000) n -= 10000, ++c; putc(c);
    if(dp == 4) putc('.');                          //
    c = '0'; while(n >= 1000) n -= 1000, ++c; putc(c);
    if(dp == 3) putc('.');                          //
    c = '0'; while(n >= 100) n -= 100, ++c; putc(c);
    if(dp == 2) putc('.');                          //
    c = '0'; while(n >= 10) n -= 10, ++c; putc(c);  //
    if(dp == 1) putc('.');                          //
    c = '0'; while(n) --n, ++c; putc(c);            //
}                                                   //

uint32_t ReadSensor() {
	int nop = 0;
	while (nop++ < 5) {}

	upd = 0;
	_enable_interrupts();
	while (upd == 0) {}
	void _disable_interrupts();
	return upd;
}


uint32_t ReadSensorNumber(int j) {   // chooses the j sensor and read from it
										// LSB : 1.3   MSB: 1.5



	if (j == 0) {
	 P1OUT &= 0xc7;
	 }
	else if (j== 1)
	 {
		 P1OUT &= 0xc7;
		 P1OUT |= 0x08;
	 }
	else if (j== 2)
	 {
		 P1OUT &= 0xc7;
		 P1OUT |= 0x10;
	 }
	else if (j== 3)
	 {
		 P1OUT &= 0xc7;
		 P1OUT |= 0x18;
	 }
	else if (j== 4)
	 {
		 P1OUT &= 0xc7;
		 P1OUT |= 0x20;
	 }
	else if (j== 5)
	 {
		 P1OUT &= 0xc7;
		 P1OUT |= 0x28;
	 }
	else if (j== 6)
	 {
		 P1OUT &= 0xc7;
		 P1OUT |= 0x30;
	 }
	else if (j== 7)
	  {
		 P1OUT &= 0xc7;
	 	 P1OUT |= 0x38;
	  }

	return ReadSensor();
}




void main(void)                                     //
{                                                   //
    WDTCTL = WDTPW | WDTHOLD;                       // Disable watchdog reset
    DCOCTL = 0;                                     // Run at 16 MHz
    BCSCTL1 = CALBC1_16MHZ;                         //
    DCOCTL = CALDCO_16MHZ;                          //
                                                    //
    P1DIR = BIT2;                                   // Setup GPIO
    P1SEL  = BIT1 | BIT2;                           // UART
    P1SEL2 = BIT1 | BIT2;                           //
                                                    //
    P2OUT = 0;                                      // Comperison is done on port 2.1
    P2DIR = BIT0;                                   // Timer 1 capture/compare IO
    P2SEL = BIT0 | BIT1;                            //
    P2SEL2 = 0;                                     //
                                                    //
    const unsigned long brd = (smclk_freq + (bps >> 1)) / bps; // Bit rate divisor
    UCA0CTL1 = UCSWRST;                             // Hold USCI in reset to allow configuration
    UCA0CTL0 = 0;                                   // No parity, LSB first, 8 bits, one stop bit, UART (async)
    UCA0BR1 = (brd >> 12) & 0xFF;                   // High byte of whole divisor
    UCA0BR0 = (brd >> 4) & 0xFF;                    // Low byte of whole divisor
    UCA0MCTL = ((brd << 4) & 0xF0) | UCOS16;        // Fractional divisor, oversampling mode
    UCA0CTL1 = UCSSEL_2;                            // Use SMCLK for bit rate generator, release reset
                                                    //
                                                    // Timer 1 compare 0
    TA1CCR0 = (16000000UL / (8 * 2 * 20)) - 1;      // 20 Hz (50 ms)
    TA1CCTL0 = OUTMOD_4;                            // Toggle mode
                                                    // Timer 1 capture 1
    TA1CCTL1 = CM_3 | SCS | CAP | CCIE;             // Rising and falling, sync, capture, interrupt
                                                    // Timer 1 config
    TA1CTL = TASSEL_2 | ID_3 | MC_1 | TAIE;         // SMCLK, /8, count up, overflow interrupt
                                                    //
                               // Enable interrupts


    Outputinit();								// enables the mux chooser.


    //*													THIS IS START																				**//

    int i= 0;
    uint32_t buff[8];
    while(1){

    buff[i] = 0;
    puts("     <");
    buff[i] += ReadSensorNumber(i);
    print_u32(buff[i], 0);

    puts("> 					");
    i++;
    if (i > 1) {
    	puts("\r\n");
    	i = 0;

    }


    //*													THIS IS END																				**//
    }
}






void Outputinit() {
	P1DIR |= BIT3 + BIT4 + BIT5; // Set the LEDs on P1.0, P1.6 as outputs
	P1OUT = BIT0; // Set P1.0
	return ;
}






thx

 

 

 

Attached Thumbnails

  • spike.jpg
Viewing all 2077 articles
Browse latest View live