The armatures can be classified into several categories. Firstly, there are electromagnetic armatures, which operate based on the interaction of magnetic fields. Then, there are mechanical armatures, often used in mechanical systems for transmitting motion. Permanent magnet armatures are another type, relying on the properties of permanent magnets. Hybrid armatures combine different principles for enhanced performance. Additionally, some armatures are designed specifically for high-speed applications, while others are for heavy-duty tasks.
Armature,Armature Wire,Armature In Motor,Armature Assembly Wuxi Jinle Automobile Motor Factory , https://www.wxjldj.com
This article introduces the implementation of a program for driving an 8-digit digital tube display using two AVR microcontrollers. The main focus is on how the ATmega16 microcontroller controls the 74HC595 shift register to drive the display. The following code provides a complete example of the main program and the modular programming approach.
The program includes the necessary header files and defines arrays for digit display patterns and common cathode configurations. It initializes the ports and uses delay functions to control the timing of the display updates.
```c
#include
#include
#include "hc595.h"
unsigned char Led_Disbuf[10] = {0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90}; // Common anode
unsigned char ComBuf[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
extern void Delayus(unsigned int lus);
extern void Delayms(unsigned int lms);
int main(void)
{
unsigned char i;
PORTB = 0xFF; // Turn off all LEDs
DDRB = 0xFF; // Set PORTB as output
HC595_port_init();
while (1)
{
for (i = 0; i < 8; i++)
{
PORTB = Led_Disbuf[i]; // Send segment code
HC595_Send_Data(ComBuf[i]); // Select digit
Delayus(70); // Short delay
HC595_Send_Data(0x00); // Disable digit
}
}
}
```
The `Delayus` and `Delayms` functions are used to create precise time delays. The `Delayus` function uses the built-in `_delay_loop_2` function from the GCC library to generate microsecond-level delays, while `Delayms` calls `Delayus` repeatedly to achieve millisecond-level timing.
For the modular programming approach, the `hc595.h` file defines the pin connections and macros for controlling the 74HC595 shift register. These include definitions for the latch, clock, data, and output enable pins. Functions such as `HC595_port_init`, `HC595_Send_Data`, and `HC595_Output_Data` are declared in this header file.
The corresponding `hc595.c` file implements these functions. The `HC595_port_init` function configures the necessary pins as outputs. The `HC595_Send_Data` function sends a byte of data to the shift register, bit by bit, using the clock and data lines. Finally, the `HC595_Output_Data` function updates the latch to display the data on the connected digits.
By breaking down the code into modular components, it becomes easier to maintain and reuse the code in different projects. This approach also improves readability and makes it simpler to debug or modify specific parts of the program.
Overall, this implementation demonstrates a practical way to use an AVR microcontroller with a 74HC595 shift register to control an 8-digit LED display, making it a useful reference for anyone working with similar hardware setups.