Subversion Repositories Code-Repo

Rev

Rev 314 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 314 Rev 315
Line 1... Line 1...
1
#include "defines.h"
1
#include "defines.h"
2
#include "IOC.h"
2
#include "IOC.h"
-
 
3
#include "STEPPER.h"
3
 
4
 
4
void IOC_Init(void) {
5
void IOC_Init(void) {
5
    INTCONbits.IOCIE = 1;
6
    INTCONbits.IOCIE = 1;
6
 
7
 
7
    // Enable interrupt on both edges on RA3 and RA4
8
    // Enable interrupt on both edges on RA3 and RA4
Line 15... Line 16...
15
    if (IOCAFbits.IOCAF3) {
16
    if (IOCAFbits.IOCAF3) {
16
 
17
 
17
        if (SW_1_PORT) {
18
        if (SW_1_PORT) {
18
            switch (Get_Cur_Mode()) {
19
            switch (Get_Cur_Mode()) {
19
                case SINGLE_STEP:
20
                case SINGLE_STEP:
20
                    STEP_LAT = 1;
-
 
21
                    __delay_ms(2);
-
 
22
                    STEP_LAT = 0;
21
                    STEPPER_Step();
23
                    break;
22
                    break;
24
                case AUTO_STEP:
23
                case AUTO_STEP:
25
 
-
 
-
 
24
                    STEPPER_Toggle_Auto();
-
 
25
                    break;
-
 
26
                case SET_DELAY:
-
 
27
                    STEPPER_Set_Next_Delay();
26
                    break;
28
                    break;
27
                case SET_MICROSTEP:
29
                case SET_MICROSTEP:
28
                    Set_Next_Step();
30
                    STEPPER_Set_Next_Step();
29
                    break;
31
                    break;
30
            }
32
            }
31
        }
33
        }
32
 
34
 
33
        // Delay to debounce button on any edge
35
        // Delay to debounce button on any edge
34
        __delay_ms(200);
36
         __delay_ms(200);
35
 
37
        
36
        IOCAFbits.IOCAF3 = 0;
38
        IOCAFbits.IOCAF3 = 0;
37
    }
39
    }
38
 
40
 
39
    if (IOCAFbits.IOCAF4) {
41
    if (IOCAFbits.IOCAF4) {
40
 
42