-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_leds.c
More file actions
110 lines (89 loc) · 1.94 KB
/
Copy pathdebug_leds.c
File metadata and controls
110 lines (89 loc) · 1.94 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#if defined(__XC)
#include <xc.h> /* XC8 General Include File */
#elif defined(HI_TECH_C)
#include <htc.h> /* HiTech General Include File */
#endif
#include <stdint.h> /* For uint8_t definition */
#include <stdbool.h> /* For true/false definition */
#include "pic16f877a.h"
#include "debug_leds.h"
void switch_prtd_led(unsigned led, unsigned turn_on_f)
{
switch (led) {
case 7:
if (turn_on_f)
PORTDbits.RD7 = 1;
else
PORTDbits.RD7 = 0;
break;
case 6:
if (turn_on_f)
PORTDbits.RD6 = 1;
else
PORTDbits.RD6 = 0;
case 5:
if (turn_on_f)
PORTDbits.RD5 = 1;
else
PORTDbits.RD5 = 0;
break;
case 4:
if (turn_on_f)
PORTDbits.RD4 = 1;
else
PORTDbits.RD4 = 0;
break;
case 3:
if (turn_on_f)
PORTDbits.RD3 = 1;
else
PORTDbits.RD3 = 0;
break;
case 2:
if (turn_on_f)
PORTDbits.RD2 = 1;
else
PORTDbits.RD2 = 0;
break;
case 1:
if (turn_on_f)
PORTDbits.RD1 = 1;
else
PORTDbits.RD1 = 0;
break;
case 0:
if (turn_on_f)
PORTDbits.RD0 = 1;
else
PORTDbits.RD0 = 0;
break;
}
}
void turn_yl_led_on(void)
{
PORTDbits.RD1 = 1;
}
void turn_yl_led_off(void)
{
PORTDbits.RD1 = 0;
}
void turn_grn_led_on(void)
{
PORTDbits.RD0 = 1;
}
void turn_grn_led_off(void)
{
PORTDbits.RD0 = 0;
}
void turn_blu_led_on(void)
{
PORTDbits.RD3 = 1;
}
void turn_blu_led_off(void)
{
PORTDbits.RD3 = 0;
}
void turn_leds_off(void)
{
PORTD = 0x00;
}