DOC PREVIEW
Berkeley ELENG 290Q - Lab 1

This preview shows page 1-2-3-4-5 out of 16 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1MSP430CC2500InterconnectioneZ430-RF2500Extension PinsIAR KickstartTalking with your mote over “USB”Operations on binary dataI/O port registersA steady LEDActive Waiting LoopInterruptButton-Driven Toggle Through InterruptsTimerTimer-Driven Toggle Through Timer InterruptsLab 1I/O, timers, interruptson the eZ430-RF2500Thomas WatteyneEE290Q – Spring 2010http://wsn.eecs.berkeley.edu/290Q2 MSP430•“Heart” of the eZ430-RF2500–16-bit 16MHz RISC–32kB ROM, 1kB RAM–2 Timers, USCI, 10-bit ADCs•Debug capabilities using JTAG•Low Power Operation3 CC2500•Any frequency on the 2.4-2.485GHz band–Not 802.15.4-compliant•Wake-on-radio support–Preamble sampling in hardware•47 configuration registers–Switch Tx/Rx/idle–TXBUF, RXBUF–Tx power and frequency•Follows a state machineSmartRF Studio4 Interconnection4Chip SelectClockSPI interfaceinterrupts5 eZ430-RF25002 LEDspushbuttonCC2500chip antenna26MHz crystal for radioextension portsMSP430USB programmer:• Power• Debug (JTAG) • Interface (serial)6 Extension Pins•P1: GND•P2: VCC_EXT•P3: P2.0 I/O, ACLK, OA010•P4: P2.1 I/O, Timer_A3.INCLK, SMCLK, OA0O•P5: P2.2 I/O, Timer_A3.CCI0B, Timer_A3.TA0, OA•P6: P2.3 I/O, Timer_A3.CCI1B, Timer_A3.TA1, OA•P7: P2.4 I/O, Timer_A3.TA2, OA•P8: P4.3 I/O, Timer_B3.CCI0B, Timer_B3.TB0, OA•P9: P4.4 I/O, Timer_B3.CCI1B, Timer_B3.TB1, OA•P10: P4.5 I/O, Timer_B3.TB2, OA•P11: P4.6 I/O, OA•P12: GND•P13: GDO0 I/O from the CC2500 (configurable)•P14: GDO2 I/O from the CC2500 (configurable)•P15: P3.2 I/O, UC1SOMI•P16: P3.3 I/O, UC1CLK•P17: P3.0 I/O•P18: P3.1 I/O, UC1SIMO7 IAR Kickstartproject file navigatorcompileopen files8 Talking with your mote over “USB”•Use Windows Device Manager to idenfify the COM port the eZ430-RF2500 is on•Use PuTTY to connect to that port9 Operations on binary data• A = 0b01101001•~A = 0b10010110• A |= 0b00000010 => A=0b01101011• A &=~0b00001000 => A=0b01100001• A ^= 0b10001000 => A=0b11100001• A<<2 => A=0b10100100• A>>2 => A=0b0001101010 I/O port registers•P1DIR: direction, 0=in, 1=out•P1OUT: set output•P1IN: read input11 A steady LEDled_steadyDisable watchdog timerP1.0 and P1.1 as outputP1.0=1 and P1.1=1Continue executing#include "io430.h"#include "in430.h"int main( void ){ WDTCTL = WDTPW + WDTHOLD; P1DIR |= 0x03; P1OUT |= 0x03; while(1);}12 Active Waiting Loopled_loop#include "io430.h"#include "in430.h"int main( void ){ WDTCTL = WDTPW + WDTHOLD; int i; P1DIR |= 0x03; while (1) { P1OUT ^= 0x03; for (i=0;i<10000;i++) { __no_operation(); } }}P1.0 and P1.1 as outputChange Led state (aka toggle)13 Interrupt•Interrupt only when both–General interrupt enabled in status register–Specific interrupt enabled in specific register•Interrupt Service Routine written as:#pragma vector=TIMERA0_VECTOR•ISR sometimes needs to clear an interrupt flag in a specific register14 Button-Driven Toggle Through Interruptsled_button#include "io430.h"#include "in430.h"int main( void ){ WDTCTL = WDTPW + WDTHOLD; P1DIR |= 0x03; P1DIR &= ~0x04; P1REN |= 0x04; P1IE |= 0x04; __bis_SR_register(GIE); while(1);}#pragma vector=PORT1_VECTOR__interrupt void Port_1 (void){ P1IFG &= ~0x04; P1OUT ^= 0x03;}P1.2 as inputenable resistor (for button)enable interrupt for P1.2globally enable interrupts (do this last)Executed when interrupt from P1Actual function name has no importanceClear interrupt flag (mandatory)Toggle LEDs15 Timer•A timer is a counter which–Counts in a certain way (up, down, continuous)–At every clock tick•Can be used in two ways:–Triggers interrupts when reaching a given value(compare mode)or–Records its timer value on other interrupts(capture mode)16 Timer-Driven Toggle Through Timer Interruptsled_timer#include "io430.h"#include "in430.h"int main( void ){ WDTCTL = WDTPW + WDTHOLD; P1DIR |= 0x03; TACCTL0 = CCIE; TACCR0 = 1000; TACTL = TASSEL_1 + MC_1;__bis_SR_register(GIE+LPM3_bits);}#pragma vector=TIMERA0_VECTOR__interrupt void Timer_A (void){ P1OUT ^= 0x03;}Timer_A interrupt enableCapture Compare to 1000Count following ACLKCount in up modeinterruptinterruptGlobally enable interruptlow power mode, waiting for interruptsExecuted at each Timer_A


View Full Document

Berkeley ELENG 290Q - Lab 1

Documents in this Course
Lab 1

Lab 1

16 pages

Load more
Download Lab 1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lab 1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lab 1 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?