Using uVison: Write a C program that generates a 1 second square wave on Pin 2 Port B. Using generated signal from that Pin 2, as an input to Pin 3 Port B drive the red LED at the same rate and the Blue LED at half the rate of the Red LED.
I m writing this program for 8051 microcontroller
#include<reg51.h>
void T0M1Delay(void);
sbit mybit=P2^2;
sbit LED=P2^3;
getting input from P2^2
unsignedint i; //data type
void main(void)
{
while(1)
{
mybit=~mybit; //for generation of square wave
RLED=~RLED; //Red led as per the square wave it will be on and
off
for(i=0;i<28;i++)
{
T0M1Delay() ; //this is to provide the delay of 1 sec which is
required
}
}
BLED=~BLED; //for blue led we want half time
for(i=0;i<14;i++)
{
T0M1Delay() ;//this is to provide half the time delay
}
}
This loop should repeat 28 times to get the delay of 1 sec
void T0M1Delay(void)
{
TMOD=0×01; //timer 0 in mode 1
TL0=0×00; //load the value of TL0
TH0=0×00; //load the value of TH0
TR0=1; //start timer
while(TF0==0); //wait untill TF0 becomes 0
TR0=0;
TF0=0;
}
XTAL frequency=22MHz
so the maximum delay with this crystal frequency is 37.75ms
to get 1 sec delay we take a loop which runs 28 times
=28*35.75
=1000ms=1sec
Using uVison: Write a C program that generates a 1 second square wave on Pin 2 Port B. Using generated signal from that Pin 2, as an input to Pin 3 Port B drive the red LED at the same rate and the Bl...
Using uVison: Write a C program that generates a 1 second square wave on Pin 2 Port B. Using generated signal from that Pin 2, as an input to Pin 3 Port B drive the red LED at the same rate and the Blue LED at half the rate of the Red LED.
Using uVision: Write a 2 Port B. U inCprogram that generates a 1 second square wave on Pin sing the generated signal from that Pin 2, as an input to Pin 3 Port B. th e ed LED at the same rate and the Blue LED at half the rate of the Red LED. (Turn in your source code as Q7.c)
04. a) Write an 8051 C program to send values 00 through FFH to port Pl. b) Write an 8051 C program to send values -3 to +3 to port P1. c) Write an 8051 C program to toggle all bits of P1 (between 55H and AAH) with some delay d) A door sensor is connected to P1.1 and a buzzer to P1.7. Write an 8051 C program to monitor the sensor and when it opens (0') sound the buzzer...
Goal: To become familiar with using Port A and Port H as input ports H as an input port and port B as an output port, using dragon12-Light boards as well as to improve your programming skills.Project: Write an assembly program and a C program to do the following:When DIP switch #8 is high and #1 is low, turn on all the even numbered LEDs and let them stay on even after the switch #8 is changed to low.When DIP...
Question 3: In class we showed how to simply light up an LED on our Teensy microcontroller. In fact, the procedure is similar for all processors including a simpler 8-bit ATmega 328P (a.k.a Arduino Uno) For purposes of this exercise, let's say that the ATmega328 has 4 regular GPIO ports; A, B, C, and D, each with 8 pins. Every GPIO port has three registers (outlined in table below) PORTX: used to write output on a pin on port X...
Having trouble with an automatic traffic light program. Red LED and Yellow LED won't show. We are using a Dragon12 Plus 2 board, Code is below #include C:\Users\schwarzenbar\Desktop\hcs12.inc RED: EQU $10 ;PP4 GREEN: EQU $40 ;PP6 org $2000 movb #$FF, DDRP bset PTP, #RED bset DDRT,%00110000 ;PT4=Output for for IR Transmiter (IRTX) bclr DDRT,%00001000 ;PT3=Input pin for IR receiver (IRRX) bclr PTT,%00001000 ;PT4=0 to turn on IR...
2. Increase the period of square signal in (b) with keeping same pulse duration, as shown in the following figure То (c) A -A Ti Find the Fourier series coefficients az, as well as M7 and 8. for (c) T1=(1/4)To. Sketch the spectrum for both cases. Consider what spectrum will be if T1/To → 0. Procedures: Use the Signal Generator to generate the above signals according to the setting listed in Table I and measure the spectral from the Digital...
1=Write a program in C to get 16-bit data from Port-D and send it to ports Port-B 2-Write instructions in C to toggle both bits RD7 and RD0 continuously 3-Write instructions in C to get the status of RB2 and put it on RB0 4-Code a simple program in C to send 3499H to Port B and Port D.
3. The system represented by the block diagram below modulates the message signal x(t) with a carrier wave c(t) to yield -(). The signal y(t) is generated by multiplying z() by the carrier wave c(t). c(t) c(t) y(t) z(t) The output signal,y(t), can be written as y(t)-C() × X() x C(t). Using the properties of a) Fourier Transforms, write Yi) in terms of Cjo) and Yj). [2 points] The Fourier Transform of x(t) is illustrated below. 0.9 0.8 0.7 0.6...
Write a C++ program that takes two sets ’A’ and ’B’ as input read from the file prog1 input.txt. The first line of the file corresponds to the set ’A’ and the second line is the set ’B’. Every element of each set is a character, and the characters are separated by space. Implement algorithms for the following operations on the sets. Each of these algorithms must be in separate methods or subroutines. The output should be written in the...