-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLab13.c
49 lines (44 loc) · 899 Bytes
/
Lab13.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
#include <LPC21xx.h>
void clock_wise(void) ;
void anti_clock_wise(void) ;
unsigned int var1 ;
unsigned long int i=0,j=0,k=0;
int main(void)
{
PINSEL2 = 0x00000000;
IO1DIR |= 0x00F00000;
while(1)
{
for( j = 0 ; j < 50 ; j++ )
clock_wise() ;
for( k = 0 ; k < 65000 ; k++ ) ;
for( j=0 ; j < 50 ; j++ )
anti_clock_wise() ;
for( k = 0 ; k < 65000 ; k++ ) ;
}
}
void clock_wise(void)
{
var1 = 0x00080000;
for(i=0;i<=3;i++)
{
var1 <<= 1 ;
IO1CLR =0x00F00000;
IO1SET = var1;
for( k = 0 ; k < 3000 ; k++);
}
}
void anti_clock_wise(void)
{
var1 = 0x00800000 ;
IO1CLR =0x00F00000 ;
IO1SET = var1 ;
for(k=0;k<3000;k++);
for(i=0;i<3;i++)
{
var1 >>=1;
IO1CLR =0x00F00000 ;
IO1SET=var1 ;
for(k=0;k<3000;k++);
}
}