Question

In: Computer Science

convert the code to the flow chart char counter; void wait() { delay_ms(1000); } void main()...

convert the code to the flow chart

char counter;

void wait() {

delay_ms(1000);

}

void main() {

TRISB=0x00; // set direction to be output

PORTA=0x00; // turn off the PORTA leds

PORTB=0x00; // turn off the PORTB leds

PORTC=0x00; // turn off the PORTC leds

PORTD=0x00; // turn off the PORTD leds

while (1){

for (counter = 15; counter>0 ; counter= --) {

PORTB = counter;

wait();

}

}

}

Solutions

Expert Solution

Flowchart is graphical representation of given algorithm.

Flowchart: Following symbol is used in flow chart

Use to Indicate starting and ending of Flowchart. This is oval shape.

Used to check any condition. For which there are two answer true or false.

This is diamond shapes.

Parallelograms are used to read input data and display informations.

Flow lines used to connect symbol used in flowchart and indicate direction of flows.

This shape takes two names - 'Subroutine' or 'Predefined Process'.

This allows you to write one subroutine and call it as often as you like from anywhere in the code.

The flow chart for given code is below first is for function definition in which observe carefully there is return statement no stop symbol.

And second one is main flowchart from where we call the function and perform remaining operation.

At any point if you have any query feel free ask me.


Related Solutions

Why is my C code counter returning the wrong output? void removeLn(char *tPtr) { for (;...
Why is my C code counter returning the wrong output? void removeLn(char *tPtr) { for (; *tPtr != '\0'; tPtr++) { if (*tPtr == '\n') { *tPtr = '\0'; } } } This is a method I wrote that essentially replaces the \n in a text file with a null. int counter(FILE *filePtr) { char ln[length]; int counter = 0; while (fgets(ln, length, filePtr) != NULL) { char *r;    for (r = ln; *r != '\0';) { while (isspace(*r))...
Make pesodocode of this code. void loadData() { char line[MAX_LENGTH]; const char * delimiter = ",\n";...
Make pesodocode of this code. void loadData() { char line[MAX_LENGTH]; const char * delimiter = ",\n"; FILE * fp; fp = fopen("patients.txt", "r"); char c; if (fp == NULL) { printf("file not found"); return; } while (fp != NULL) { if (fgets(line, MAX_LENGTH - 1, fp) == NULL) break; if (line[1] == '\0') break; patients[patientCount].id = atoi(strtok(line, delimiter)); strcpy(patients[patientCount].name, strtok(NULL, delimiter)); patients[patientCount].age = atoi(strtok(NULL, delimiter)); patients[patientCount].annualClaim = strtok(NULL, delimiter); patients[patientCount].plan = atoi(strtok(NULL, delimiter)); strcpy(patients[patientCount].contactNum, strtok(NULL, delimiter)); strcpy(patients[patientCount].address, strtok(NULL, delimiter)); strcpy(line,...
void main() {     Grade g1; //object for grade     char h;     cout << "enter...
void main() {     Grade g1; //object for grade     char h;     cout << "enter character" ;     cin>>h; //getting value     g1.grade(h);     g1.print();    getch(); } create an output file (named “output.txt”), and save the character to this output file. Last, close this output file
import java.util.Scanner; public class test {    public static void main(String args[]){        char letter;...
import java.util.Scanner; public class test {    public static void main(String args[]){        char letter;        int number = 0;        Scanner in = new Scanner(System.in);        System.out.print("Enter a letter: ");        letter = in.next().charAt(0);        if(letter == 'A' || letter == 'B' || letter == 'C') number = 2;        if(letter == 'D' || letter == 'E' || letter == 'F') number = 3;        if(letter == 'G' || letter ==...
convert following C++ code into MIPS assembly: int main() {                                 &
convert following C++ code into MIPS assembly: int main() {                                         int x[10], occur, count = 0;                                                              cout << "Type in array numbers:" << endl; for (int i=0; i<10; i++) // reading in integers                               { cin >> x[i];        } cout << "Type in occurrence value:" << endl;                                 cin >> occur;                                                 // Finding and printing out occurrence indexes in the array                                  cout << "Occurrences indices are:" <<...
import java.util.Scanner; public class Lab5 { public static void main(String[] args) { final char SIDE_SYMB =...
import java.util.Scanner; public class Lab5 { public static void main(String[] args) { final char SIDE_SYMB = '-'; final char MID_SYMB = '*'; Scanner scanner = new Scanner(System.in); String inputStr = ""; char choice = ' '; int numSymbols = -1, sideWidth = -1, midWidth = -1; do { displayMenu(); inputStr = scanner.nextLine(); if (inputStr.length() > 0) { choice = inputStr.charAt(0); } switch (choice) { case 'r': System.out.println("Width of the sides?"); sideWidth = scanner.nextInt(); System.out.println("Width of the middle?"); midWidth = scanner.nextInt();...
Please can you draw a flow chart for the following code : Program code for Payroll,java:...
Please can you draw a flow chart for the following code : Program code for Payroll,java: public class Payroll { public Payroll(String name,int ID,double payRate) { this.name=name; this.ID=ID; this.payRate=payRate; } private String name; private double payRate,hrWorked; private int ID; public Payroll() { name="John Doe"; ID=9999; payRate=15.0; hrWorked=40; } public String getName() { return name; } public int getID() { return ID; } public void setPayRate(int payRate) { this.payRate=payRate; } public void setHrWorked(double hrWorked) { this.hrWorked=hrWorked; } public double getPayRate() {...
Consider the following code: import java.util.Scanner; public class Main {    public static void main(String[] args)...
Consider the following code: import java.util.Scanner; public class Main {    public static void main(String[] args) {    Scanner in = new Scanner(System.in); String input = ""; System.out.println("Enter the first number: ");    input = in.nextLine(); int a = 0; int b = 0;    a = Integer.parseInt(input);    System.out.println("Enter the second number: "); input = in.nextLine();    b = Integer.parseInt(input);    int result = 0; result = a/b;    System.out.println("a/b : " + result);    } Copy the code...
The following flow chart is a bubble sort. Write the code for this sort. Make sure...
The following flow chart is a bubble sort. Write the code for this sort. Make sure you display each pass and comparison. Include comments.
I need a flow chart built in raptor and the Java source code in the source...
I need a flow chart built in raptor and the Java source code in the source folder (src) Please fully document the program: add comments to describe all major parts of the solution. SO that I can understand how and why the code was built that way. Problem specifications: -The TSA want you to design and code a program that will be used to screen travelers through AirportX. When a traveler arrives at the airport, he/she is required to go...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT