Menu English Ukrainian russian Home

Free technical library for hobbyists and professionals Free technical library


ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING
Free library / Schemes of radio-electronic and electrical devices

A device for simulating the operation of a traffic light on the PIC16F84A microcontroller. Encyclopedia of radio electronics and electrical engineering

Free technical library

Encyclopedia of radio electronics and electrical engineering / Microcontrollers

Comments on the article Comments on the article

The traffic light simulation device is implemented on the PIC16F84A microcontroller. The switching circuit of the microcontroller (MK) is standard; a 32768 Hz resonator used in watches is used as a quartz resonator.

microcontroller datasheet PIC16F84A

A device for simulating the operation of a traffic light on the PIC16F84A microcontroller. traffic light diagram
(click to enlarge)

LEDs are connected to the outputs RB1..RB6 through current-limiting resistors 500 - 200 Ohm: Instead of LEDs, you can use any other lamps, but for this you need to put transistor switches or other matching devices (optorelays, optocouplers, etc.) on the microcontroller outputs

1 traffic light
RB1 - red (K1)
RB2 - yellow (W1)
RB3 - green (З1)
2 traffic light
RB4 - red (K2)
RB5 - yellow (W2)
RB6 - green (З2)

An example of compiling a program to simulate the operation of a traffic light: To compose a program, it is necessary to draw up a flowchart of work.

  1. K1 = 1, Z2 = 1
    turn on red at the first traffic light, green at the second, the rest are disabled
  2. K1 = 1, Z2 = 0,1,0,1,0,1,0,1,0,1
    red at the first traffic light continues to burn, green at the second blinks 5 times, the rest are off
  3. K1 = 1, W1 = 1, W2 = 1
    red on the first remains on, yellow on the first and second traffic lights turns on, the rest are off
  4. K2 = 1, Z1 = 1
    turn on red at the second and green at the first traffic lights, the rest are disabled
  5. K2 \u1d 1, Z0,1,0,1,0,1,0,1,0,1 \uXNUMXd XNUMX
    red at the second traffic light continues to burn, green at the first blinks 5 times, the rest are off
  6. K2 = 1, W2 = 1, W1 = 1
    red on the second continues to burn, yellow turns on at the second and first traffic lights, the rest are turned off

Program text with comments in assembler and HEX file (comments are not repeated)

A little about the program:

  1. the inclusion of red on the first and green on the second is done by copying the constant 01000010 to PortB.
    The Pause_1 subroutine serves to delay the state of the PortB pins for a time of approximately 10 seconds.
  2. For "blinking" green, the Z_1 subroutine is used, which includes two delay subroutines using bit-oriented commands (bcf PortB,6, bsf PortB,6): 1) green off 2) green on.
    Further, everything is similar.

Author: A. Kapliy, Ukraine, processor@meta.ua; Publication: cxem.net

See other articles Section Microcontrollers.

Read and write useful comments on this article.

<< Back

Latest news of science and technology, new electronics:

Machine for thinning flowers in gardens 02.05.2024

In modern agriculture, technological progress is developing aimed at increasing the efficiency of plant care processes. The innovative Florix flower thinning machine was presented in Italy, designed to optimize the harvesting stage. This tool is equipped with mobile arms, allowing it to be easily adapted to the needs of the garden. The operator can adjust the speed of the thin wires by controlling them from the tractor cab using a joystick. This approach significantly increases the efficiency of the flower thinning process, providing the possibility of individual adjustment to the specific conditions of the garden, as well as the variety and type of fruit grown in it. After testing the Florix machine for two years on various types of fruit, the results were very encouraging. Farmers such as Filiberto Montanari, who has used a Florix machine for several years, have reported a significant reduction in the time and labor required to thin flowers. ... >>

Advanced Infrared Microscope 02.05.2024

Microscopes play an important role in scientific research, allowing scientists to delve into structures and processes invisible to the eye. However, various microscopy methods have their limitations, and among them was the limitation of resolution when using the infrared range. But the latest achievements of Japanese researchers from the University of Tokyo open up new prospects for studying the microworld. Scientists from the University of Tokyo have unveiled a new microscope that will revolutionize the capabilities of infrared microscopy. This advanced instrument allows you to see the internal structures of living bacteria with amazing clarity on the nanometer scale. Typically, mid-infrared microscopes are limited by low resolution, but the latest development from Japanese researchers overcomes these limitations. According to scientists, the developed microscope allows creating images with a resolution of up to 120 nanometers, which is 30 times higher than the resolution of traditional microscopes. ... >>

Air trap for insects 01.05.2024

Agriculture is one of the key sectors of the economy, and pest control is an integral part of this process. A team of scientists from the Indian Council of Agricultural Research-Central Potato Research Institute (ICAR-CPRI), Shimla, has come up with an innovative solution to this problem - a wind-powered insect air trap. This device addresses the shortcomings of traditional pest control methods by providing real-time insect population data. The trap is powered entirely by wind energy, making it an environmentally friendly solution that requires no power. Its unique design allows monitoring of both harmful and beneficial insects, providing a complete overview of the population in any agricultural area. “By assessing target pests at the right time, we can take necessary measures to control both pests and diseases,” says Kapil ... >>

Random news from the Archive

RealSense webcams 16.11.2016

Intel RealSense technology has been advertised for a long time. Among other things, it allows you to use the Windows Hello function, that is, to log into the Windows 10 environment by recognizing the user's face. With ordinary webcams that do not have an infrared module for determining the depth of space, this function does not work, which means that it is not useful for the vast majority of users, even if they would like to use this feature.

In Japan, official sales of the Intel RealSense 3D SR300 camera have begun. Outwardly, it resembles a small copy of the Xbox Kinect and is more suitable for use with desktop systems than Kinect, which is designed for the user to be at a considerable distance from the TV to which the Microsoft game console is connected. The SR300 supports 1080p video capture at 60 frames per second.

But in addition to regular video shooting, the SR300 has an additional infrared camera and an infrared laser. Their combination allows the camera to work as a 3D scanner, as well as recognize user gestures and facial expressions. The novelty is connected to the USB 3.0 port, it is also powered from it and does not require additional adapters. The field of work for this model extends from 20 to 120 centimeters from the lenses. The SR300 is mounted either on the top edge of the monitor using a classic "clothespin", or on the included small tripod tripod.

The cost of new items is $230.

Other interesting news:

▪ No dark matter found around the sun

▪ Xigmatek Xi-3 HDT Thermal Grease

▪ Car DVD players for Russian roads

▪ Acer Aspire S7 update

▪ Aircraft model crossed the Atlantic

News feed of science and technology, new electronics

 

Interesting materials of the Free Technical Library:

▪ section of the site Videotechnique. Article selection

▪ article by the Comtesse de Segur. Famous aphorisms

▪ article What is the greenhouse effect? Detailed answer

▪ article Plitvice Lakes. Nature miracle

▪ article Hitchhiking for a cassette recorder. Encyclopedia of radio electronics and electrical engineering

▪ article The coin is rubbed into the neck. Focus Secret

Leave your comment on this article:

Name:


Email (optional):


A comment:





All languages ​​of this page

Home page | Library | Articles | Website map | Site Reviews

www.diagram.com.ua

www.diagram.com.ua
2000-2024