1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Furkat [3]
3 years ago
5

2. From the listing code, please give the block of line numbers for code which are concerned with the following: A) Main functio

n initialization of values B) Main function idle loop C) Main function schedule loop has already been moved to the ISR, but give those numbers too.
Computers and Technology
1 answer:
arsen [322]3 years ago
7 0

Answer:

Complete question is:

When the C-language code is generated, -1 is used to create the initialization state for each of the Tick

functions.

The challenge is if this code is used with C++ compiler, there is an incorrect mix between integer and

the enum data types.

1. Take the generated C code, edit it, and

replace the -1 state with an enum data type state

so it will

compile properly.

2. Replace the integer notation for the call and return arguments for Tick functions where they should

also be the enum data types.

2. From the listing lines of code, please give the line numbers for code which are concerned with the

following:

A)

Main function initialization of values

B)

Main function idle loop

C)

Main function schedule loop has already been moved to the ISR, but give those numbers too.

This action is required when moving this state machine model to a C++ GUI system.

Submit the C code with the corrections made

and this is my code

/*

This code was automatically generated using the Riverside-Irvine State machine Builder tool

Version 2.8 --- 6/23/2015 16:19:15 PST

*/

#include "rims.h"

/*This code will be shared between state machines.*/

unsigned char TimerFlag = 0;

void TimerISR() {

TimerFlag = 1;

}

enum BL_States { BL_LedOff, BL_LedOn } BL_State;

TickFct_BlinkLeds() {

/*VARIABLES MUST BE DECLARED STATIC*/

/*e.g., static int x = 0;*/

/*Define user variables for this state machine here. No functions; make them global.*/

switch(BL_State) { // Transitions

case -1:

BL_State = BL_LedOff;

break;

case BL_LedOff:

if (1) {

BL_State = BL_LedOn;

}

break;

case BL_LedOn:

if (1) {

BL_State = BL_LedOff;

}

break;

default:

BL_State = BL_LedOff;

} // Transitions

switch(BL_State) { // State actions

case BL_LedOff:

B0= 0;

break;

case BL_LedOn:

B0 = 1;

break;

default: // ADD default behaviour below

break;

} // State actions

}

enum TL_States { TL_T0, TL_T1, TL_T2 } TL_State;

TickFct_ThreeLeds() {

/*VARIABLES MUST BE DECLARED STATIC*/

/*e.g., static int x = 0;*/

/*Define user variables for this state machine here. No functions; make them global.*/

switch(TL_State) { // Transitions

case -1:

TL_State = TL_T0;

break;

case TL_T0:

if (1) {

TL_State = TL_T1;

}

break;

case TL_T1:

if (1) {

TL_State = TL_T2;

}

break;

case TL_T2:

if (1) {

TL_State = TL_T0;

}

break;

default:

TL_State = TL_T0;

} // Transitions

switch(TL_State) { // State actions

case TL_T0:

B5 = 1;

B6 = 0;

B7 = 0;

break;

case TL_T1:

B5 = 0;

B6 = 1;

B7 = 0;

break;

case TL_T2:

B5 = 0;

B5 = 0;

B5 = 1;

break;

default: // ADD default behaviour below

break;

} // State actions

}

int main() {

B = 0; //Init outputs

TimerSet(1000);

TimerOn();

BL_State = -1;

TL_State = -1;

while(1) {

TickFct_BlinkLeds();

TickFct_ThreeLeds();

while (!TimerFlag);

TimerFlag = 0;

}

}

Answer is:

#include "rims.h"

/*This code will be shared between state machines.*/

unsigned char TimerFlag = 0;

void TimerISR() {

TimerFlag = 1;

}

enum BL_States { BL_LedOff, BL_LedOn, BL_LedOnOff } BL_State;

TickFct_BlinkLeds() {

/*VARIABLES MUST BE DECLARED STATIC*/

/*e.g., static int x = 0;*/

/*Define user variables for this state machine here. No functions; make them global.*/

switch(BL_State) { // Transitions

case BL_LedOnOff:

BL_State = BL_LedOff;

break;

case BL_LedOff:

if (BL_LedOn) {

BL_State = BL_LedOn;

}

break;

case BL_LedOn:

if (true) {

BL_State = BL_LedOff;

}

break;

default:

BL_State = BL_LedOff;

} // Transitions

switch(BL_State) { // State actions

case BL_LedOff:

B0= 0;

break;

case BL_LedOn:

B0 = 1;

break;

default: // ADD default behaviour below

break;

} // State actions

}

enum TL_States { TL_T0, TL_T1, TL_T2 } TL_State;

TickFct_ThreeLeds() {

/*VARIABLES MUST BE DECLARED STATIC*/

/*e.g., static int x = 0;*/

/*Define user variables for this state machine here. No functions; make them global.*/

switch(TL_State) { // Transitions

case BL_LedOnOff:

TL_State = TL_T0;

break;

case TL_T0:

if (1) {

TL_State = TL_T1;

}

break;

case TL_T1:

if (true) {

TL_State = TL_T2;

}

break;

case TL_T2:

if (true) {

TL_State = TL_T0;

}

break;

default:

TL_State = TL_T0;

} // Transitions

switch(TL_State) { // State actions

case TL_T0:

B5 = 1;

B6 = 0;

B7 = 0;

break;

case TL_T1:

B5 = 0;

B6 = 1;

B7 = 0;

break;

case TL_T2:

B5 = 0;

B5 = 0;

B5 = 1;

break;

default: // ADD default behaviour below

break;

} // State actions

}

int main() {

B = 0; //Init outputs

TimerSet(1000);

TimerOn();

BL_State = -1;

TL_State = -1;

while(1) {

TickFct_BlinkLeds();

TickFct_ThreeLeds();

while (!TimerFlag);

TimerFlag = 0;

}

}

Explanation:

You might be interested in
The part of the computer that contains the brain, or the central processing unit, also knows as the
Kamila [148]
What other name are you looking for? or pleases rephrase the question, You already have the answer in your question.




The part of the computer that contains the brain is the CPU, or Motherboard, Microprocessor. if that's what you're asking. I don't know another word for the brain of the computer.




Hope that helps!!!
7 0
2 years ago
15. You read a news article that's politically biased and not well organized. It's
kati45 [8]

You read a news article that's politically biased and not well organized. It's likely; A: A fake news

<h3>Understanding how to report a story</h3>

Let us look at each of the options given;

A: A fake news: This is a news that lacks credibility based on lack of proper research or evidence.

B: An indirect Citation; An indirect citation is when the ideas of one author are published in another author's text but then you have not read or accessed the original author's work.

C: A reliable source; This is a source that provides a thorough, well-reasoned theory, argument, discussion that is based on strong evidence.

D: A direct Citation; A direct citation is when you directly quote the exact words of an author or speaker.

Read more about reporting of a Story at; brainly.com/question/10111803

3 0
2 years ago
Write and test a Python program to find and print the largest number in a set of real (floating point) numbers. The program shou
fenix001 [56]

I can't read oooooyeaaaa

3 0
3 years ago
An application programming interface (API) is ________. A) the code the application software uses to take advantage of code writ
Lapatulllka [165]

Answer:

A) the code the application software uses to take advantage of code written by others

Explanation:

An API is a tool widely used in the development of moderm software applications, it is basically a set of protocols and routines that specifies how the software application should interact with others. It provides the interface of the communucation link for the different parts of the program. The intent of APIs is for the simplification of software development and maintenance.

7 0
3 years ago
Sami needs to decide how the fonts, colors, and images will look on her new web site. Which will help her pian her design?
shtirl [24]
Maybe a sketchbook:))))
6 0
2 years ago
Other questions:
  • Where does the term for a star network describe? A) a network for Department of Defense scientists to share data about the stars
    13·2 answers
  • the piece of hardware that contains the circuitry that processes the information coming in to the computer
    13·1 answer
  • You can use the results from a search on a database in all of these ways except to ____.
    11·2 answers
  • Object-oriented programs employ a group of techniques for handling errors called ________ handling.
    12·1 answer
  • A financially stable person is able to
    12·2 answers
  • Which ORDER BY clause causes 10 rows to be retrieved from the result set, starting with the 20th row?
    5·1 answer
  • Both the Alphabetic Index and the Tabular List must be used to locate and assign a diagnosis code in ICD-10-CM. Group of answer
    7·1 answer
  • Linda is viewing the campaign report in her Google Ads account after successfully implementing conversion tracking tags for her
    7·1 answer
  • What is the best way to show a complex data chart in word?
    6·1 answer
  • Please answer this simple (hard) question for me lol
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!