Write an 8051 C program to toggle bits of P1 continuously with a 250 ms delay.
Solution:
#include <reg51.h>
void MSDelay(unsigned int);
void main(void) {
while(1) { //repeat forever
P1=0x55;
MSDelay(250); //time delay
P1=0xAA;
MSDelay(250) }}
Assume the program is tested for the DS89C420 with XTML=11.0592MHz.
90ns =1275 = 114750ns = 1ms
void MSDelay(unsigned int itime) {
unsigned int i,j;
for (i=0; i<itime; i++)
for (j=0; j<1275; j++); // 1ms delay
}
Write a program to toggle pin P1.2 every second
ReplyDeletePlease solve this question.. please
Thaks for sharing the post with us. We are
ReplyDeleteMobile App Development Company in Mumbai serving around 1K+customer.
Why do we take p1= 0*55 and p1 = 0*aa
ReplyDeleteWe are giving some value to P1 port and creating some delay ,and again giving another value and delay .which will seem like toggling
DeleteWrite an assembly language for 8051 to toggle all the bits of ports 0?
ReplyDeletePlease solve this question
Write an 8051 C Program to toggle only pin P1.5 continuously every 250ms. Use Timer 0, mode 2 (8 bit auto reload to create the delay).
ReplyDeleteWrite an 8051 C Program to toggle only pin P1.5 continuously every 250ms. Use Timer 0, mode 2 (8 bit auto reload to create the delay.
ReplyDeleteWrite an 8051 C program to toggle all the bits of port p1
ReplyDeletecontinuously with some delay in between. Use Timer 0 16 bit
mode to generate the delay. Assume Timer 0 register value is
the sum of your date of date of birth in Hexadecimal