-
With c, I think about it:
1. It has something to do with hardware, do you know this?
2. Suppose the LED is connected to the P1 port. The first light is connected. The cathode is connected to IO, and the anode is connected to 5V.
#include
bitsecflag;
unsigned
charms;
voiddisplay(unsigned
charnum,unsigned
charsec)
num%=8;
p1=~(1<
8;tl0=-50000;
ms++;IF(ms>20) 12MHz, 50ms timing interrupt, 1 second timing.
It's easy to expand any of the flashing lights you want.
display(2,1);
display(1,1);
display(3,2);
display(1,2);
Just put it in while. Have fun.
-
The assembler takes the AT89C51 microcontroller as the core to design the lantern controller, and the 8-way lantern connected to the P1 port is lit up in the way shown in the figure below.
-
89c51.The P2 port controls 8 LED lights, which are cyclically shifted to the right during normal operation, and 8 LED lights flash when interrupting (INT1).
Hello dear, glad to answer for you: 89c51The P2 port controls 8 LED lights, and the cycle shifts right during normal operation, and when interrupted (INT1), the 8 LED lights flash as follows:
The positive stage of the 8 LED lamps is connected to the top of the finger shed, and the negative pole is connected to the top respectively, P1 = 0xff; (P1 port all high) P2 = 0x00; (P2 port is all low), at this time, the current flows through P1 port through the LED to P2 port, all 8 lights are lit, if P1 remains unchanged, P2 = 0xff; At this time, because the interfaces of P1 and P2 are all high, there is no voltage difference and no current, and the LEDs are all off, if you want a certain light to be lit, you can follow the 8421 rule, is the high 8 bits, is the low 8 bits 8 4 2 1 8 4 4 2 1 When P1 = 0xff; p2 = 0xfe, that is, the small light is on, the other 7 are off, p2 = 0xfe this f is 8 + 4 + 2 + 1 = 15, corresponding to the f in the hexadecimal system, the same way e = 8 + 4 + 2 + 0 = 14, spike pulse corresponds to the e in the hexadecimal system.
-
I can send it to you if you want. I have written it in C. With a countdown timer, and the time can be set through the serial port.
-
It looks like the homework assigned by the teacher.
-
It's so simple, you don't always ask you about your homework, I remember that there is a saying in the back door of our university, the market economy doesn't believe in tears.
8086 belongs to the micro process unit (MPU) and is a microprocessor. >>>More
The method of using two timers is to use the timer t0 to control the frequency and the timer t1 to control the duty cycle. The general programming idea is as follows: the t0 timer interrupt makes an i0 port output high, and starts the timer t1 in the interrupt of the timer t0, and this t1 makes the io port output low, so that changing the initial value of timer t0 can change the frequency, and changing the initial value of timer t1 can change the duty cycle. >>>More
If the timer count value is not enough, you can first set the sum number of 1, such as 1ms, and then add another number to 10 to 100ms to get the 1s time.
Scheduled interrupts, external interrupts?
The introductory course of MCU C language programming is not difficult, it is not easy to say, and the first thing to understand is to understand what these two things are when learning MCU C language? The introductory programming of single-chip microcomputer is mainly to learn C language, followed by circuit and programming language. >>>More