Subversion Repositories Code-Repo

Rev

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

Rev 208 Rev 212
Line 37... Line 37...
37
 
37
 
38
#include <xc.h>
38
#include <xc.h>
39
#include <plib.h>
39
#include <plib.h>
40
#include <stdlib.h>
40
#include <stdlib.h>
41
#include "defines.h"
41
#include "defines.h"
-
 
42
#include "UART1.h"
42
#include "SPI1.h"
43
#include "SPI1.h"
43
#include "TIMER4.h"
44
#include "TIMER4.h"
44
#include "TIMER5.h"
45
#include "TIMER5.h"
45
#include "CUBE.h"
46
#include "CUBE.h"
46
#include "BTN.h"
47
#include "BTN.h"
Line 84... Line 85...
84
    INTConfigureSystem(INT_SYSTEM_CONFIG_MULT_VECTOR);
85
    INTConfigureSystem(INT_SYSTEM_CONFIG_MULT_VECTOR);
85
 
86
 
86
    // Set all analog I/O pins to digital
87
    // Set all analog I/O pins to digital
87
    AD1PCFGSET = 0xFFFF;
88
    AD1PCFGSET = 0xFFFF;
88
 
89
 
89
    // Initialize peripherals
90
    // Initialize the SPI1 module
90
    SPI1_DATA spi_data;
91
    SPI1_DATA spi_data;
91
    SPI1_Init(&spi_data);
92
    SPI1_Init(&spi_data, NULL);
92
 
93
 
-
 
94
    // Initialize the UART1 module
-
 
95
    UART1_DATA uart_data;
-
 
96
    UART1_Init(&uart_data, &Cube_Data_In);
-
 
97
 
93
    // Initializs the PWM output to 20MHz
98
    // Initializs the PWM2 output to 20MHz
94
    PWM2_Init();
99
    PWM2_Init();
95
    PWM2_Start();
100
    PWM2_Start();
96
 
101
 
97
    // Initialize the cube
102
    // Initialize the cube variables
98
    CUBE_DATA cube_data;
103
    CUBE_DATA cube_data;
99
    Cube_Init(&cube_data, 0x40);
104
    Cube_Init(&cube_data, 0x40);
100
 
105
 
101
    // Start the cube update layer interrupt
106
    // Start the cube update layer interrupt
102
    // 2083 = 60Hz, 500 = 250Hz, 250 = 500Hz
107
    // 2083 = 60Hz, 500 = 250Hz, 250 = 500Hz
Line 119... Line 124...
119
//    Cube_Set_All(GREEN);
124
//    Cube_Set_All(GREEN);
120
//    Delay_MS(6000);
125
//    Delay_MS(6000);
121
//    Cube_Set_All(BLUE);
126
//    Cube_Set_All(BLUE);
122
//    Delay_MS(6000);
127
//    Delay_MS(6000);
123
 
128
 
-
 
129
    char start_text[] = "uC Started";
-
 
130
    UART1_Write(start_text, 10);
-
 
131
 
124
    // Set the overlay text
132
    // Set the overlay text
125
    char text_string[] = "Welcome to the CCM Lab    ";
133
    char text_string[] = "Welcome to the CCM Lab    ";
126
    Cube_Text_Init(text_string, 26, 0xFF, 0xFF, 0xFF);
134
    Cube_Text_Init(text_string, 26, 0xFF, 0xFF, 0xFF);
127
    TIMER4_Start();
135
    TIMER4_Start();
128
 
136