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
Write a program to assist a cashier with determining correct change. The program should have one input, the number of cents to r
SCORPION-xisa [38]
```
#!/usr/local/bin/python3

import sys

coins = { "quarters" : 25, "dimes" : 10, "nickels" : 5, "pennies" : 1 }

def mkChange( balance, coin ):
    qty = balance // coins[ coin ]
    if( qty ):
        print( str( qty ) + ' ' + coin )
    return( balance % coins[ coin ] )

if( __name__ == "__main__" ):
    if( len( sys.argv ) == 2 ):
        balance = int( sys.argv[ 1 ] )
        balance = mkChange( balance, "quarters" )
        balance = mkChange( balance, "dimes" )
        balance = mkChange( balance, "nickels" )
        balance = mkChange( balance, "pennies" )
    else:
        sys.stderr.write( "\nusage: " + sys.argv[ 0 ] + " <change owed>\n" )
```


5 0
3 years ago
________ is the amount of data that can be transmitted across a transmission medium in a certain amount of time.
USPshnik [31]
The correct word here is BANDWIDTH. Bandwidth refers to the quantity of information that a connection to the internet can handle in a given time. For digital devices, the unit of bandwidth is bytes per second. For analog devices it is expressed as cycle per second or Hertz.
6 0
3 years ago
Most information security incidents will occur because of _________. Select one: a. Users who do not follow secure computing pra
nika2105 [10]

Answer:

Users who do not follow secure computing practices and procedures

Explanation:

Most data breaches that occur as a result of hacking and cyber-attacks get all the attention. However, the kind of mistakes that employees make in corporate situations can sometimes be very costly. Whether accidental or not, human error is the leading cause of most information security breaches. When you have proper policies, people working in big organizations, for instance, will know how they are to do with them. Organizations should put more effort on its employees. By ensuring that secure computing practices and procedures are followed, it will help guide the workforce more effectively.

4 0
3 years ago
What can a method do with a checked exception? Check the exception or ignore it. Return the exception to the sender or handle it
Serggg [28]

Answer:

Handle the exception in a catch block or throw the exception to the method that called this method.

Explanation:

The try and catch statements occur in pairs. The try statement allows the user to define a block of code to be tested for errors while it is being executed.

The catch statement allows the user to define a block of code to be executed, if an error occurs in the try block.

If an exception is checked by a method, the method either handles the exception in a catch block or throw the exception to the method calling it.

8 0
2 years ago
Read 2 more answers
4. All executed programs in the windows<br> environment is displayed on<br> the?
nadya68 [22]

All executed programs in the windows environment are displayed on the Windows manger.

<h3>What is a program?</h3>

In Computer programming, a program can be defined as a sequence of instructions that are written in a specific programming language and can be executed or interpreted by a computer.

The programs that are executed in the windows environment by the operating system (OS) of a computer system are generally displayed on the Windows manger and stored in the computer's main memory, which is the random access memory (RAM).

Read more on programs here: brainly.com/question/23275071

4 0
2 years ago
Other questions:
  • Wich command converts a number to a string​
    11·1 answer
  • The ____ cell on the worksheet is the one into which you can enter data.â
    15·2 answers
  • Green field county stadium is planning to conduct a circket match between two teams A and B. A large crowd is expected in the st
    13·1 answer
  • Assuming that the actual process ids of the parent and child process are 2600 and 2650 respectively, what will be printed out at
    10·1 answer
  • Choose a film you have watched, or watch a film you have wanted to. Write a film review in at least three paragraphs. Describe w
    5·1 answer
  • Why is the database management systems (dbms the heart of the database functionality?
    6·2 answers
  • What is essential to delivering a successful presentation?
    5·2 answers
  • You are implementing a new application control solution. Prior to enforcing your application whitelist, you want to monitor user
    5·1 answer
  • is there a way to send files from my PC to my iPhone? My PC’s wifi receptors are broken so it cannot connect to wifi. Is there a
    6·1 answer
  • . Write at least three benefits of using a network.​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!