volatile int results[5]; // variables para la interrupcion del acelerometro //Funciones del acelerometro para mandar y recibir información
|
|
- Rosanna Elliott
- 6 years ago
- Views:
Transcription
1 Anexo A. Código de programación #include <msp430.h> #include <math.h> #include "lcdlib.h" // variables para guardar informacion de los canales analógicos volatile int results[5]; // variables para la interrupcion del acelerometro unsigned char *PTxData; // Pointer to TX data unsigned char TXByteCtr; unsigned char *PRxData; // Pointer to RX data unsigned char RXByteCtr; volatile unsigned char RxBuffer[10]; //Funciones del acelerometro para mandar y recibir información unsigned int i; void transmite1(void); void transmite2(void); void transmite3(void); void transmite4(void); void setup_tx(void); void setup_rx(void); void recibe(void); //Variables para guardar datos del acelerometro int x1=0; int y1=0; int z1=0; //Coeficientes de transformación de datos del acelerometro a angulos float coex1= ; float coex2= ; float coex3= ; float coex4= ; float coey1= ; float coey2= ; float coey3=0.1875; float coey4= ;
2 //variables de ajuste int pp=0; //variables angulos acelerometro float ax; float ay; //variables ajuste sensor solar float v1[11]; float r1; float s1; float v2[11]; float r2; float s2; float v3[11]; float r3; float s3; float v4[11]; float r4; float s4; float csol=0.7005; float ctan=2.24; float fx; float fy; float sx; float sy; //Transformaciones de angulos float apx; float apy; float angp; float anga; float angp1; float apx1; float apy1; // datos a transmitir al acelerometro const unsigned char TxData1[] = 0x2D, 0x00 ; const unsigned char TxData2[] = // Table of data to transmit // Table of data to transmit
3 0x2D, 0x10 ; const unsigned char TxData3[] = 0x2D, 0x08 ; const unsigned char TxData4[] = 0x32, 0xFE ; // Table of data to transmit // Table of data to transmit int main(void) WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer //inicio LCD lcdinit(); //Inicio acelerometro setup_tx(); transmite1(); transmite2(); transmite3(); //inicio ADC P6SEL = 0x0F; // Enable A/D channel inputs ADC12CTL0 = ADC12ON+ADC12MSC+ADC12SHT0_2; // Turn on ADC12, set sampling time ADC12CTL1 = ADC12SHP+ADC12CONSEQ_1; // Use sampling timer, single sequence ADC12MCTL0 = ADC12INCH_0; // ref+=avcc, channel = A0 ADC12MCTL1 = ADC12INCH_1; // ref+=avcc, channel = A1 ADC12MCTL2 = ADC12INCH_2; // ref+=avcc, channel = A2 ADC12MCTL3 = ADC12INCH_3; ADC12MCTL4 = ADC12INCH_4+ADC12EOS; // ref+=avcc, channel = A3, end seq. ADC12IE = 0x08; // Enable ADC12IFG.3 ADC12CTL0 = ADC12ENC; // Enable conversions // primer mensaje al display
4 lcdsettext("preparando", 0, 0); lcdsettext("pantalla ", 0,1); while(1) ADC12CTL0 = ADC12SC; bis_sr_register( GIE); setup_tx(); transmite4(); setup_rx(); recibe(); // Start convn - software trigger // Enter LPM4, Enable interrupts //prepara acelerometro //recibe del acelerometro pp++; x1 = (((int)rxbuffer[1]) << 8) RxBuffer[0]; y1 = (((int)rxbuffer[3]) << 8) RxBuffer[2]; z1 = (((int)rxbuffer[5]) << 8) RxBuffer[4]; // toma de datos del sensor solar, media de resultados y transformación a tensión if (pp>2) v1[1]=v1[2]; v1[2]=v1[3]; v1[3]=v1[4]; v1[4]=v1[5]; v1[5]=v1[6]; v1[6]=v1[7]; v1[7]=v1[8]; v1[8]=v1[9]; v1[9]=v1[10]; v1[10]=results[2]; r1=(v1[1]+v1[2]+v1[3]+v1[4]+v1[5]+v1[6]+v1[7]+v1[8]+v1[9]+v1[10])/10; s1= *r ; v2[1]=v2[2]; v2[2]=v2[3]; v2[3]=v2[4]; v2[4]=v2[5]; v2[5]=v2[6]; v2[6]=v2[7]; v2[7]=v2[8];
5 v2[8]=v2[9]; v2[9]=v2[10]; v2[10]=results[1]; r2=(v2[1]+v2[2]+v2[3]+v2[4]+v2[5]+v2[6]+v2[7]+v2[8]+v2[9]+v2[10])/10; s2= *r ; v3[1]=v3[2]; v3[2]=v3[3]; v3[3]=v3[4]; v3[4]=v3[5]; v3[5]=v3[6]; v3[6]=v3[7]; v3[7]=v3[8]; v3[8]=v3[9]; v3[9]=v3[10]; v3[10]=results[4]; r3=(v3[1]+v3[2]+v3[3]+v3[4]+v3[5]+v3[6]+v3[7]+v3[8]+v3[9]+v3[10])/10; s3= *r ; v4[1]=v4[2]; v4[2]=v4[3]; v4[3]=v4[4]; v4[4]=v4[5]; v4[5]=v4[6]; v4[6]=v4[7]; v4[7]=v4[8]; v4[8]=v4[9]; v4[9]=v4[10]; v4[10]=results[0]; r4=(v4[1]+v4[2]+v4[3]+v4[4]+v4[5]+v4[6]+v4[7]+v4[8]+v4[9]+v4[10])/10; s4= *r ; // Calculo de tensiones relativas y angulos sobre ejes fx=ctan*((csol*s4+csol*s2- s1- s3)/(csol*s4+csol*s2+s1+s3)); fy=ctan*((s1- s3- csol*s4+csol*s2)/(csol*s4+csol*s2+s1+s3)); sx=atan(fx)*57.296; sy=atan(fy)*57.296; sx=- sx; sy=- sy; // Calculo angulos del acelerometro ax=coex1*x1*x1*x1+coex2*x1*x1+coex3*x1+coex4;
6 ay=coey1*y1*y1*y1+coey2*y1*y1+coey3*y1+coey4; // Ajuste de la inclinacion al sensor solar apx1=(sx- ay); apx=apx1* ; apy1=(sy- ax); apy=apy1* ; // transformacion de coordenadas angp=atan((tan(apy)/tan(apx)))*57.296; angp1=angp; if (apx1<0 && apy1<0) angp1=360- angp1; if(apx1<0 && apy1>0) angp1=- angp1; if(apx1>0 && apy1>0) angp1=180- angp1; if(apx1>0 && apy1<0) angp1=180- angp1; angp1=angp1* ; anga=- atan(cos(angp1)/tan(apx))*57.296; angp1=angp1*57.296; //muestra de resultados lcdsettext(" ", 0, 0); lcdsettext(" ", 0,1); lcdsettext("altura=", 0,0); lcdsetint(angp1, 2, 0); lcdsettext("dir", 7,0); lcdsettext("acimut=", 0,1); lcdsetint(anga, 2, 1); pp=0;
7 // Rutina de interrupcion para el conversor analogico digital #if defined( TI_COMPILER_VERSION ) defined( IAR_SYSTEMS_ICC ) #pragma vector=adc12_vector interrupt void ADC12ISR (void) #elif defined( GNUC ) void attribute ((interrupt(adc12_vector))) ADC12ISR (void) #else #error Compiler not supported! #endif switch( even_in_range(adc12iv,34)) case 0: break; // Vector 0: No interrupt case 2: break; // Vector 2: ADC overflow case 4: break; // Vector 4: ADC timing overflow case 6: break; // Vector 6: ADC12IFG0 case 8: break; // Vector 8: ADC12IFG1 case 10: break; // Vector 10: ADC12IFG2 case 12: // Vector 12: ADC12IFG3 results[0] = ADC12MEM0; // Move results, IFG is cleared results[1] = ADC12MEM1; // Move results, IFG is cleared results[2] = ADC12MEM2; // Move results, IFG is cleared results[3] = ADC12MEM3; // Move results, IFG is cleared results[4] = ADC12MEM4; // Move results, IFG is cleared // bic_sr_register_on_exit(lpm4_bits); // Exit active CPU, SET BREAKPOINT HERE case 14: break; // Vector 14: ADC12IFG4 case 16: break; // Vector 16: ADC12IFG5 case 18: break; // Vector 18: ADC12IFG6 case 20: break; // Vector 20: ADC12IFG7 case 22: break; // Vector 22: ADC12IFG8 case 24: break; // Vector 24: ADC12IFG9 case 26: break; // Vector 26: ADC12IFG10 case 28: break; // Vector 28: ADC12IFG11 case 30: break; // Vector 30: ADC12IFG12 case 32: break; // Vector 32: ADC12IFG13 case 34: break; // Vector 34: ADC12IFG14 default: break; //Rutina de interrupción para acelerometro I2C
8 #if defined( TI_COMPILER_VERSION ) defined( IAR_SYSTEMS_ICC ) #pragma vector = USCI_B1_VECTOR interrupt void USCI_B1_ISR(void) #elif defined( GNUC ) void attribute ((interrupt(usci_b1_vector))) USCI_B1_ISR (void) #else #error Compiler not supported! #endif switch( even_in_range(ucb1iv,12)) case 0: break; // Vector 0: No interrupts case 2: break; // Vector 2: ALIFG case 4: break; // Vector 4: NACKIFG case 6: break; // Vector 6: STTIFG case 8: break; // Vector 8: STPIFG case 10: // Vector 10: RXIFG RXByteCtr- - ; // Decrement RX byte counter if (RXByteCtr) *PRxData++ = UCB1RXBUF; // Move RX data to address PRxData if (RXByteCtr == 1) // Only one byte left? UCB1CTL1 = UCTXSTP; // Generate I2C stop condition else *PRxData = UCB1RXBUF; // Move final RX data to PRxData bic_sr_register_on_exit(lpm0_bits); // Exit active CPU break; case 12: // Vector 12: TXIFG if (TXByteCtr) // Check TX byte counter UCB1TXBUF = *PTxData++; // Load TX buffer TXByteCtr- - ; // Decrement TX byte counter else UCB1CTL1 = UCTXSTP; // I2C stop condition UCB1IFG &= ~UCTXIFG; // Clear USCI_B0 TX int flag bic_sr_register_on_exit(lpm0_bits); // Exit LPM0 default: break;
9 void transmite1(void) for(i=0;i<10;i++); PTxData = (unsigned char *)TxData1; TXByteCtr = sizeof TxData1; UCB1CTL1 = UCTR + UCTXSTT; bis_sr_register(lpm0_bits + GIE); no_operation(); while (UCB1CTL1 & UCTXSTP); void transmite2(void) for(i=0;i<10;i++); PTxData = (unsigned char *)TxData2;. TXByteCtr = sizeof TxData2; UCB1CTL1 = UCTR + UCTXSTT; bis_sr_register(lpm0_bits + GIE); no_operation(); while (UCB1CTL1 & UCTXSTP); void transmite3(void) for(i=0;i<10;i++); PTxData = (unsigned char *)TxData3;. TXByteCtr = sizeof TxData3; UCB1CTL1 = UCTR + UCTXSTT; bis_sr_register(lpm0_bits + GIE); no_operation(); while (UCB1CTL1 & UCTXSTP); void setup_tx(void) delay_cycles(10000); P4SEL = 0x06; // Assign I2C pins to USCI_B0 UCB1CTL1 = UCSWRST; // Enable SW reset
10 UCB1CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode UCB1CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset UCB1BR0 = 12; // fscl = SMCLK/12 = ~100kHz UCB1BR1 = 0; UCB1I2CSA = 0x53; // Slave Address is 048h UCB1CTL1 &= ~UCSWRST; // Clear SW reset, resume operation UCB1IE &= ~UCRXIE; UCB1IE = UCTXIE; // Enable TX interrupt void setup_rx(void) delay_cycles(10000); P4SEL = 0x06; // Assign I2C pins to USCI_B0 UCB1CTL1 = UCSWRST; // Enable SW reset UCB1CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode UCB1CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset UCB1BR0 = 12; // fscl = SMCLK/12 = ~100kHz UCB1BR1 = 0; UCB1I2CSA = 0x53; // Slave Address is 048h UCB1CTL1 &= ~UCSWRST; // Clear SW reset, resume operation UCB1IE &= ~UCTXIE; UCB1IE = UCRXIE; // Enable RX interrupt void recibe(void) PRxData = (unsigned char *)RxBuffer; // Start of RX buffer RXByteCtr = 6; // Load RX byte counter while (UCB1CTL1 & UCTXSTP); // Ensure stop condition got sent UCB1CTL1 = UCTXSTT; // I2C start condition bis_sr_register(lpm0_bits + GIE); // Enter LPM0, enable interrupts // Remain in LPM0 until all data // is RX'd no_operation(); // Set breakpoint >>here<< and // read out the RxBuffer buffer void transmite4(void) for(i=0;i<10;i++); // Delay required between transaction PTxData = (unsigned char *)TxData4; // TX array start address // Place breakpoint here to see each // transmit operation. TXByteCtr = sizeof TxData4; // Load TX byte counter UCB1CTL1 = UCTR + UCTXSTT; // I2C TX, start condition
11 bis_sr_register(lpm0_bits + GIE); // Enter LPM0, enable interrupts no_operation(); // Remain in LPM0 until all data // is TX'd while (UCB1CTL1 & UCTXSTP); // Ensure stop condition got sent
12 Archivo.h de la librería del display /********************************************************************* LCD Driver Functions by: Elliott Gurrola LCD Pinouts Pin 1 Ground Pin 2 VCC (+3.3 to +5V) Pin 3 Contrast adjustment Pin 4 Register Select (RS). 0: Command, 1: Data Pin 5 Read/Write (R/W). 0: Write, 1: Read constant write - > Set to GND for Pin 6 Clock (Enable). Falling edge triggered Pin 7 Bit 0 (Not used in 4- bit operation) Pin 8 Bit 1 (Not used in 4- bit operation) Pin 9 Bit 2 (Not used in 4- bit operation) Pin 10 Bit 3 (Not used in 4- bit operation) Pin 11 Bit 4 Pin 12 Bit 5 Pin 13 Bit 6 Pin 14 Bit 7 Pin 15 Backlight Anode (+)
13 Pin 16 Backlight Cathode (- ) Top level functions available - lcd_init(); - write_byte(char l); - write_string(char s[]); - write_int(int num); - gotoxy(x, y); (x, y) location (Lines and columns start at 0) - clear_lcd(); cursor to (0, 0) // Initialize LCD // Send a single character (1 byte) // Print a character string // Write an integer // Move cursor to // Clear LCD and move LCD Not important to the user: - send_cmd(char cmd); - write_nibble(char l); - void trigger_en(); // Send a command to the // Send a nibble to the LCD *** DELAY FUNCTION ASSUMES 1 MHz CLOCK *** Modified on: Apr 15, 2013 by: Luiz (Luis Carlos Ba!uelos- Chacon) Modified on: May 24, 2013 by: Elias N Jaquez
14 *********************************************************************/ #ifndef LCDLIB_H_ #define LCDLIB_H_ #include <msp430.h> #include <string.h> #include <stdio.h> // Delay Functions #define delay_ms(x) delay_cycles((long) x* 1000) #define delay_us(x) delay_cycles((long) x) // Pins #define EN #define RS #define DATA BIT1 BIT2 0x3C // Commands #define CLEAR 0x01 // Functions void lcdinit(); LCD void lcdtriggeren(); // Initialize // Trigger Enable
15 void lcdwritedata(unsigned char data); void lcdwritecmd(unsigned char cmd); void lcdclear(); void lcdsettext(char * text, int x, int y); void lcdsetint(int val, int x, int y); // Send Data (Characters) // Send Commands // Clear LCD // Write string // Write integer #endif /* LCDLIB_H_ */
16 Archivo.c de la librería del display #include "lcdlib.h" #define LOWNIB(x) P1OUT = ((P1OUT & 0xF0) + (x & 0x0F))<<2 void lcdinit() delay_ms(100); P1DIR = DATA; // Pines de salida P8DIR = EN + RS; P1OUT = 0x0C; // Start LCD lcdtriggeren(); // Send 0x03 3 times at 5ms then 100 us delay_ms(5); lcdtriggeren(); delay_ms(5); lcdtriggeren(); delay_ms(5); P1OUT = 0x08; // modo 4 bits lcdtriggeren(); delay_ms(5); lcdwritecmd(0x28); // 4- bit, 2 line, 5x8 lcdwritecmd(0x08); // Instruction Flow
17 lcdwritecmd(0x01); // Limpiar LCD lcdwritecmd(0x06); // Auto- Increment lcdwritecmd(0x0c); // Display On, No blink void lcdtriggeren() P8OUT = EN; P8OUT &= ~EN; void lcdwritedata(unsigned char data) P8OUT = RS; // Set RS to Data LOWNIB(data >> 4); // Upper nibble lcdtriggeren(); LOWNIB(data); // Lower nibble lcdtriggeren(); delay_us(50); // Delay > 47 us void lcdwritecmd(unsigned char cmd) P8OUT &= ~RS; // Set RS to Data LOWNIB(cmd >> 4); // Upper nibble lcdtriggeren(); LOWNIB(cmd); // Lower nibble
18 lcdtriggeren(); delay_ms(5); // Delay > 1.5ms void lcdsettext(char* text, int x, int y) int i; if (x < 16) x = 0x80; // Set LCD for first line write switch (y) case 1: x = 0x40; // Set LCD for second line write break; case 2: x = 0x60; // Set LCD for first line write reverse break; case 3: x = 0x20; // Set LCD for second line write reverse break; lcdwritecmd(x); i = 0; while (text[i]!= '\0') lcdwritedata(text[i]);
19 i++; void lcdsetint(int val, int x, int y) char number_string[16]; sprintf(number_string, "%d", val); // Convert the integer to character string lcdsettext(number_string, x, y); void lcdclear() lcdwritecmd(clear);
20
Interfacing CMA3000-D01 to an MSP430 ultra low-power microcontroller
Interfacing CMA3000-D01 to an MSP430 ultra low-power microcontroller 1 INTRODUCTION The objective of this document is to show how to set up SPI/I2C communication between VTI Technologies CMA3000-D01 digital
More informationInterfacing CMR3000-D01 to an MSP430 ultra low-power microcontroller
Interfacing CMR3000-D01 to an MSP430 ultra low-power microcontroller 1 INTRODUCTION The objective of this document is to show how to set up SPI/I2C communication between VTI Technologies CMR3000-D01 digital
More informationECE 492 WINTER 2015 GROUP 2. Texas Instruments MSP430-FR Bit ADC Setup Guide
APPLICATION NOTE MIKE PAPPAS ECE 492 WINTER 2015 GROUP 2 Texas Instruments MSP430-FR5969 12-Bit ADC Setup Guide March 2015 Table of Contents Preface... 3 Pin Assignments... 4 Configuring the ADC... 4 Sampling
More informationECE 492 WINTER 2015 GROUP 2. Texas Instruments MSP430-FR Bit ADC Setup Guide
APPLICATION NOTE MIKE PAPPAS ECE 492 WINTER 2015 GROUP 2 Texas Instruments MSP430-FR5969 12-Bit ADC Setup Guide March 2015 Table of Contents Preface... 3 Pin Assignments... 4 Configuring the ADC... 4 Sampling
More informationECE2049: Embedded Computing in Engineering Design C Term Spring 2018
ECE2049: Embedded Computing in Engineering Design C Term Spring 2018 Lecture #19: Using SPI The LCD Screen and DAC Reading for Today: User's Manual Ch 35, Davies 101.5, DAC datasheet Reading for Next Class:
More informationUniversity of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.
University of Texas at El Paso Electrical and Computer Engineering Department EE 3176 Laboratory for Microprocessors I Fall 2016 LAB 04 Timer Interrupts Goals: Learn about Timer Interrupts. Learn how to
More information// Conditions for 9600/4=2400 Baud SW UART, SMCLK = 1MHz #define Bitime_5 0x05*4 // ~ 0.5 bit length + small adjustment #define Bitime 13*4//0x0D
/****************************************************************************** * * * 1. Device starts up in LPM3 + blinking LED to indicate device is alive * + Upon first button press, device transitions
More informationCPE/EE 323 Introduction to Embedded Computer Systems Homework V
CPE/EE 323 Introduction to Embedded Computer Systems Homework V 1(15) 2(15) 3(25) 4(25) 5(20) Total Problem #1 (15 points) Power, Low power systems A sensor platform features a microcontroller, a sensor,
More informationIn-Depth with MSP430 s New Communication Interfaces
In-Depth with MSP430 s New Communication Interfaces Volker Rzehak MSP430 Systems Engineer Texas Instruments 2006 Texas Instruments Inc, Slide 1 Agenda USCI vs. USI Introduction to USI USI communication
More informationName: Clint Furrer Project Number: TI003 Project Description: Safety Walking Lights. Description:
Description: This project addresses the concern and problem of pedestrians walking with automotive traffic. I walk to and from a bus stop every morning and evening for work. There is usually low light
More informationECE2049: Embedded Computing in Engineering Design C Term Spring 2018 Lecture #15: More ADC Examples
ECE2049: Embedded Computing in Engineering Design C Term Spring 2018 Lecture #15: More ADC Examples Reading for Today: TI example code Reading for Next Class: Users Guide 6.2, Davies Ch 6.6-6.9 HW #4 (on
More informationECE2049: Embedded Computing in Engineering Design A Term Fall 2017 Lecture #16: Interrupts and Event Driven Code
ECE2049: Embedded Computing in Engineering Design A Term Fall 2017 Lecture #16: Interrupts and Event Driven Code Reading for Today: Example code Reading for Next Class: Review all since exam 1 HW #4 (on
More informationTwo Wire Interface (TWI) also commonly called I2C
(TWI) also commonly called I2C MSP432 I2C 2 tj MSP432 I2C ARM (AMBA Compliant) 8 bit transmission word 7/10 bit addressing Multi-master/slave modes 4 slave addresses 4 eusci-b modules 3 tj Overview 8 bit
More informationCPE 323 Introduction to Embedded Computer Systems: ADC12 and DAC12. Instructor: Dr Aleksandar Milenkovic Lecture Notes
CPE 323 Introduction to Embedded Computer Systems: ADC12 and DAC12 Instructor: Dr Aleksandar Milenkovic Lecture Notes Outline MSP430: System Architecture ADC12 Module DAC12 Module CPE 323 2 ADC12 Introduction
More informationCPE 325: Embedded Systems Laboratory Laboratory #11 Tutorial Analog-to-Digital Converter and Digital-to-Analog Converter
CPE 325: Embedded Systems Laboratory Laboratory #11 Tutorial Analog-to-Digital Converter and Digital-to-Analog Converter Aleksandar Milenković Email: milenka@uah.edu Web: http://www.ece.uah.edu/~milenka
More informationLecture (09) PIC16F84A LCD interface LCD. Dr. Ahmed M. ElShafee
Lecture (09) PIC16F84A LCD interface PIC16F84A LCD interface Assignment 01, 4 Zones fire controller board Assignment 02, automatic water tank controller Dr. Ahmed M. ElShafee ١ ٢ LCD LCD (Liquid Crystal
More informationInterrupts, Low Power Modes
Interrupts, Low Power Modes Registers Status Register Interrupts (Chapter 6 in text) A computer has 2 basic ways to react to inputs: 1) polling: The processor regularly looks at the input and reacts as
More informationAnalog Peripherals. Introduction. Objectives
Analog Peripherals Introduction In this section we ll take a look at the MSP430 analog peripherals. It s not possible in this limited amount of time to give you a complete overview of the possible analog
More informationCPE 323: MSP430 Serial Communication
CPE 323: MSP430 Serial Communication Aleksandar Milenkovic Electrical and Computer Engineering The University of Alabama in Huntsville milenka@ece.uah.edu http://www.ece.uah.edu/~milenka Outline Introduction
More informationTexas Instruments Microcontroller HOW-TO GUIDE Interfacing Keypad with MSP430F5529
Texas Instruments Microcontroller HOW-TO GUIDE Interfacing Keypad with MSP430F5529 Contents at a Glance PS PRIMER MSP430 kit... 3 Keypad... 4 Interfacing keypad... 4 Interfacing keypad with MSP430F5529...
More informationECE2049: Embedded Computing in Engineering Design C Term Spring 2018 Lecture #20: Using SPI The DAC
ECE2049: Embedded Computing in Engineering Design C Term Spring 2018 Lecture #20: Using SPI The DAC Reading for Today: Users Guide Ch 35, MCP4921, data sheet, on-line articles Reading for Next Class: Users
More informationMSP430FG4618 Programming Reference Revision 3
MSP430FG4618/F2013 Experimenter Board MSP430FG4618 Programming Reference Revision 3 George Mason University 1. CPU Registers The CPU incorporates sixteen 20-bit registers. R0, R1, R2 and R3 have dedicated
More informationC Language Programming through the ADC and the MSP430 (ESCAPE)
OpenStax-CNX module: m46087 1 C Language Programming through the ADC and the MSP430 (ESCAPE) Matthew Johnson Based on C Language Programming through the ADC and the MSP430 by Matthew Johnson This work
More information4 Degrees of Freedom MEMS Sensor Improvements
4 Degrees of Freedom MEMS Sensor Improvements Design Document Name: Xin Zhou Yue Zhang Team Dec12-09 Ang Lv Nicholas Everett Jenn Grubb Advisor: Degang Chen Client: Bee Line Company Bob Last Updated: Dec
More informationUsing peripherals on the MSP430 (if time)
Today's Plan: Announcements Review Activities 1&2 Programming in C Using peripherals on the MSP430 (if time) Activity 3 Announcements: Midterm coming on Feb 9. Will need to write simple programs in C and/or
More informationCONTENTS: Program 1 in C:
CONTENTS: 1) Program 1 in C (Blink) 2) Program 2 in C (Interrupt ) 3) ADC example 4) Addressing Modes 5) Selected Assembly instructions 6) ADC10 register descriptions Program 1 in C: /* * PHYS319 Lab3
More informationUC Berkeley EE40/100 Lab Lab 6: Microcontroller Input/Output B. Boser, etc.
UCBerkeleyEE40/100Lab Lab6:MicrocontrollerInput/Output B.Boser,etc. NAME1: NAME2: SID: SID: Microcontrollersareverymuchslimmeddowncomputers.Nodisks,novirtualmemory,nooperatingsystem.Thinkofthem justlikeothercircuitcomponentswiththeaddedbenefitofbeingconfigurablewithaprogram.becauseofthis,
More informationFall. Accelerometer RGB LED control Vishal Shah Rebel Sequeira Pratiksha Patil Pranali Dhuru Chris Blackden. George Mason University
Fall 13 Accelerometer RGB LED control Vishal Shah Rebel Sequeira Pratiksha Patil Pranali Dhuru Chris Blackden George Mason University Introduction The ECE 511 course gave us the opportunity to team up
More informationUniversity of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.
University of Texas at El Paso Electrical and Computer Engineering Department EE 3176 Laboratory for Microprocessors I Fall 2016 LAB 06 Analog to Digital Conversion Goals: Bonus: Pre Lab Questions: Display
More informationSerial Peripheral Interface (SPI) Last updated 8/7/18
Serial Peripheral Interface (SPI) Last updated 8/7/18 MSP432 SPI eusci = enhanced Universal Serial Communications Interface 2 tj MSP432 SPI ARM (AMBA Compliant) 7/8 bit transmission Master/Slave LSB/MSB
More information2.996/6.971 Biomedical Devices Design Laboratory Lecture 6: Microprocessors II
2.996/6.971 Biomedical Devices Design Laboratory Lecture 6: Microprocessors II Instructor: Dr. Hong Ma Oct. 1, 2007 Structure of MSP430 Program 1. Declarations 2. main() 1. Watch-dog timer servicing 2.
More informationLCD. Configuration and Programming
LCD Configuration and Programming Interfacing and Programming with Input/Output Device: LCD LCD (liquid crystal display) is specifically manufactured to be used with microcontrollers, which means that
More informationAuto-Alignment Laser Mirrors First Semester Report Fall Semester 2013
Auto-Alignment Laser Mirrors First Semester Report Fall Semester 2013 -Full Report- by Michael M. Rader Prepared to partially fulfill requirements for ECE401 Department of Electrical and Computer Engineering
More informationDesigning for Ultra-Low Power with MSP430
Designing for Ultra-Low Power with MSP430 Christian Hernitscheck MSP430 FAE Europe Texas Instruments 2006 Texas Instruments Inc, Slide 1 Agenda Introduction to Ultra-Low Power Looking for Ultra-Low Power
More informationLecture 5: MSP430 Interrupt
ECE342 Intro. to Embedded Systems Lecture 5: MSP430 Interrupt Ying Tang Electrical and Computer Engineering Rowan University 1 How A Computer React to Inputs? Polling: the processor regularly looks at
More informationECE2049 Homework #4 Analog-to-Digital Conversion and the ADC12 (Due Thursday 2/15/2018 to box outside AK-011 by 9 am)
ECE2049 Homework #4 Analog-to-Digital Conversion and the ADC12 (Due Thursday 2/15/2018 to box outside AK-011 by 9 am) PLEASE (NEATLY) SHOW ALL WORK! Comment all code well. Do not make the grader guess
More informationUniversal Asynchronous Receiver / Transmitter (UART)
Universal Asynchronous Receiver / Transmitter (UART) MSP432 UART 2 tj MSP432 UART ARM (AMBA Compliant) Asynchronous operation 7/8 bit transmission Master/Slave LSB/MSB first Separate RX/TX registers 4
More informationSerial Peripheral Interface (SPI)
Serial Peripheral Interface (SPI) MSP432 SPI eusci = enhanced Universal Serial Communications Interface 2 tj MSP432 SPI ARM (AMBA Compliant) 7/8 bit transmission Master/Slave LSB/MSB first Separate RX/TX
More informationUniversity of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.
University of Texas at El Paso Electrical and Computer Engineering Department EE 3176 Laboratory for Microprocessors I Fall 2016 LAB 08 UART Communication Goals: Learn about UART Communication and the
More informationThe modules in this lab room are 4 line by 16 character display modules. The data sheet/users manual for the module is posted on My.Seneca.
LCD Modules A common output display device used with low cost embedded systems is a character LCD display. The displays are available as complete modules with a standard microprocessor parallel interface.
More informationIn this module we ll take a look at the MSP430 communications modules and the protocols that can be implemented over them.
Communication Introduction In this module we ll take a look at the MSP430 communications modules and the protocols that can be implemented over them. Objectives USART USCI USI MSP430 One Day Workshop -
More information// sets the position of cursor in row and column
CODE: 1] // YES_LCD_SKETCH_10_14_12 #include //lcd(rs, E, D4, D5, D6, D7) LiquidCrystal lcd(8, 9, 4, 5, 6, 7); int numrows = 2; int numcols = 16; void setup() Serial.begin(9600); lcd.begin(numrows,
More informationEEL 4924 Electrical Engineering Design (Senior Design) Team Baudiophile. Wireless Headphones
EEL 4924 Electrical Engineering Design (Senior Design) Final Design Report 25 April 2012 Team Baudiophile Wireless Headphones Team Members: Name: Stephen Brewer Name: Eli Chen Project Abstract Our project
More information임베디드시스템기초 (# ) #11. Serial Communications 한림대학교전자공학과이선우
임베디드시스템기초 (#514115 ) #11. Serial Communications 한림대학교전자공학과이선우 Contents General Serial communications Asynchronous serial communications (UART) 2 Parallel vs. Serial 패러럴 ( 병렬 ) 데이터통신 복수의신호선을이용 ( 대개 8/16/32bit)
More informationColor 7 click. PID: MIKROE 3062 Weight: 19 g
Color 7 click PID: MIKROE 3062 Weight: 19 g Color 7 click is a very accurate color sensing Click board which features the TCS3472 color light to digital converter with IR filter, from ams. It contains
More informationTexas Instruments Mixed Signal Processor Tutorial Abstract
Texas Instruments Mixed Signal Processor Tutorial Abstract This tutorial goes through the process of writing a program that uses buttons to manipulate LEDs. One LED will be hard connected to the output
More informationAsservissement en température numérique d'une cavité ultra-stable au LPL pour le Strontium
Asservissement en température numérique d'une cavité ultra-stable au LPL pour le Strontium condition de stabilité +/- 10mK Résultas obtenus : 1mk sur la journée Compte tenu des constantes de temps d'intégration
More informationEMBEDDED HARDWARE DESIGN. Tutorial Interfacing LCD with Microcontroller /I
EMBEDDED HARDWARE DESIGN Tutorial Interfacing LCD with Microcontroller 2009-10/I LCD (Liquid Crystal Display) has become very popular option for displaying in Embedded Applications. Since they are very
More information/*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */
/*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */ /*the speed the cell which are less dense can float and the cell that are denser can sink*/ /*the user has five
More informationNetwork Embedded Systems Sensor Networks Fall Hardware. Marcus Chang,
Network Embedded Systems Sensor Networks Fall 2013 Hardware Marcus Chang, mchang@cs.jhu.edu 1 Embedded Systems Designed to do one or a few dedicated and/or specific functions Embedded as part of a complete
More informationWireless Sensor Networks (WSN)
Wireless Sensor Networks (WSN) Operating Systems M. Schölzel Operating System Tasks Traditional OS Controlling and protecting access to resources (memory, I/O, computing resources) managing their allocation
More information5xx Active & Low Power Mode Operation
5xx Active & Low Power Mode Operation 38 Lab 2: ULP Operation Lab Goals Learn ULP Best Practices Learn & understand how to configure two key modules of the 5xx to achieve ultra-low power operation. Power
More informationTimer 32. Last updated 8/7/18
Last updated 8/7/18 Basic Timer Function Delay Counter Load a value into a counter register The counter counts Down to zero (count down timer) Up from zero (count up timer) An action is triggered when
More informationCPE 325: Embedded Systems Laboratory Laboratory #7 Tutorial MSP430 Timers, Watchdog Timer, Timers A and B
CPE 325: Embedded Systems Laboratory Laboratory #7 Tutorial MSP430 Timers, Watchdog Timer, Timers A and B Aleksandar Milenković Email: milenka@uah.edu Web: http://www.ece.uah.edu/~milenka Objective This
More informationCPE 323: MSP430 Timers
CPE 323: MSP430 Timers Aleksandar Milenkovic Electrical and Computer Engineering The University of Alabama in Huntsville milenka@ece.uah.edu http://www.ece.uah.edu/~milenka Outline Watchdog Timer TimerA
More informationWhy embedded systems?
MSP430 Intro Why embedded systems? Big bang-for-the-buck by adding some intelligence to systems. Embedded Systems are ubiquitous. Embedded Systems more common as prices drop, and power decreases. Which
More informationCPE 323 Introduction to Embedded Computer Systems: MSP430 System Architecture An Overview
CPE 323 Introduction to Embedded Computer Systems: MSP430 System Architecture An Overview Aleksandar Milenkovic Electrical and Computer Engineering The University of Alabama in Huntsville milenka@ece.uah.edu
More informationTAxCTL Register
Timer_A Registers 17.3.1 TAxCTL Register Timer_Ax Control Register Figure 17-16. TAxCTL Register Reserved TASSEL ID MC Reserved TACLR TAIE TAIFG rw-(0) rw-(0) rw-(0) rw-(0) rw-(0) w-(0) rw-(0) rw-(0) 15-10
More informationLab 4: Interrupt. CS4101 Introduction to Embedded Systems. Prof. Chung-Ta King. Department of Computer Science National Tsing Hua University, Taiwan
CS4101 Introduction to Embedded Systems Lab 4: Interrupt Prof. Chung-Ta King Department of Computer Science, Taiwan Introduction In this lab, we will learn interrupts of MSP430 Handling interrupts in MSP430
More informationIn this module we ll take a look at the MSP430 communications modules and the protocols that can be implemented over them.
Communication Introduction In this module we ll take a look at the MSP430 communications modules and the protocols that can be implemented over them. Objectives USART USCI USI MSP430 One Day Workshop -
More informationECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives:
ECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives: This lab will introduce basic embedded systems programming concepts by familiarizing the user with an embedded programming
More informationDecisions II. Switch Statement. If else allows a 2 way decision Switch allows for n-way decisions
Switch Statement If else allows a 2 way decision Switch allows for n-way decisions switch(variable){ case val1: statement; case val2: statement; case val3: statement; default: statement; variable must
More informationLecture test next week
Lecture test next week Write a short program in Assembler doing. You will be given the print outs of all the assembler programs from the manual You can bring any notes you want Today: Announcements General
More informationSerial Peripheral Interface Bus SPI
Serial Peripheral Interface Bus SPI SPI Bus Developed by Motorola in the mid 1980 s Full-duplex, master-slave serial bus suited to data streaming applications for embedded systems Existing peripheral busses
More informationEL6483: Brief Overview of C Programming Language
EL6483: Brief Overview of C Programming Language EL6483 Spring 2016 EL6483 EL6483: Brief Overview of C Programming Language Spring 2016 1 / 30 Preprocessor macros, Syntax for comments Macro definitions
More informationECE2049 Homework #2 The MSP430 Architecture & Basic Digital IO (DUE Friday 9/8/17 at 4 pm in class)
ECE2049 Homework #2 The MSP430 Architecture & Basic Digital IO (DUE Friday 9/8/17 at 4 pm in class) Your homework should be neat and professional looking. You will loose points if your HW is not properly
More informationMSP430F149 P3.4/UTXD0 P3.5/URXD0 P1.5 P1.6 P1.7 MSP430F149 P1.0 P5.4 P5.3 P5.2 P5.1. Figure B-1. BSL Replicator Block Diagram
Appendix B Appendix B MSP430 BSL Replicator Author: Greg Morton, MSP430 Applications B.1 BSL Replicator Overview The BSL Replicator application, executing on a host MSP430F149 device, uses the BSL protocol
More informationECE2049: Embedded Computing in Engineering Design A Term Fall Lecture #9: Exam Review w/ Solutions
ECE2049: Embedded Computing in Engineering Design A Term Fall 2018 Lecture #9: Exam Review w/ Solutions Reading for Today: Review all reading and notes, Davies Ch 1, 2, 4,7, MSP430 User's Guide Ch 6.1,
More informationIntroduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform.
Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform www.sierraradio.net www.hamstack.com Topics Introduction Hardware options Software development HamStack project
More informationWEATHER STATION WITH SERIAL COMMUNICATION
WEATHER STATION WITH SERIAL COMMUNICATION Written by: Wenbo Ye, Xiao Qu, Carl-Wilhelm Igelström FACULTY OF ENGINEERING, LTH Digital and Analogue Projects EITF11 Contents Introduction... 2 Requirements...
More informationSupporting Information for. Simultaneous Atomic-Level Visualization and High Precision
Electronic Supplementary Material (ESI) for RSC Advances. This journal is The Royal Society of Chemistry 2017 Supporting Information for Simultaneous Atomic-Level Visualization and High Precision Photocurrent
More informationSquareWear Programming Reference 1.0 Oct 10, 2012
Content: 1. Overview 2. Basic Data Types 3. Pin Functions 4. main() and initsquarewear() 5. Digital Input/Output 6. Analog Input/PWM Output 7. Timing, Delay, Reset, and Sleep 8. USB Serial Functions 9.
More informationRANGKAIAN LENGKAP. Universitas Sumatera Utara
RANGKAIAN LENGKAP Lampiran Program /***************************************************** This program was produced by the CodeWizardAVR V1.25.8 Professional Automatic Program Generator Copyright 1998-2007
More informationADC: Analog to Digital Conversion
ECE3411 Fall 2015 Lecture 5a. ADC: Analog to Digital Conversion Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk, syed.haider}@engr.uconn.edu
More informationSystem Design Guide for Slave
System Design Guide for Slave Motor Business Unit Appliances Company 2012/2/15 Rev. 2 Page 1 Revision History Revision Date Change Description 1 2010/3/3 Initial Release 2 2012/2/15 P1 Changed title from
More informationEmprog. Quick Start Guide. Emprog ThunderBench MSP430 FAQ. Version 1.2. Nov Page 1
Emprog ThunderBench MSP430 FAQ Version 1.2 Nov 2014 Page 1 TI MSP430 General FAQ This guide is a quick overview and FAQ related to the Texas Instruments MSP430. If you have any question that is not covered
More informationLogosol Joystick Node LS-731
Features 2 and 3 axis models Travel ±20 deg Non contact hall effect joystick Mechanical MTBF 15,000,000 cycles 3 pushbuttons Up to 2 stick pushbuttons 8 LEDs Member of Logosol s distributed motion control
More informationEmbedded Systems. 3. Hardware Software Interface. Lothar Thiele. Computer Engineering and Networks Laboratory
Embedded Systems 3. Hardware Software Interface Lothar Thiele Computer Engineering and Networks Laboratory Do you Remember? 3 2 3 3 High Level Physical View 3 4 High Level Physical View 3 5 What you will
More informationMaster Thesis. Sub-Gigahertz Wireless Sensors For Monitoring Of Food Transportation. Faisal Ali Khan. Submitted by. Universität Bremen
Universität Bremen Fachbereich Physik, Elektro- und Informationstechnik Institut für Mikrosensoren, -Aktoren Und -Systeme (IMSAS) Master Thesis Sub-Gigahertz Wireless Sensors For Monitoring Of Food Transportation
More informationLab 4 Interrupts ReadMeFirst
Lab 4 Interrupts ReadMeFirst Lab Folder Content 1) ReadMeFirst 2) Interrupt Vector Table 3) Pin out Summary Objectives Understand how interrupts work Learn to program Interrupt Service Routines in C Language
More informationZigbee Development Board (Z- DB001) with Z-001 or Z-002 Module
Zigbee Development Board (Z- DB001) with Z-001 or Z-002 Module H-2 Technik UG (haftungsbescgränkt) Version Information Version Date Modified By Introduction 1.1 05.2017 Wang Release Inhalt 1. Hardware
More informationBV4218. I2C-LCD & Keypad. Product specification. December 2008 V0.a. ByVac 2006 ByVac Page 1 of 9
Product specification December 2008 V0.a ByVac 2006 ByVac Page 1 of 9 Contents 1. Introduction...3 2. Features...3 3. Electrical Specification...3 4. I2C set...4 5. The LCD Set...5 5.1. 1...5 5.2. 2...5
More informationLCDs. Embedded Systems Interfacing. 20 September 2011
20 September 2011 How Polarizers Work How work How Color Work Other Technologies Reflective Nematic (no back light) Cholesteric Liquid Crystal Organic LED/Polymer LED Vacuum Florescent Display Display
More informationC:\CYGNAL\Examples\C8051F02x\C\Edu_Board_Source_Code\Magcard.c
Magcard.c Author: Baylor Electromechanical Systems Operates on an external 18.432 MHz oscillator. Target: Cygnal Educational Development Board / C8051F020 Tool chain: KEIL C51 6.03 / KEIL EVAL C51 This
More informationThe MCU s Pulse. Internal clock or oscillator to synchronize operation. One clock cycle = 1 TOSC = 1/fOSC. t TOSC
The MCU s Pulse Internal clock or oscillator to synchronize operation V 0 t TOSC One clock cycle = 1 TOSC = 1/fOSC Clock Cycle The minimum time to perform any operation is one instruction cycle TCY 1 TCY
More informationPIXI click PID: MIKROE Weight: 28 g
PIXI click PID: MIKROE-2817 Weight: 28 g PIXI click is equipped with MAX11300 IC from Maxim Integrated, which features Maxim Integrated's versatile, proprietary PIXI technology - it is the industry's first
More informationUniversity of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.
University of Texas at El Paso Electrical and Computer Engineering Department EE 3176 Laboratory for Microprocessors I Fall 2016 LAB 03 Low Power Mode and Port Interrupts Goals: Bonus: Pre Lab Questions:
More informationEmbedded Systems and Software
Embedded Systems and Software Potpourri & Notes on Lab 2 Artist's concept of Mars Exploration Rover. Courtesy NASA Lab 2 Notes Slide 1 The AVR Assembler We use the AVRASM2 assembler that comes with AVR
More informationADC: Analog to Digital Conversion
ECE3411 Fall 2015 Lecture 5b. ADC: Analog to Digital Conversion Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk, syed.haider}@engr.uconn.edu
More informationGetting Started with the Texas Instruments ez430
1 of 6 03.01.2009 01:33 HOME Running Your Code>> Getting Started with the Texas Instruments ez430 Working with the Workbench Software Step 1: Each program needs an associated project. The project includes
More informationRecap. ANSI C Reserved Words C++ Multimedia Programming Lecture 2. Erwin M. Bakker Joachim Rijsdam
Multimedia Programming 2004 Lecture 2 Erwin M. Bakker Joachim Rijsdam Recap Learning C++ by example No groups: everybody should experience developing and programming in C++! Assignments will determine
More informationC Programming Language
C Programming Language Advantages over assembly language for microcontrollers: More portable Math functions Readability Maintainability Editing C End-of-line ignored Use line breaks/tabs/indent for readability
More informationC Language Programming, Interrupts and Timer Hardware
C Language Programming, Interrupts and Timer Hardware In this sequence of three labs, you will learn how to write simple C language programs for the MC9S12 microcontroller, and how to use interrupts and
More informationEmbedded Systems and Software. LCD Displays
Embedded Systems and Software LCD Displays Slide 1 Some Hardware Considerations Assume we want to drive an LED from a port. The AVRs can either source or sink current. Below is a configuration for sourcing.
More informationTimer1 Capture Mode:
Timer1 Capture Mode: Interrupt Description Input Conditions Enable Flag Timer 1 Trigger after N events N = 1.. 2 19 100ns to 0.52 sec RC0 TMR1CS = 1 TMR1IF Timer 1 Capture Mode 1 Timer 1 Capture Mode 2
More informationApplication Note, V1.0, Jul AP XC16x. Interfacing the XC16x Microcontroller to a Serial SPI EEPROM. Microcontrollers
Application Note, V1.0, Jul. 2006 AP16095 XC16x Interfacing the XC16x Microcontroller to a Serial SPI EEPROM Microcontrollers Edition 2006-07-10 Published by Infineon Technologies AG 81726 München, Germany
More informationArduCAM-M-2MP Camera Shield
33275-MP ArduCAM-M-2MP Camera Shield 2MP SPI Camera Hardware Application Note Rev 1.0, Mar 2015 33275-MP ArduCAM-M-2MP Hardware Application Note Table of Contents 1 Introduction... 2 2 Typical Wiring...
More informationMSP430. More on MSP430
MSP430 More on MSP430 CodeComposer TI recently launched Code Composer Essentials v3. This IDE s latest version (version 3) supports all available MSP430 devices. The new features of CCE v3 include: - Free
More informationTimers and Clocks CS4101 嵌入式系統概論. Prof. Chung-Ta King. Department of Computer Science National Tsing Hua University, Taiwan
CS4101 嵌入式系統概論 Timers and Clocks Prof. Chung-Ta King Department of Computer Science, Taiwan Materials from MSP430 Microcontroller Basics, John H. Davies, Newnes, 2008 Recall the Container Thermometer Container
More informationPCI-HPDI32A-COS User Manual
PCI-HPDI32A-COS User Manual Preliminary 8302A Whitesburg Drive Huntsville, AL 35802 Phone: (256) 880-8787 Fax: (256) 880-8788 URL: www.generalstandards.com E-mail: support@generalstandards.com User Manual
More information