Arduino与Proteus仿真实例-74LS378触发器驱动仿真

74LS378触发器驱动仿真

74LS378 是一种单片、正沿触发、可注册触发器 IC,它利用 TTL 电路来实现 D 型触发器/锁存逻辑。 该 IC 还具有公共时钟使能而不是公共清除。 74LS378 IC工作电压范围广,工作条件范围广,直接与CMOS、NMOS、TTL接口。 IC 74LS378 体积更小,速度更快,这使其在各种设备中都可靠。

在前面的文章中,对74LS378做了详细的介绍,请参考:

1、仿真电路原理图

在这里插入图片描述

2、仿真代码实现

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const byte clearPin = 9;
const byte clockPin = 8;

const byte led_pins[] = {2,3,4,5,6,7};

int holdPinTouch = 50;
int delayBetweenDigits = 300;

void setup()
{
for(byte i = 0;i < 6;i++){
pinMode (led_pins[i], OUTPUT);
}

pinMode (clearPin, OUTPUT);
pinMode (clockPin, OUTPUT);
}
byte idx = 0;
void loop()
{

digitalWrite (led_pins[5 - idx], HIGH);
displayDigit();
idx++;
if(idx > 5){
idx = 0;
clearDigit();
}
delay(delayBetweenDigits);
}

void clearDigit()
{
for(byte i = 0;i < 6;i++){
digitalWrite (led_pins[i], LOW);
}


digitalWrite (clearPin, LOW);
delay (holdPinTouch);
digitalWrite (clearPin, HIGH);
delay (holdPinTouch);
}

void displayDigit()
{
digitalWrite (clearPin, LOW);
digitalWrite (clockPin, LOW);
delay (delayBetweenDigits);
digitalWrite (clockPin, HIGH);
delay (delayBetweenDigits);
}

3、仿真结果

在这里插入图片描述

文章来源: https://iotsmart.blog.csdn.net/article/details/121347938