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 program for the Z80 microprocessor that measures the bounce time of the relay contacts. Encyclopedia of radio electronics and electrical engineering

Free technical library

Encyclopedia of radio electronics and electrical engineering / Note to the student

Comments on the article Comments on the article

The program for the Z80 microprocessor described here, which is oriented to execution in automatic test microprocessor systems, measures the time of retracting the core of the relay and the bounce of the relay contacts, which eliminates the need for complex equipment if this standard program is used as part of test programs. The proposed program also provides sufficient measurement accuracy. The total contact closure time can be found by adding the core retraction times and relay contact bounce times.

The two-part program is executed when the relay under test is connected to a DI digital data input port that implements logic level conversion. The first part of the program, forming cycle 1, determines the time for the relay core to retract. The second part counts the bounce time of the relay contacts.

Program for microprocessor Z80, which provides measurement of relay contact bounce time
Block diagram of the program for measuring the time of rattling relay contacts (click to enlarge)

SOFTWARE FOR Z80 MICROPROCESSOR,
MEASURING RELAY CONTACT Bounce Time

Line Address B1 B2 B3 B4
1
2 ;Bounce time meter
3
4 ;This program will measure the contact bounce time and retract time
5; bending of the core. The bounce time value will be in the HL register,
6 ; and the pull-in time in the DE register.
7
8
9
10 ;TITLE "BOUNCE TIMER"
11 LIST B, X
12 NAME BOUNCE
13 ASEG
14ORG-3000H
15
16 3000 BOUNCE:
17 3000 F3 DI ; Disable interrupts
18
19 3001 21 18 FC LD HL,-TIMEOUT ;Subtract contact time from
;bounce time counter
20 3004 01 E8 03 LD SU, TIMEOUT ;Set contact time counter
21 3007 11 FF FF LD DE, -1 ;Set retract time counter
22
23 3000A ZE 07 LD A, CLOSE ;Close relay
24 3000C D3 C OUT (PORTST), A
25
26 ;Core retraction time
27
28 3000E LOOP1:
29 3000E 13 INC DE ;Increment counter
30
31 300F DB 92 IN A, (PORTIM) ;Get relay status
32 3011 FE FF CP TRUE ;Wait for first unstable
;contact closure
33 3013 20 F9 JR NZ, LOOP1 - $
34
35 ;Bounce time
36
37 3015 LOOP2:
38 3015 23 INC HL ;Increase bounce time counter
39
40 3016 DB 92 IN A, (PORTIM) ;Get relay status
41 3018 FE FF CP TRUE ;Relay status true?
42 301A C2 23 30 JP NZ, RESEIC ;If not, restore contact time counter
43
44 301D 0B DEC BC ;Decrease contact time counter
45 301E 78 LD A, B ;Set flags
46 301F Bl OR C
47 ;Run a cycle while the time counter
48 3020 20 F3 JR NZ, LOOP2- $ ; no contact = zero
49
50 3022 C9 RET ;Return, bounce time value
; in the HL register, and the pull-in time
51 ;in register DE
52
53 ;Restore contact time counter
54
55 3023 RESETC:
56 3023 01 E8 03 LD BC, TIMEOUT ;Restore contact time counter
57 3026 00 NOP ;Keep cycle time constant
58 3027 18 EU JR LOOP2-$
60
61
62 ;DATA
63
64 03EB TIMEOUT EQU 1000
65 00FF TRUE EQU 0FFH
66 0007 CLOSE EQU 07H
67 00C2 PORTST EQU 0C2H
68 0092 PORTIM EQU 92H
69 3029 END

Assembly errors pa = 0

Interrupts are disabled in order to maintain measurement accuracy in each cycle. Loop 1 (pull-in time counter) consists of counter increment and check routines. Each time through the loop, the state of the DI port is checked for the first intermittent relay contact closure. When such an effect is detected, the program measures the retraction time of the core and stores this value in the DE register. However, the true pull-in time is calculated by multiplying the contents of the DE register by 36 and dividing the result by the clock speed of the Z80 microprocessor.

Cycle 2 (relay bounce time counter) is the increment and test subroutine, and contains an additional routine to run the contact and recovery time counter. Each time through the loop, the contents of the HL register are incremented and the state of the DI port is checked. If the relay contacts are open, then a predetermined value of this time is loaded into the contact time counter. In the event of a relay contact closing, the contact time counter value is decremented until it reaches zero. When the contents of the contact time counter register is zero, the program measures the contact bounce time, and this value is stored in the HL register. However, in order to get the true bounce time, the HL register is first written with the additional binary code of the contact time value, then its contents are multiplied by 60, and the result is divided by the clock frequency of the Z80 microprocessor.

Author: Van Harris; Publication: N. Bolshakov, rf.atnn.ru

See other articles Section Note to the student.

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 you to monitor 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 insect pests and diseases," says Kapil Kumar Sharma, lead researcher on this study. ... >>

Random news from the Archive

Marvell 88EM8189 LED driver IC 14.04.2014

Marvell introduced the Marvell 88EM8189 LED driver chip, which integrates a voltage converter and an I2C interface, which allows microcontroller control of lighting with the ability to adjust the brightness from 1% to 100%.

According to the manufacturer, the presence of a built-in converter helps to reduce the number of components and provide power to the chip responsible for the network connection. This approach gives the minimum power consumption of the "smart" lamp with wireless control in standby mode.

The Marvell 88EM8189 chip is part of the Marvell Smart Lighting Platform, which includes the 88MZ100 ZigBee MCU and the 88MC200 Wi-Fi MCU, which also acts as a ZigBee-to-Wi-Fi bridge. The platform fully supports the open protocols ZigBee Home Automation (ZHA) and ZigBee Light Link (ZLL), while being accessible from mobile devices via Wi-Fi.

Other interesting news:

▪ Artificial muscle made of crystalline plastic

▪ space power plant

▪ Titan's atmosphere reproduced in the laboratory

▪ Security system to protect seafarers

▪ The first Americans were Japanese

News feed of science and technology, new electronics

 

Interesting materials of the Free Technical Library:

▪ site section Digital technology. Article selection

▪ article The legal basis for the protection of the population of Russia from emergency situations. Fundamentals of safe life

▪ article Why does blood clot? Detailed answer

▪ article Tansy pink. Legends, cultivation, methods of application

▪ article Electric motor - converter of single-phase voltage to three-phase. Encyclopedia of radio electronics and electrical engineering

▪ article Protection of microwave transistors. Encyclopedia of radio electronics and electrical engineering

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