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
Using the C language, write a function that accepts two parameters: a string of characters and a single character. The function
Sav [38]

Answer:

#include <stdio.h>

void interchangeCase(char phrase[],char c){

  for(int i=0;phrase[i]!='\0';i++){

      if(phrase[i]==c){

          if(phrase[i]>='A' && phrase[i]<='Z')

              phrase[i]+=32;

          else

              phrase[i]-=32;      

      }

  }

}

int main(){

  char c1[]="Eevee";

  interchangeCase(c1,'e');

  printf("%s\n",c1);

  char c2[]="Eevee";

  interchangeCase(c2,'E');

  printf("%s\n",c2);    

}

Explanation:

  • Create a function called interchangeCase that takes the phrase and c as parameters.
  • Run a for loop that runs until the end of phrase and check whether the selected character is found or not using an if statement.
  • If the character is upper-case alphabet, change it to lower-case alphabet and otherwise do the vice versa.
  • Inside the main function, test the program and display the results.
8 0
2 years ago
Which design element involves the act of lining up objects vertically or horizontally to give a sense of order?
Nadya [2.5K]

Answer:

HHJJTFCS

Explanation:

8 0
2 years ago
What are the 3 attributes of information?
Anton [14]

As previously said, the three highly important qualities of validity, accuracy, and completeness can be expanded into the information quality of integrity.

For information to be valuable and to meet the definition of information, it must largely have the characteristics of relevance, availability, and timeliness. Accuracy, completeness, consistency, distinctiveness, and timeliness are five qualities of high-quality information. For information to be accurate and valuable, it must be of high quality. Standard attributes, commonly referred to as global attributes, work with a wide variety of elements. The essential attributes such as accesskey, class, contenteditable, contextmenu, data, dir, hidden, id, lang, style, tabindex, and title are included in them.

Learn more about information here-

brainly.com/question/5042768

#SPJ4

4 0
1 year ago
Evolution of management​
Alex Ar [27]

Answer:

Evolution of Management and Evolution of Management Science. ... Evolution of the management thought is a process that began in the earlier days of humans. It began when the man found the need to live in the groups. Then, mighty men soon organized the masses and distributed them among the groups.

Explanation:

HOPE IT HELPS

6 0
2 years ago
Read 2 more answers
Two numbers are given (numbers are entered from the keyboard). If both numbers are positive, then output their sum, if both numb
AleksAgata [21]

Answer:

The program in Python is as follows:

num1 = int(input())

num2 = int(input())

if num1 >=0 and num2 >= 0:

   print(num1+num2)

elif num1 <0 and num2 < 0:

   print(num1*num2)

else:

   if num1>=0:

       print(num1**2)

   else:

       print(num2**2)

Explanation:

This gets input for both numbers

num1 = int(input())

num2 = int(input())

If both are positive, the sum is calculated and printed

<em>if num1 >=0 and num2 >= 0:</em>

<em>    print(num1+num2)</em>

If both are negative, the products is calculated and printed

<em>elif num1 <0 and num2 < 0:</em>

<em>    print(num1*num2)</em>

If only one of them is positive

else:

Calculate and print the square of num1 if positive

<em>    if num1>=0:</em>

<em>        print(num1**2)</em>

Calculate and print the square of num2 if positive

<em>    else:</em>

<em>        print(num2**2)</em>

3 0
2 years ago
Other questions:
  • I need someone whos really good with computers to help me with some things
    12·1 answer
  • How many rows and columns does ms-excel 2007 have???
    10·1 answer
  • In your own words, explain the role of scientific investigation in the development of the Theory of Evolution.
    6·1 answer
  • Because health and safety are important in all workplaces, not just hazardous ones, what working conditions must ALL employers p
    10·2 answers
  • Which statement is used to create a file object that will append data to an existing file? BufferedWriter salesdata =
    7·2 answers
  • Assuming there are 100 million households in the US, and that each household has two HDTVs, and that each TV is used to watch 4
    15·1 answer
  • PLEASE ANSWER ASAP
    7·1 answer
  • A person you respect who offers you advice and assistance is known as a(n) _____.
    12·1 answer
  • How are web design &amp; web development different from each other?
    9·1 answer
  • What are the methods used in research methodology?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!