Question

1. Write a Program to toggle microcontroller port0 continuously. #include-reg51 .h> *prepocessor directive/ void mainC unsigned int i; *local variable/ P0-0x00; while(1) PO oxff, for(i-0 i<255;i++); PO-0x00 for(i-0;i 255;i++); /*statements

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<reg51.h>

sfr P0 = 0x00

void DelayMilliSecond(int);

void main(){

while(1){

P0=0xFF

DelayMilliSecond(500);

P0=0x00

DelayMilliSecond(500);

}

}

void DelayMilliSecond(int ms)

{

int i,j;

for(i = 0 ;i<ms;i++){

for(j=0;j<1200;j++);

}

}

Add a comment
Know the answer?
Add Answer to:
1. Write a Program to toggle microcontroller port0 continuously. #include-reg51 .h> *prepocessor directive/ void mainC unsigned...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • #include "stdio.h" #include <iostream> int main() { unsigned char var1 = 4; unsigned short int var2...

    #include "stdio.h" #include <iostream> int main() { unsigned char var1 = 4; unsigned short int var2 = 255; unsigned short int var3 = 16; unsigned int var4 = 1; asm_ MOV AL, var1; MOV AX, var2; MOV AX, var3; MOV EBX, var4; MOVZX ECX, AX; What is the hexadecimal value of BX?

  • In C, thanks. #include <stdio.h> void set-flag (unsigned int* flag-holder , int flag-position); void unset-flag (unsigned...

    In C, thanks. #include <stdio.h> void set-flag (unsigned int* flag-holder , int flag-position); void unset-flag (unsigned int * flag-holder, int flag-position); int check-flag (unsigned int flag-holder , int flag-position); void display -32_flags (unsigned int flag-holder); int main(int argc, char* argv (1) unsigned int flag -holder = 0; set-flag (& flag-holder, 3); set-flag (& flag-holder, 16); set-flag (& flag-holder, 31); display-32-flags (flag-holder); unset-flag(& flag-holder , 31); unset-flag (& flag-holder, 3); set-flag (& flag-holder , 9); display-32-flags (flag-holder ); return 0; Write...

  • computers. 1. How many times will this loop repeat? include <stdlib.h> #include <stdio.h> void main(void) int...

    computers. 1. How many times will this loop repeat? include <stdlib.h> #include <stdio.h> void main(void) int 10 for(= 0; i < 101) printf("d", 1); A. 10 times B. 1 time C. It will run forever D. 0 times 2. What will be the output of this program? #include <stdlib.h> #include <stdio.h> int main() int a = 100, b = 200, C = 300; if(!a >= 500) b = 300; C = 400; printf("%d, 8d, &d", a, b, c); return 0;...

  • 5.43 (10 pts) What does the following program do? #include <stdio.h> 3 unsigned int mystery Cuns...

    5.43 (10 pts) What does the following program do? #include <stdio.h> 3 unsigned int mystery Cuns igned int a, unsigned int b): // function prototype 5 int main(void) printf("%s". "Enter two positive integers: unsigned int x: I/ first integer unsigned int y: // second integer scanf("Su%u". &x, &y); "); 12 13 14 15 II Parameter b must be a positive integer 16 to prevent infinite recursion 7 unsigned int mystery Cuns igned int a, unsigned int b) 18 printf("The result...

  • OPERATING SYSTWM Question 31 What is the output of this C program? #include #include void main()...

    OPERATING SYSTWM Question 31 What is the output of this C program? #include #include void main() int mptr, *cptr mptr = (int*)malloc(sizeof(int)); printf("%d", "mptr); cptr = (int)calloc(sizeof(int),1); printf("%d","cptr); garbage 0 000 O garbage segmentation fault Question 8 1 pts If this program "Hello" is run from the command line as "Hello 12 3" what is the output? (char '1'is ascii value 49. char '2' is ascii value 50 char'3' is ascii value 51): #include<stdio.h> int main (int argc, char*argv[]) int...

  • ​what is the output? Consider the following program: #include <stdio.h> #include <stdlib.h> #define size 3 void...

    ​what is the output? Consider the following program: #include <stdio.h> #include <stdlib.h> #define size 3 void func(int **a) {int tmp; for (int i = 0; i < size; i++) {for (int j = i; j < size, j++) {tmp = *(*(a+i)+j); *(*(a+i)+j) = *(*(a+j)+i); *(*(a+j)+i) = tmp;}}} int main() {int **arr = malloc(sizeof(int*) * size); for(int i = 0; i < size; i++) {arr[i] = malloc(sizeof(int) * size); for (int j = 0; j < size, j++) arr[i][j] = 2*i...

  • 6) What is the final value of variable num after executing the following statements? void Exam(int...

    6) What is the final value of variable num after executing the following statements? void Exam(int & N) A)13 ( T++ ¢ut << < 1 ) B)12 void main() (int num-10; C) 11 for (int i - 0; i < 3; i.) Exam (num). D) 10

  • XCORE Question 1 Consider the following program void Elint x, int y Y = y +...

    XCORE Question 1 Consider the following program void Elint x, int y Y = y + 1 cout<<x<<"*«y << endl; void nain) 1 int i, a13): all) = 15; a 2) - 203 a13) = 25; cout <i«"" <all) <<"" << a12) << ""« a[3] << endl; cout <i<** <all) << "" << a12) <<""« a[3] << endl; What values of the variable and array A are printed with the following rules. a parameters are passed by value bi parameters...

  • 1. 2. Find the tight bound on the run time for problem 1 and 2 void...

    1. 2. Find the tight bound on the run time for problem 1 and 2 void phone (int n) if (n <147) time +54 else { for (int 0; i< n/2; i++ time++ phone (n/3); for int i = 0; i <13*n; it+) time++ phone (2*n) 3) } void belt (int n) if (n 200) time +=700 else belt (7*n)/10) for (int i-0; i<n; i++) time++ belt (n/5) 0 i <130n; i+-10) for (int i time++ }

  • 5. What is the Big Oh method m2? public static void m2(int[] arr, int n) for...

    5. What is the Big Oh method m2? public static void m2(int[] arr, int n) for (int í = 1; í <= n- 1; i++) pM2(arr [i], arr, 0, i - 1); // end m2 private static void pM2(int entry, int[l arr, int begin, int end) int i- end; for(; (i 〉= begin) && (entry 〈 arr [i]); i--) arr [1 + 1] = arr L1] arr[i + 1] - entry; return // end pM2

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT