Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3 Simple questions at the bottom, these 4 images are where you find the relevant data. 1. Question: Explain how dereferencing the TxArray pointer allows

3 Simple questions at the bottom, these 4 images are where you find the relevant data.

image text in transcribed image text in transcribedimage text in transcribed image text in transcribed 1. Question: Explain how dereferencing the TxArray pointer allows testing the value of each

character in the array?

2. Question: Where does the TxArray pointer get incremented to the next characters?

3. Question: Why is TxArray a pointer instead of a character?

Program Flow Chart START main int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT // Stop // clock system setup bis_SR_register(SCGO); CSCTL3 | = SELREF_REFOCLK; CSCTLO = 0; CSCTLI &= -(DCORSEL_7); CSCTL1 = DCORSEL_3; CSCTL2 = FLLD_1 + 121; delay_cycles (3); _bic_SR_register(SCGO); while(CSCTL7 & (FLLUNLOCKO FLLUNLOCKI)); CSCTL4 = SELMS_DCOCLKDIV SELA_XT1CLK; CSCTL5 = DIVM1; // disable FLL // Set REFOCLK as FLL reference source // clear DCO and MOD registers // clear Dco frequency select bits first // Set DCOCLK = 8MHZ // FLLD = 1, DCODIV = 4MHz WDT Il clock system setup // enable FLL // Poll until FLL is locked // set ACLK = XT1 = 32768Hz, DCOCLK as MCLK and SMCL // SMCLK = MCLK = DCODIV/2 = 1MHz, by default PMSCTLO & -LOCKLPM5; // Disable the GPIO power-on default high-impedance mode // to activate lpreviously configured port settings // Configure UART PIDIR = BITO | BITI ; // RED = 0, GREEN = 1 PIOUT &= -(BITO | BITI); // clear Pi. Ho // wait for input /* Configure hardware UART */ // Configure UART pins PISELO = BIT4 | BIT5; // set 2-UART pin as second function P1.4 - TX P1.5 RX // Configure UART UCAOCTLWO = UCSWRST; UCAOCTLWO = UCSSEL__SMCLK; UCAOBRO = 107; // IMHz SMCLK/9600 BAUD UCAOBRI = 0x00; UCAOMCTLW = Ox1100; // | UCOS 16 | UCBRF_1; UCAOCTLWO &= -UCSWRST; UCAOIE 1= UCRXIE; // Enable USCI_A0 RX interrupt I // wait for input UARTSendArray("Waiting on input: "); // Polled ouptut, so can send W/O GIE _bis_SR_register (LPMO_bits + GIE); // Enter LPMO, interrupts enabled, wait for command } Flow chart for Program Set Up and Low Power Stand-by Interrupt Service Routine START void USCI AD ISR (void) UCAOIV UCRXIFG FO OCTXIFGFO UCSTTIFO EUCTXCPTIFG F. T T data = UCAORXBUF RxInput 0 STOP return // RXed character ISR - others unused #pragma vector=USCI_AC_VECTOR interrupt void USCI_AC_ISR(void) { // decode the UART Interrupt Vector see 21.4.12 UCAXIV Register switch (UCAOIV) { case USCI_NONE: break; case USCI_UART_UCRXIFG: data = UCAORXBUF; // read the received char - also clears Interrupt // Echo received char while( ! (UCAOIFG & UCTXIFG)); // Wait for tx buffer to be ready for new data UCAOTXBUF = data; //Echo Write the character at the location specified py the pointer RxInput(); 1/ process the received char break; case USCI_UART_UCTXIFG: 11 Tx Interrupt - unused break; case USCI_UART_UCSTTIFG: break; // unused case USCI_UART_UCTXCPTIFG: break; // unused RxInput decode received commands START RxInput () data 'R' F. E. 'G' F. 'g' E. L' E. T IT T T T Turn Turn Red LED On Turn Red LED Off Turn Green LED On Green LED off Print String Values 0-9 STOP RxInput () void RxInput() 9{ // use sprintf to prepare string for output sprintf(MyString, "Received command: % ", data); UARTSendArray (MyString); switch(data) { case 'R': { PLOUT I= BITO; } break; caser: { PLOUT &= -BITO; } break; case 'G' { PLOUT = BITI; } break; case 'g': { PLOUT &= -BITI; } break; case 'L': { int i; for (i=0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions

Question

Describe the Indian constitution and political system.

Answered: 1 week ago

Question

Explain in detail the developing and developed economy of India

Answered: 1 week ago

Question

Problem: Evaluate the integral: I = X 52+7 - 1)(x+2) dx

Answered: 1 week ago

Question

What is gravity?

Answered: 1 week ago

Question

What is the Big Bang Theory?

Answered: 1 week ago

Question

=+Where do you want to live and work?

Answered: 1 week ago

Question

=+1 Where are the best places in the world to live (and work)?

Answered: 1 week ago