-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemp
More file actions
65 lines (61 loc) · 1.74 KB
/
Copy pathtemp
File metadata and controls
65 lines (61 loc) · 1.74 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
else{
for(;i<KEY_ROWS;i++){
lpinr[i].port = keypad -> keypad_rows[i].port;
lpinr[i].pin = keypad -> keypad_rows[i].pin;
lpinr[i].direction = GPIO_OUT;
switch(keypad -> connection){
case(pull_down):
lpinr[i].logic= GPIO_HIGH;
break;
ret = E_NOT_OK;
break;
}
}
i=0;
for(;i<KEY_COLUMNS;i++){
lpinc[i].port = keypad -> keypad_columns[i].port;
lpinc[i].pin = keypad -> keypad_columns[i].pin;
lpinc[i].direction = GPIO_IN;
switch(keypad -> connection){
case(pull_down):
lpinc[i].logic= GPIO_LOW;
break;
case(pull_up):
lpinc[i].logic= GPIO_HIGH;
break;
default:
ret = E_NOT_OK;
break;
}
}
i=0;
for(;i<KEY_ROWS && ret != E_NOT_OK; i++)
ret = GPIO_pin_intialize(&(lpinr[i]));
for(;i<KEY_COLUMNS && ret != E_NOT_OK; i++)
ret = GPIO_direction_intialize(&(lpinc[i]));
}
------------
for(;j<50;j++){
ret = seven_segment_write_number(&segment1, (uint8)(i%10));
GPIO_pin_write_logic(&seg_units_en,GPIO_HIGH);
__delay_ms(11);
GPIO_pin_write_logic(&seg_units_en,GPIO_LOW);
seven_segment_write_number(&segment1, (uint8)(i/10));
GPIO_pin_write_logic(&seg_tenth_en,GPIO_HIGH);
__delay_ms(11);
GPIO_pin_write_logic(&seg_tenth_en,GPIO_LOW);
}
i++;
--------------
final
// for(j=0;j<50;j++){
// ret = seven_segment_write_number(&segment1,(uint8)i%10);
// ret = GPIO_pin_write_logic(&seg_units_en, GPIO_HIGH);
// __delay_ms(10);
// ret = GPIO_pin_write_logic(&seg_units_en, GPIO_LOW);
// ret = seven_segment_write_number(&segment1, (uint8)i/10);
// ret = GPIO_pin_write_logic(&seg_tenth_en, GPIO_HIGH);
// __delay_ms(10);
// ret = GPIO_pin_write_logic(&seg_tenth_en, GPIO_LOW);
// }
// (i==99)?(i=0):i++;