forked from harshad018/PSDL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAss5.c
81 lines (54 loc) · 1.06 KB
/
Ass5.c
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
#include<pic18f458.h>
#pragma config OSC = HS
#pragma config WDT = OFF
//#pragma config PBADE = OFF
#pragma config LVP = OFF
#define but1 PORTBbits.RB0
#define LED0 PORTDbits.RD4
#define LED1 PORTDbits.RD5
#define LED2 PORTDbits.RD6
#define LED3 PORTDbits.RD7
void LED1torseq(void);
void delayms(unsigned int);
void main (void){
TRISBbits.RB0 =1;
TRISD = 0;
PORTD = 0xFF;
while(1){
if(but1 ==0){
while(1){
LED1torseq();
}
}
}
}
void LED1torseq(void){
LED0 = 0;
LED1 = 1;
LED2 = 1;
LED3 = 1;
delayms(1000);
LED0 = 1;
LED1 = 0;
LED2 = 1;
LED3 =1;
delayms(1000);
LED0 = 1;
LED1 = 1;
LED2 = 0;
LED3 = 1;
delayms(1000);
LED0 = 1;
LED1 = 1;
LED2 = 1;
LED3 = 0;
delayms(1000);
}
void delayms(unsigned int val){
unsigned int x;
unsigned int y;
for ( x = 0; x < val; x++){
for ( y = 0; y < 165; y++){
}
}
}