/PIC Stuff/PIC_27J13/dist/default/production/PIC_27J13.production.hex |
---|
File deleted |
/PIC Stuff/PIC_27J13/dist/default/production/PIC_27J13.production.cof |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/PIC Stuff/PIC_27J13/dist/default/production/PIC_27J13.production.cof |
---|
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/PIC Stuff/PIC_27J13/build/default/production/nfc.o.d |
---|
File deleted |
/PIC Stuff/PIC_27J13/build/default/production/uart.o.d |
---|
File deleted |
/PIC Stuff/PIC_27J13/build/default/production/main.o.d |
---|
File deleted |
/PIC Stuff/PIC_27J13/build/default/production/led_backpack.o.d |
---|
File deleted |
/PIC Stuff/PIC_27J13/build/default/production/oled_ssd1306.o.d |
---|
File deleted |
/PIC Stuff/PIC_27J13/build/default/production/oled_ssd1331.o.d |
---|
File deleted |
/PIC Stuff/PIC_27J13/build/default/production/spi.o.d |
---|
File deleted |
/PIC Stuff/PIC_27J13/build/default/production/glcdfont.o.d |
---|
File deleted |
/PIC Stuff/PIC_27J13/build/default/production/i2c.o.d |
---|
File deleted |
/PIC Stuff/PIC_27J13/build/default/production/interrupts.o.d |
---|
File deleted |
/PIC Stuff/PIC_27J13/build/default/production/Adafruit_GFX.o.d |
---|
File deleted |
/PIC Stuff/PIC_27J13/Adafruit_GFX.c |
---|
492,7 → 492,7 |
for (i = 127; i > len - 1; i--) { |
gfx_data.lcd_buffer[i] = gfx_data.lcd_buffer[i - len]; |
} |
memcpy(gfx_data.lcd_buffer, gfx_data.buffer, len); |
memcpy((char *)gfx_data.lcd_buffer, (const char *)gfx_data.buffer, len); |
// Print full buffer to screen |
GFX_clearScreen(); |
/PIC Stuff/PIC_27J13/adc.c |
---|
1,27 → 1,52 |
#include "maindefs.h" |
#include "adc.h" |
#include <adc.h> |
void adc_init() { |
static ADC_DATA adc_data; |
void ADC_Init(unsigned char TAD, unsigned char FOSC) { |
TRISAbits.TRISA0 = 1; |
OpenADC(ADC_FOSC_64 & ADC_RIGHT_JUST & ADC_0_TAD, |
ADC_CH0 & ADC_INT_ON & ADC_REF_VDD_VSS, 0, |
ADC_1ANA); |
TRISAbits.TRISA1 = 1; |
TRISAbits.TRISA2 = 1; |
adc_data.last_channel = 0; |
adc_data.result = 0; |
ADCON0bits.VCFG1 = 0; // VRef- = AVss |
ADCON0bits.VCFG0 = 0; // VRef+ = AVdd |
ADCON1bits.ADFM = 1; // Right justified result |
ADCON1bits.ADCAL = 1; // Calibrate A/D |
ADCON1bits.ACQT = TAD; |
ADCON1bits.ADCS = FOSC; |
ADCON0bits.ADON = 1; // Enable A/D module |
ADCON0bits.GO_DONE = 1; // Start calibration |
while (ADCON0bits.GO_DONE); // Wait for calibration to finish |
PIR1bits.ADIF = 0; // Clear the IF flag |
ADCON1bits.ADCAL = 0; // Normal A/D operation |
PIE1bits.ADIE = 1; // Enable A/D interrupt |
} |
void adc_start() { |
ConvertADC(); |
void ADC_Start(unsigned char channel) { |
adc_data.last_channel = channel; |
ADCON0bits.CHS = channel; // Set A/D channel |
ADCON0bits.GO_DONE = 1; // Start A/D conversion |
} |
void adc_stop() { |
CloseADC(); |
void ADC_Stop() { |
ADCON0bits.ADON = 0; // Disable A/D module |
} |
void adc_interrupt_handler() { |
// Sends the ADC value to main() |
unsigned int ret; |
unsigned char length; |
ret = ReadADC(); |
length = 2; |
// MQ_sendmsg_ToMainFromLow(length, MSGTYPE_ADC_NEWVALUE, &ret); |
void ADC_Interrupt_Handler() { |
adc_data.result = ADRES; |
} |
char ADC_Get_Result(unsigned int* ret) { |
if (ADCON0bits.GO_DONE) { |
return 0; |
} else { |
*ret = adc_data.result; |
return 1; |
} |
} |
/PIC Stuff/PIC_27J13/adc.h |
---|
1,9 → 1,48 |
#ifndef __adc_h |
#define __adc_h |
void adc_init(void); |
void adc_start(void); |
void adc_stop(void); |
void adc_interrupt_handler(void); |
#define ADC_CHANNEL_AN0 0b0000 |
#define ADC_CHANNEL_AN1 0b0001 |
#define ADC_CHANNEL_AN2 0b0010 |
#define ADC_CHANNEL_AN3 0b0011 |
#define ADC_CHANNEL_AN4 0b0100 |
#define ADC_CHANNEL_AN5 0b0101 |
#define ADC_CHANNEL_AN6 0b0110 |
#define ADC_CHANNEL_AN7 0b0111 |
#define ADC_CHANNEL_AN8 0b1000 |
#define ADC_CHANNEL_AN9 0b1001 |
#define ADC_CHANNEL_AN10 0b1010 |
#define ADC_CHANNEL_AN11 0b1011 |
#define ADC_CHANNEL_AN12 0b1100 |
#define ADC_CHANNEL_VDDCORE 0b1110 |
#define ADC_CHANNEL_ABG 0b1111 |
#define ADC_TAD_20 0b111; |
#define ADC_TAD_16 0b110 |
#define ADC_TAD_12 0b101 |
#define ADC_TAD_8 0b100 |
#define ADC_TAD_6 0b011 |
#define ADC_TAD_4 0b010 |
#define ADC_TAD_2 0b001 |
#define ADC_TAD_0 0b000 |
#define ADC_FOSC_64 0b110 |
#define ADC_FOSC_32 0b010 |
#define ADC_FOSC_16 0b101 |
#define ADC_FOSC_8 0b001 |
#define ADC_FOSC_4 0b100 |
#define ADC_FOSC_2 0b000 |
#define ADC_FOSC_FRC 0b011 |
typedef struct __ADC_DATA { |
unsigned char last_channel; |
unsigned int result; |
} ADC_DATA; |
void ADC_Init(unsigned char TAD, unsigned char FOSC); |
void ADC_Start(unsigned char channel); |
void ADC_Stop(void); |
void ADC_Interrupt_Handler(void); |
char ADC_Get_Result(unsigned int *ret); |
#endif |
/PIC Stuff/PIC_27J13/interrupts.c |
---|
2,6 → 2,7 |
#include "uart.h" |
#include "i2c.h" |
#include "spi.h" |
#include "adc.h" |
#include "interrupts.h" |
//---------------------------------------------------------------------------- |
28,7 → 29,7 |
// INTCON2bits.TMR0IP = 0; // Timer0 interrupt |
// IPR1bits.TMR1IP = 0; // Timer1 interrupt |
// IPR2bits.TMR3IP = 0; // Timer 3 interrupt |
// IPR1bits.ADIP = 0; // ADC interupt |
IPR1bits.ADIP = 0; // ADC interupt |
// INTCON2bits.RBIP = 0; // Port B interrupt |
// INTCON3bits.INT1IP = 0; // INT1 interrupt |
211,13 → 212,13 |
// PIR2bits.TMR3IF = 0; |
// } |
// // Check to see if we have an interrupt on ADC |
// if (PIR1bits.ADIF) { |
// // Call the interrupt handler |
// adc_interrupt_handler(); |
// |
// // Clear the interrupt flag |
// PIR1bits.ADIF = 0; |
// } |
// Check to see if we have an interrupt on ADC |
if (PIR1bits.ADIF) { |
// Call the interrupt handler |
ADC_Interrupt_Handler(); |
// Clear the interrupt flag |
PIR1bits.ADIF = 0; |
} |
} |
/PIC Stuff/PIC_27J13/main.c |
---|
8,6 → 8,7 |
#include "led_backpack.h" |
#include "oled_ssd1306.h" |
#include "oled_ssd1331.h" |
#include "adc.h" |
#include <usart.h> |
#include <delays.h> |
#include <string.h> |
19,13 → 20,13 |
#pragma config CFGPLLEN = ON // Enable PLL on startup |
#pragma config PLLSEL = PLL96 // Use 96MHz PLL 4MHz -> 96MHz / 2 = 48MHz |
//#pragma config SOSCSEL = HIGH // High Power T1OSC/SOSC circuit selected |
//#pragma config ADCSEL = BIT12 // 12-bit ADrC |
#pragma config ADCSEL = BIT12 // 12-bit ADrC |
//#pragma config IOL1WAY = OFF // IOLOCK bit can be set and cleared as needed |
/* ----------- IO Pins ----------- |
* RA0 - |
* RA1 - |
* RA2 - |
* RA0 - A/D X |
* RA1 - A/D Y |
* RA2 - A/D Z |
* RA3 - |
* RA4 - [CANNOT BE USED (VDDCORE/VCAP)] |
* RA5 - |
632,92 → 633,71 |
} |
#endif |
#ifdef _TEST_ADC |
void main(void) { |
unsigned int x,y,z; |
unsigned char buffer[60]; |
/* --------------------- Oscillator Configuration --------------------- */ |
// OSCTUNEbits.PLLEN = 1; // Enable 4x PLL |
OSCCONbits.IRCF = 0b111; // Set INTOSC postscaler to 8MHz |
OSCCONbits.SCS = 0b00; // Use 96MHz PLL as primary clock source |
/* -------------------------------------------------------------------- */ |
// Set all ports as digial I/O except for AN0-AN2 (pins 2-4) |
ANCON0 = 0xF8; |
ANCON1 = 0x1F; |
UART1_Init(); // Initialize the UART handler code |
SPI2_Init(SPI2_FOSC_8); // Initialize the SPI module |
SSD1331_Init(); // Initialize the SSD1331 OLED display (uses SPI2) |
ADC_Init(ADC_TAD_0, ADC_FOSC_64); |
// I2C_Configure_Master(I2C_400KHZ); |
SSD1331_Begin(); |
interrupt_enable(); // Enable high-priority interrupts and low-priority interrupts |
interrupt_init(); // Initialize the interrupt priorities |
DBG_PRINT_MAIN("\r\nBegin Program\r\n"); |
memset(buffer, 0, 60); |
GFX_clearScreen(); |
GFX_setRotation(3); |
while (1) { |
// ADC read from AN0-AN2 and prints to display |
ADC_Start(ADC_CHANNEL_AN0); |
GFX_fillRect(0,0,GFX_width(),8,SSD1331_BLACK); |
GFX_setCursor(0,0); |
while (!ADC_Get_Result(&x)); |
GFX_writeString("X: %u", x); |
ADC_Start(ADC_CHANNEL_AN1); |
GFX_fillRect(0,8,GFX_width(),8,SSD1331_BLACK); |
GFX_setCursor(0,8); |
while (!ADC_Get_Result(&y)); |
GFX_writeString("Y: %u", y); |
ADC_Start(ADC_CHANNEL_AN2); |
GFX_fillRect(0,16,GFX_width(),8,SSD1331_BLACK); |
GFX_setCursor(0,16); |
while (!ADC_Get_Result(&z)); |
GFX_writeString("Z: %u", z); |
} |
} |
#endif |
#if !defined(_TEST_UART) && !defined(_TEST_I2C_MASTER) && \ |
!defined(_TEST_I2C_SLAVE) && !defined(_TEST_SPI) && \ |
!defined(_TEST_NFC) && !defined(_TEST_LED_BACKPACK) && \ |
!defined(_TEST_SSD1306_OLED) && !defined(_TEST_SSD1331_OLED) |
!defined(_TEST_SSD1306_OLED) && !defined(_TEST_SSD1331_OLED) && \ |
!defined(_TEST_ADC) |
//static unsigned char lcd_buffer[8][17]; |
// |
//void main(void) { |
// char i = 0; |
// char j = 0; |
// unsigned char length = 0; |
// unsigned char buffer[60]; |
// char buffer_ind = 0; |
// |
// /* --------------------- Oscillator Configuration --------------------- */ |
// // OSCTUNEbits.PLLEN = 1; // Enable 4x PLL |
// OSCCONbits.IRCF = 0b111; // Set INTOSC postscaler to 8MHz |
// OSCCONbits.SCS = 0b00; // Use 96MHz PLL as primary clock source |
// /* -------------------------------------------------------------------- */ |
// |
// // Set all ports as digial I/O |
// ANCON0 = 0xFF; |
// ANCON1 = 0x1F; |
// |
// UART1_Init(); // Initialize the UART handler code |
// // I2C_Init(); // Initialize the I2C handler code |
// SPI2_Init(SPI2_FOSC_4); // Initialize the SPI module |
// SSD1331_Init(); // Initialize the SSD1331 OLED display (uses SPI2) |
// // NFC_Init(); // Initialize the NFC chip (uses I2C) |
// // LED_Init(); // Initialize the LED backpack (uses I2C); |
// |
// // I2C_Configure_Master(I2C_400KHZ); |
// SSD1331_Begin(); |
// |
// interrupt_enable(); // Enable high-priority interrupts and low-priority interrupts |
// interrupt_init(); // Initialize the interrupt priorities |
// |
// DBG_PRINT_MAIN("\r\nBegin Program\r\n"); |
// |
// memset(lcd_buffer, 0, 136); |
// GFX_clearScreen(); |
// |
// while (1) { |
// length = UART1_Read_Buffer(buffer); |
// if (length != 0) { |
// // Save string into lcd_buffer at location buffer_ind |
// if (length < 17) { // If string is < 16 char + \n |
// for (i = 0; i < length; i++) // Copy everything including \n |
// lcd_buffer[buffer_ind][i] = buffer[i]; |
// lcd_buffer[buffer_ind][length] = 0; |
// } else { |
// for (i = 0; i < 16; i++) // Copy the first 16 char |
// lcd_buffer[buffer_ind][i] = buffer[i]; |
// lcd_buffer[buffer_ind][16] = 0; |
// } |
// |
//// for (i = 0; i < 8; i++) { |
//// for (j = 0; j < 17; j++) { |
//// DBG_PRINT_MAIN("%c", lcd_buffer[i][j]); |
//// } |
//// DBG_PRINT_MAIN("\r\n"); |
//// } |
//// DBG_PRINT_MAIN("\r\n"); |
// |
// // Print strings in lcd_buffer to display starting at buffer_ind |
// GFX_clearScreen(); |
// GFX_setCursor(0, 0); |
// for (i = 0; i < 8; i++) { |
// j = buffer_ind - i; |
// if (j >= 0) { |
// GFX_writeString("%s", lcd_buffer[j]); |
// } else { |
// GFX_writeString("%s", lcd_buffer[j + 8]); |
// } |
// } |
// |
// buffer_ind++; |
// if (buffer_ind > 7) |
// buffer_ind = 0; |
// } |
// } |
//} |
void main(void) { |
unsigned char i = 0; |
unsigned char j = 0; |
unsigned int x,y,z; |
unsigned char length = 0; |
unsigned char buffer[60]; |
727,8 → 707,8 |
OSCCONbits.SCS = 0b00; // Use 96MHz PLL as primary clock source |
/* -------------------------------------------------------------------- */ |
// Set all ports as digial I/O |
ANCON0 = 0xFF; |
// Set all ports as digial I/O except for AN0-AN2 (pins 2-4) |
ANCON0 = 0xF8; |
ANCON1 = 0x1F; |
UART1_Init(); // Initialize the UART handler code |
736,7 → 716,8 |
SPI2_Init(SPI2_FOSC_8); // Initialize the SPI module |
SSD1331_Init(); // Initialize the SSD1331 OLED display (uses SPI2) |
// NFC_Init(); // Initialize the NFC chip (uses I2C) |
// LED_Init(); // Initialize the LED backpack (uses I2C); |
// LED_Init(); // Initialize the LED backpack (uses I2C) |
ADC_Init(ADC_TAD_0, ADC_FOSC_64); |
// I2C_Configure_Master(I2C_400KHZ); |
SSD1331_Begin(); |
752,11 → 733,31 |
while (1) { |
length = UART1_Read_Buffer(buffer); |
if (length != 0) { |
buffer[length] = 0; |
GFX_appendString("%s", buffer); |
} |
// Reads input from UART and prints to display |
// length = UART1_Read_Buffer(buffer); |
// if (length != 0) { |
// buffer[length] = 0; |
// GFX_appendString("%s", buffer); |
// } |
// ADC read from AN0-AN2 and prints to display |
ADC_Start(ADC_CHANNEL_AN0); |
GFX_fillRect(0,0,GFX_width(),8,SSD1331_BLACK); |
GFX_setCursor(0,0); |
while (!ADC_Get_Result(&x)); |
GFX_writeString("X: %u", x); |
ADC_Start(ADC_CHANNEL_AN1); |
GFX_fillRect(0,8,GFX_width(),8,SSD1331_BLACK); |
GFX_setCursor(0,8); |
while (!ADC_Get_Result(&y)); |
GFX_writeString("Y: %u", y); |
ADC_Start(ADC_CHANNEL_AN2); |
GFX_fillRect(0,16,GFX_width(),8,SSD1331_BLACK); |
GFX_setCursor(0,16); |
while (!ADC_Get_Result(&z)); |
GFX_writeString("Z: %u", z); |
} |
} |
#endif |
/PIC Stuff/PIC_27J13/maindefs.h |
---|
14,6 → 14,7 |
//#define _TEST_LED_BACKPACK |
//#define _TEST_SSD1306_OLED |
//#define _TEST_SSD1331_OLED |
#define _TEST_ADC |
// Option to choose between active OLED displays |
//#define GFX_SSD1306 |
/PIC Stuff/PIC_27J13/nbproject/Makefile-default.mk |
---|
41,11 → 41,11 |
DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} |
# Object Files Quoted if spaced |
OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/main.o ${OBJECTDIR}/i2c.o ${OBJECTDIR}/interrupts.o ${OBJECTDIR}/led_backpack.o ${OBJECTDIR}/nfc.o ${OBJECTDIR}/spi.o ${OBJECTDIR}/uart.o ${OBJECTDIR}/oled_ssd1306.o ${OBJECTDIR}/glcdfont.o ${OBJECTDIR}/Adafruit_GFX.o ${OBJECTDIR}/oled_ssd1331.o |
POSSIBLE_DEPFILES=${OBJECTDIR}/main.o.d ${OBJECTDIR}/i2c.o.d ${OBJECTDIR}/interrupts.o.d ${OBJECTDIR}/led_backpack.o.d ${OBJECTDIR}/nfc.o.d ${OBJECTDIR}/spi.o.d ${OBJECTDIR}/uart.o.d ${OBJECTDIR}/oled_ssd1306.o.d ${OBJECTDIR}/glcdfont.o.d ${OBJECTDIR}/Adafruit_GFX.o.d ${OBJECTDIR}/oled_ssd1331.o.d |
OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/main.o ${OBJECTDIR}/i2c.o ${OBJECTDIR}/interrupts.o ${OBJECTDIR}/led_backpack.o ${OBJECTDIR}/nfc.o ${OBJECTDIR}/spi.o ${OBJECTDIR}/uart.o ${OBJECTDIR}/oled_ssd1306.o ${OBJECTDIR}/glcdfont.o ${OBJECTDIR}/Adafruit_GFX.o ${OBJECTDIR}/oled_ssd1331.o ${OBJECTDIR}/adc.o |
POSSIBLE_DEPFILES=${OBJECTDIR}/main.o.d ${OBJECTDIR}/i2c.o.d ${OBJECTDIR}/interrupts.o.d ${OBJECTDIR}/led_backpack.o.d ${OBJECTDIR}/nfc.o.d ${OBJECTDIR}/spi.o.d ${OBJECTDIR}/uart.o.d ${OBJECTDIR}/oled_ssd1306.o.d ${OBJECTDIR}/glcdfont.o.d ${OBJECTDIR}/Adafruit_GFX.o.d ${OBJECTDIR}/oled_ssd1331.o.d ${OBJECTDIR}/adc.o.d |
# Object Files |
OBJECTFILES=${OBJECTDIR}/main.o ${OBJECTDIR}/i2c.o ${OBJECTDIR}/interrupts.o ${OBJECTDIR}/led_backpack.o ${OBJECTDIR}/nfc.o ${OBJECTDIR}/spi.o ${OBJECTDIR}/uart.o ${OBJECTDIR}/oled_ssd1306.o ${OBJECTDIR}/glcdfont.o ${OBJECTDIR}/Adafruit_GFX.o ${OBJECTDIR}/oled_ssd1331.o |
OBJECTFILES=${OBJECTDIR}/main.o ${OBJECTDIR}/i2c.o ${OBJECTDIR}/interrupts.o ${OBJECTDIR}/led_backpack.o ${OBJECTDIR}/nfc.o ${OBJECTDIR}/spi.o ${OBJECTDIR}/uart.o ${OBJECTDIR}/oled_ssd1306.o ${OBJECTDIR}/glcdfont.o ${OBJECTDIR}/Adafruit_GFX.o ${OBJECTDIR}/oled_ssd1331.o ${OBJECTDIR}/adc.o |
CFLAGS= |
62,7 → 62,7 |
FIXDEPS=fixDeps |
.build-conf: ${BUILD_SUBPROJECTS} |
${MAKE} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/PIC_27J13.${IMAGE_TYPE}.${OUTPUT_SUFFIX} |
${MAKE} ${MAKE_OPTIONS} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/PIC_27J13.${IMAGE_TYPE}.${OUTPUT_SUFFIX} |
MP_PROCESSOR_OPTION=18F27J13 |
MP_PROCESSOR_OPTION_LD=18f27j13 |
142,6 → 142,12 |
${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -p$(MP_PROCESSOR_OPTION) -oi -mL -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/oled_ssd1331.o oled_ssd1331.c |
@${DEP_GEN} -d ${OBJECTDIR}/oled_ssd1331.o |
${OBJECTDIR}/adc.o: adc.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/adc.o.d |
${MP_CC} $(MP_EXTRA_CC_PRE) -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -p$(MP_PROCESSOR_OPTION) -oi -mL -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/adc.o adc.c |
@${DEP_GEN} -d ${OBJECTDIR}/adc.o |
else |
${OBJECTDIR}/main.o: main.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
209,6 → 215,12 |
${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -oi -mL -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/oled_ssd1331.o oled_ssd1331.c |
@${DEP_GEN} -d ${OBJECTDIR}/oled_ssd1331.o |
${OBJECTDIR}/adc.o: adc.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/adc.o.d |
${MP_CC} $(MP_EXTRA_CC_PRE) -p$(MP_PROCESSOR_OPTION) -oi -mL -I ${MP_CC_DIR}\\..\\h -fo ${OBJECTDIR}/adc.o adc.c |
@${DEP_GEN} -d ${OBJECTDIR}/adc.o |
endif |
# ------------------------------------------------------------------------------------ |
/PIC Stuff/PIC_27J13/nbproject/Makefile-genesis.properties |
---|
1,8 → 1,8 |
# |
#Wed Jul 11 23:10:42 EDT 2012 |
default.com-microchip-mplab-nbide-toolchainC18-C18LanguageToolchain.md5=fd3c294f650afc344cfb0579847b1618 |
#Sun Jul 15 15:38:32 EDT 2012 |
default.com-microchip-mplab-nbide-toolchainC18-C18LanguageToolchain.md5=db1c0674398f590b65c1c1c4fb1e2b92 |
default.languagetoolchain.dir=C\:\\Program Files (x86)\\Microchip\\mplabc18\\v3.40\\bin |
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=39edbdd4b2849b7912992109f4b86781 |
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=485c926ba2cd86275d1848ca44c226c5 |
default.languagetoolchain.version=3.40 |
host.platform=windows |
conf.ids=default |
/PIC Stuff/PIC_27J13/nbproject/Makefile-local-default.mk |
---|
22,6 → 22,7 |
MP_JAVA_PATH="C:\Program Files (x86)\Microchip\MPLABX\sys\java\jre1.6.0_32-windows-x64\java-windows/bin/" |
OS_CURRENT="$(shell uname -s)" |
MP_CC="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\mcc18.exe" |
# MP_CPPC is not defined |
# MP_BC is not defined |
MP_AS="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\..\mpasm\MPASMWIN.exe" |
MP_LD="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\mplink.exe" |
28,6 → 29,7 |
MP_AR="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\mplib.exe" |
DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files (x86)/Microchip/MPLABX/mplab_ide/mplab_ide/modules/../../bin/extractobjectdependencies.jar" |
MP_CC_DIR="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin" |
# MP_CPPC_DIR is not defined |
# MP_BC_DIR is not defined |
MP_AS_DIR="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\..\mpasm" |
MP_LD_DIR="C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin" |
/PIC Stuff/PIC_27J13/nbproject/configurations.xml |
---|
14,6 → 14,7 |
<itemPath>oled_ssd1306.h</itemPath> |
<itemPath>Adafruit_GFX.h</itemPath> |
<itemPath>oled_ssd1331.h</itemPath> |
<itemPath>adc.h</itemPath> |
</logicalFolder> |
<logicalFolder name="LibraryFiles" |
displayName="Library Files" |
42,6 → 43,7 |
<itemPath>glcdfont.c</itemPath> |
<itemPath>Adafruit_GFX.c</itemPath> |
<itemPath>oled_ssd1331.c</itemPath> |
<itemPath>adc.c</itemPath> |
</logicalFolder> |
<logicalFolder name="ExternalFiles" |
displayName="Important Files" |
/PIC Stuff/PIC_27J13/spi.c |
---|
30,14 → 30,15 |
SSP2STATbits.SMP = 0; // Input is sampled in the middle of data output time |
SSP2STATbits.CKE = 0; // Transmit occurs on transition from Idle to active clock state |
if (speed == SPI2_FOSC_4) |
SSP2CON1bits.SSPM = 0b0000; // Clock = FOSC/4 |
else if (speed == SPI2_FOSC_8) |
SSP2CON1bits.SSPM = 0b1010; // Clock = FOSC/8 |
else if (speed == SPI2_FOSC_16) |
SSP2CON1bits.SSPM = 0b0001; // Clock = FOSC/16 |
else |
SSP2CON1bits.SSPM = 0b0010; // Clock = FOSC/64 |
SSP2CON1bits.SSPM = speed; |
// if (speed == SPI2_FOSC_4) |
// SSP2CON1bits.SSPM = 0b0000; // Clock = FOSC/4 |
// else if (speed == SPI2_FOSC_8) |
// SSP2CON1bits.SSPM = 0b1010; // Clock = FOSC/8 |
// else if (speed == SPI2_FOSC_16) |
// SSP2CON1bits.SSPM = 0b0001; // Clock = FOSC/16 |
// else |
// SSP2CON1bits.SSPM = 0b0010; // Clock = FOSC/64 |
SSP2CON1bits.CKP = 1; // Idle state for clock is a high level |
SSP2CON1bits.SSPEN = 1; // Enable MSSP module |
/PIC Stuff/PIC_27J13/spi.h |
---|
11,10 → 11,10 |
#define SPI2_WRITE_ONLY |
// SPI speed selection |
#define SPI2_FOSC_64 1 |
#define SPI2_FOSC_16 2 |
#define SPI2_FOSC_8 3 |
#define SPI2_FOSC_4 4 |
#define SPI2_FOSC_64 0b0010 |
#define SPI2_FOSC_16 0b0001 |
#define SPI2_FOSC_8 0b1010 |
#define SPI2_FOSC_4 0b0000 |
typedef struct __SPI_DATA { |
unsigned char buffer_in[MAXSPIBUF]; |