//PIC Projects/PICX_16F1825_Stepper_Driver/ADC.c |
---|
0,0 → 1,24 |
#include "defines.h" |
#include "ADC.h" |
void ADC_Init(void) { |
ADCON0bits.ADON = 0; // Turn off ADC module |
ADCON1bits.ADFM = 1; // Right justified data |
ADCON1bits.ADCS = 0b110; // A/D conversion clock = FOSC/64 |
ADCON1bits.ADNREF = 0; // Negative reference is VSS |
ADCON1bits.ADPREF = 0b00; // Positive reference is VDD |
} |
uint16_t ADC_Read(uint8_t channel) { |
uint16_t ret; |
ADCON0bits.CHS = channel; // Set channel |
ADCON0bits.ADON = 1; // Turn ADC on |
__delay_us(10); // Wait the acquisition time |
ADCON0bits.GO_nDONE = 1; // Start conversion |
while (ADCON0bits.GO_nDONE == 1); // Wait for conversion to finish |
ret = ADRESH << 8; // Read ADC value |
ret |= ADRESL; |
return ret; |
} |
//PIC Projects/PICX_16F1825_Stepper_Driver/ADC.h |
---|
0,0 → 1,9 |
#ifndef ADC_H |
#define ADC_H |
void ADC_Init(void); |
uint16_t ADC_Read(uint8_t channel); |
#endif /* ADC_H */ |
//PIC Projects/PICX_16F1825_Stepper_Driver/INTERRUPTS.c |
---|
0,0 → 1,43 |
#include "defines.h" |
#include "INTERRUPTS.h" |
#include "IOC.h" |
#include "SPI.h" |
#include "TIMER.h" |
void Interrupt_Init() { |
} |
void Interrupt_Enable() { |
// Enable global and peripheral interrupts |
INTCONbits.PEIE = 1; |
INTCONbits.GIE = 1; |
} |
void Interrupt_Disable() { |
INTCONbits.PEIE = 0; |
INTCONbits.GIE = 0; |
} |
void interrupt InterruptHandler(void) { |
// We need to check the interrupt flag of each enabled high-priority interrupt to |
// see which device generated this interrupt. Then we can call the correct handler. |
if (PIR1bits.TMR2IF) { |
TIMER_2_Interrupt_Handler(); |
PIR1bits.TMR2IF = 0; |
return; |
} |
if (INTCONbits.IOCIF) { |
// Call the handler |
IOC_Interrupt_Handler(); |
INTCONbits.IOCIF = 0; |
return; |
} |
} |
//PIC Projects/PICX_16F1825_Stepper_Driver/IOC.c |
---|
0,0 → 1,60 |
#include "defines.h" |
#include "IOC.h" |
#include "STEPPER.h" |
void IOC_Init(void) { |
INTCONbits.IOCIE = 1; |
// Enable interrupt on both edges on RA3 and RA4 |
IOCAPbits.IOCAP3 = 1; |
IOCANbits.IOCAN3 = 1; |
IOCAPbits.IOCAP4 = 1; |
IOCANbits.IOCAN4 = 1; |
} |
void IOC_Interrupt_Handler(void) { |
STEP_LAT = 1; |
STEP_LAT = 0; |
if (IOCAFbits.IOCAF3) { |
// Delay to debounce button on any edge |
__delay_ms(1); |
if (SW_1_PORT) { |
switch (Get_Cur_Mode()) { |
case SINGLE_STEP: |
STEPPER_Step(); |
break; |
case AUTO_STEP: |
STEPPER_Toggle_Auto(); |
break; |
case SET_MICROSTEP: |
STEPPER_Set_Next_Step(); |
break; |
} |
} |
// Delay to debounce button on any edge |
__delay_ms(1); |
IOCAFbits.IOCAF3 = 0; |
return; |
} |
if (IOCAFbits.IOCAF4) { |
// Delay to debounce button on any edge |
__delay_ms(1); |
if (SW_2_PORT) { |
Set_Next_Mode(); |
} |
// Delay to debounce button on any edge |
__delay_ms(1); |
IOCAFbits.IOCAF4 = 0; |
return; |
} |
} |
//PIC Projects/PICX_16F1825_Stepper_Driver/SPI.h |
---|
0,0 → 1,36 |
#ifndef SPI_H |
#define SPI_H |
#define MAX_SPI_BUFFER 64 |
#define SPI_WRITE_ONLY |
#define SPI2_FOSC_TMR2 0b0011 |
#define SPI2_FOSC_64 0b0010 |
#define SPI2_FOSC_16 0b0001 |
#define SPI2_FOSC_4 0b0000 |
typedef struct { |
#ifndef SPI_WRITE_ONLY |
uint8_t buffer_in[MAX_SPI_BUFFER]; |
uint8_t buffer_in_read_ind; |
uint8_t buffer_in_write_ind; |
uint8_t buffer_in_len; |
#endif |
uint8_t buffer_out[MAX_SPI_BUFFER]; |
uint8_t buffer_out_ind; |
uint8_t buffer_out_len; |
} SPI_DATA; |
void SPI_Init(SPI_DATA *data, uint8_t speed); |
void SPI_Write(uint8_t *msg, uint16_t length); |
void SPI2_Write_Repeat(uint8_t c, uint16_t length); |
#ifndef SPI_WRITE_ONLY |
void SPI_Recv_Interrupt_Handler(void); |
void SPI_Read(uint8_t length); |
uint8_t SPI_Buffer_Len(void); |
uint8_t SPI_Read_Buffer(uint8_t *buffer); |
#endif |
#endif /* SPI_H */ |
//PIC Projects/PICX_16F1825_Stepper_Driver/STEPPER.c |
---|
0,0 → 1,90 |
#include "defines.h" |
#include "STEPPER.h" |
#include "OLED_SSD1306.h" |
#include "ADC.h" |
#include "TIMER.h" |
static STEPPER_MICROSTEP currStep = STEP_1_1; |
static uint8_t autoOn = 0; |
void STEPPER_Set_Microstep(STEPPER_MICROSTEP step) { |
#ifdef DVR8825 |
if (step == STEP_1_1) { |
M0_LAT = 0; |
M1_LAT = 0; |
M2_LAT = 0; |
} else if (step == STEP_1_2) { |
M0_LAT = 1; |
M1_LAT = 0; |
M2_LAT = 0; |
} else if (step == STEP_1_4) { |
M0_LAT = 0; |
M1_LAT = 1; |
M2_LAT = 0; |
} else if (step == STEP_1_8) { |
M0_LAT = 1; |
M1_LAT = 1; |
M2_LAT = 0; |
} else if (step == STEP_1_16) { |
M0_LAT = 0; |
M1_LAT = 0; |
M2_LAT = 1; |
} else if (step == STEP_1_32) { |
M0_LAT = 1; |
M1_LAT = 0; |
M2_LAT = 1; |
} |
#endif |
} |
void STEPPER_Set_Next_Step() { |
switch (currStep) { |
case STEP_1_1: |
currStep = STEP_1_2; |
break; |
case STEP_1_2: |
currStep = STEP_1_4; |
break; |
case STEP_1_4: |
currStep = STEP_1_8; |
break; |
case STEP_1_8: |
currStep = STEP_1_16; |
break; |
case STEP_1_16: |
currStep = STEP_1_32; |
break; |
case STEP_1_32: |
default: |
currStep = STEP_1_1; |
break; |
} |
STEPPER_Set_Microstep(currStep); |
} |
STEPPER_MICROSTEP STEPPER_Get_Cur_Step(void) { |
return currStep; |
} |
void STEPPER_Toggle_Auto() { |
if (autoOn == 0) { |
// Turn on automatic stepping |
TIMER_2_Init(STEPPER_Step); |
TIMER_2_Set_Delay((ADC_Read(POT_ADC_CHANNEL) >> 4) + 1); |
TIMER_2_Start(); |
autoOn = 1; |
} else { |
// Turn off automatic stepping |
TIMER_2_Stop(); |
autoOn = 0; |
} |
} |
void STEPPER_Step() { |
// Toggle step pin |
STEP_LAT = 1; |
__delay_us(2); |
STEP_LAT = 0; |
// Set the timer delay for the next step |
TIMER_2_Set_Delay((ADC_Read(POT_ADC_CHANNEL) >> 4) + 1); |
} |
//PIC Projects/PICX_16F1825_Stepper_Driver/STEPPER.h |
---|
0,0 → 1,22 |
#ifndef STEPPER_H |
#define STEPPER_H |
#define DVR8825 |
typedef enum { |
STEP_1_1, |
STEP_1_2, |
STEP_1_4, |
STEP_1_8, |
STEP_1_16, |
STEP_1_32 |
} STEPPER_MICROSTEP; |
void STEPPER_Set_Microstep(STEPPER_MICROSTEP); |
void STEPPER_Set_Next_Step(void); |
STEPPER_MICROSTEP STEPPER_Get_Cur_Step(void); |
void STEPPER_Toggle_Auto(void); |
void STEPPER_Step(void); |
#endif /* STEPPER_H */ |
//PIC Projects/PICX_16F1825_Stepper_Driver/TIMER.c |
---|
0,0 → 1,41 |
#include "defines.h" |
#include "TIMER.h" |
static TIMER_DATA *timer_data_p; |
void TIMER_Init(TIMER_DATA *data) { |
timer_data_p = data; |
} |
void TIMER_2_Init(void (*callback)(void)) { |
timer_data_p->timer_2_callback = callback; |
timer_data_p->delay = 0; |
T2CONbits.T2OUTPS = 0b0000; // 1:1 Postscaler |
T2CONbits.T2CKPS = 0b10; // 1:16 Prescaler |
T2CONbits.TMR2ON = 0; // Timer stopped |
TMR2 = 6; // Initial value of 6 (overflows every 0.5ms) |
PIE1bits.TMR2IE = 1; // Timer 1 overflow interrupt |
} |
void TIMER_2_Set_Delay(uint16_t delay) { |
timer_data_p->delay = delay; |
} |
void TIMER_2_Start(void) { |
T2CONbits.TMR2ON = 1; // Start timer |
} |
void TIMER_2_Stop(void) { |
T2CONbits.TMR2ON = 0; // Stop timer |
} |
void TIMER_2_Interrupt_Handler(void) { |
TMR2 = 6; |
timer_data_p->counter++; |
if (timer_data_p->counter > timer_data_p->delay) { |
timer_data_p->timer_2_callback(); |
timer_data_p->counter = 0; |
} |
} |
//PIC Projects/PICX_16F1825_Stepper_Driver/TIMER.h |
---|
0,0 → 1,18 |
#ifndef TIMER_H |
#define TIMER_H |
typedef struct { |
void (*timer_2_callback)(void); |
uint16_t delay; |
uint24_t counter; |
} TIMER_DATA; |
void TIMER_Init(TIMER_DATA *data); |
void TIMER_2_Init(void (*callback)(void)); |
void TIMER_2_Set_Delay(uint16_t delay); |
void TIMER_2_Start(void); |
void TIMER_2_Stop(void); |
void TIMER_2_Interrupt_Handler(void); |
#endif /* TIMER_H */ |
//PIC Projects/PICX_16F1825_Stepper_Driver/defines.h |
---|
0,0 → 1,67 |
#ifndef DEFINES_H |
#define DEFINES_H |
#include <xc.h> |
#include <stdint.h> |
#include "STEPPER.h" |
//#define CONTROL_FROM_CONTROLLER |
#define CONTROL_FROM_UART |
// <editor-fold defaultstate="collapsed" desc="I/O Pins"> |
// Stepper Driver |
#define STEP_TRIS TRISAbits.TRISA5 |
#define STEP_LAT LATAbits.LATA5 |
#define M2_TRIS TRISCbits.TRISC3 |
#define M2_LAT LATCbits.LATC3 |
#define M1_TRIS TRISCbits.TRISC4 |
#define M1_LAT LATCbits.LATC4 |
#define M0_TRIS TRISCbits.TRISC5 |
#define M0_LAT LATCbits.LATC5 |
// I/O |
#define SW_2_TRIS TRISAbits.TRISA4 |
#define SW_2_PORT PORTAbits.RA4 |
#define SW_2_INLVL INLVLAbits.INLVLA4 |
#define SW_1_TRIS TRISAbits.TRISA3 |
#define SW_1_PORT PORTAbits.RA3 |
#define SW_1_INLVL INLVLAbits.INLVLA3 |
#define STEP_CURRENT_TRIS TRISAbits.TRISA1 |
#define STEP_ADC_CHANNEL 1 |
#define POT_CURRENT_TRIS TRISAbits.TRISA0 |
#define POT_ADC_CHANNEL 0 |
// SPI |
#define SPI_MOSI_TRIS TRISCbits.TRISC2 |
#define SPI_MOSI_LAT LATCbits.LATC2 |
#define SPI_CLK_TRIS TRISCbits.TRISC0 |
#define SPI_CLK_LAT LATCbits.LATC0 |
#define SPI_DC_SELECT_TRIS TRISCbits.TRISC1 |
#define SPI_DC_SELECT_LAT LATCbits.LATC1 |
#define SPI_RESET_TRIS TRISAbits.TRISA2 |
#define SPI_RESET_LAT LATAbits.LATA2 |
// </editor-fold> |
#define _XTAL_FREQ 32000000 |
typedef enum { |
SINGLE_STEP, |
AUTO_STEP, |
SET_MICROSTEP |
} OPERATING_MODE; |
void Set_Next_Mode(void); |
OPERATING_MODE Get_Cur_Mode(void); |
void Update_OLED(void); |
void Draw_Manual_Text(uint8_t selected); |
void Draw_Auto_Text(uint8_t selected); |
void Draw_Step_Text(STEPPER_MICROSTEP step, uint8_t selected); |
void Draw_Stepper_Current(void); |
void Draw_Pot_Value(void); |
#endif /* DEFINES_H */ |
//PIC Projects/PICX_16F1825_Stepper_Driver/funclist |
---|
0,0 → 1,65 |
___awdiv: CODE, 5299 0 84 |
_TIMER_2_Init: CODE, 4280 0 29 |
_TIMER_2_Stop: CODE, 8075 0 3 |
_IOC_Interrupt_Handler: CODE, 5383 0 85 |
_Update_OLED: CODE, 5468 0 85 |
_TIMER_2_Start: CODE, 8072 0 3 |
_Set_Next_Mode: CODE, 2024 0 24 |
__stringdata: STRCODE, 1541 0 10 |
_Draw_Auto_Text: CODE, 5068 0 76 |
_SSD1306_Set_Cursor: CODE, 4115 0 20 |
_Draw_Pot_Value: CODE, 4732 0 51 |
___ftpack: CODE, 5553 0 97 |
_IOC_Init: CODE, 8082 0 7 |
_font: STRCODE, 256 0 1275 |
_dpowers: STRCODE, 1531 0 10 |
_memset: CODE, 4369 0 30 |
_STEPPER_Set_Microstep: CODE, 4835 0 54 |
_main: CODE, 4684 0 48 |
_Interrupt_Enable: CODE, 4096 0 3 |
___lwtoft: CODE, 4155 0 21 |
_TIMER_2_Set_Delay: CODE, 8096 0 11 |
_SSD1306_Draw_Fast_VLine: CODE, 4944 0 59 |
_SSD1306_Abs: CODE, 8142 0 15 |
_SSD1306_Set_Text_Color: CODE, 4135 0 20 |
_InterruptHandler: CODE, 4 0 23 |
_SSD1306_Swap: CODE, 4253 0 27 |
_SSD1306_Init: CODE, 2048 0 95 |
_SPI_Write: CODE, 4431 0 34 |
_Draw_Manual_Text: CODE, 5144 0 76 |
_Get_Cur_Mode: CODE, 8069 0 3 |
_SSD1306_Write: CODE, 2627 0 261 |
_SSD1306_Begin: CODE, 5650 0 126 |
_STEPPER_Set_Next_Step: CODE, 4399 0 32 |
_Interrupt_Init: CODE, 3 0 1 |
__initialization: CODE, 29 0 51 |
_SSD1306_Write_String: CODE, 4176 0 25 |
___lwdiv: CODE, 4889 0 55 |
_SSD1306_Draw_Line: CODE, 2367 0 260 |
_TIMER_2_Interrupt_Handler: CODE, 5220 0 79 |
_SSD1306_Draw_Char: CODE, 1551 0 473 |
_STEPPER_Step: CODE, 4309 0 30 |
_Draw_Stepper_Current: CODE, 5956 0 188 |
_SSD1306_Fill_Rect: CODE, 5003 0 65 |
_SPI_Init: CODE, 4465 0 40 |
_isdigit: CODE, 8157 0 15 |
_sprintf: CODE, 3186 0 398 |
_Draw_Step_Text: CODE, 2888 0 298 |
_SSD1306_Set_Text_Size: CODE, 4227 0 26 |
___lwmod: CODE, 4637 0 47 |
_SSD1306_Clear_Display: CODE, 4099 0 16 |
___ftmul: CODE, 5776 0 180 |
_TIMER_Init: CODE, 8089 0 7 |
_ADC_Read: CODE, 4783 0 52 |
_SSD1306_Command: CODE, 8172 0 20 |
_SSD1306_Draw_Pixel: CODE, 2143 0 224 |
___wmul: CODE, 4339 0 30 |
_ADC_Init: CODE, 8107 0 11 |
_SSD1306_Display: CODE, 4201 0 26 |
_SSD1306_Set_Text_Wrap: CODE, 8118 0 12 |
_STEPPER_Toggle_Auto: CODE, 4548 0 44 |
___fttol: CODE, 84 0 135 |
_Pins_Init: CODE, 4505 0 43 |
i1_ADC_Read: CODE, 4592 0 45 |
_STEPPER_Get_Cur_Step: CODE, 253 0 3 |
Total: 5696 |
//PIC Projects/PICX_16F1825_Stepper_Driver/l.obj |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
//PIC Projects/PICX_16F1825_Stepper_Driver/l.obj |
---|
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
//PIC Projects/PICX_16F1825_Stepper_Driver/main.c |
---|
0,0 → 1,234 |
// <editor-fold defaultstate="collapsed" desc="Configuration Bits"> |
// PIC16F1825 Configuration Bit Settings |
// CONFIG1 |
#pragma config FOSC = INTOSC // Oscillator Selection (INTOSC oscillator: I/O function on CLKIN pin) |
#pragma config WDTE = OFF // Watchdog Timer Enable (WDT enabled) |
#pragma config PWRTE = OFF // Power-up Timer Enable (PWRT disabled) |
#pragma config MCLRE = OFF // MCLR Pin Function Select (MCLR/VPP pin function is digital input) |
#pragma config CP = OFF // Flash Program Memory Code Protection (Program memory code protection is disabled) |
#pragma config CPD = OFF // Data Memory Code Protection (Data memory code protection is disabled) |
#pragma config BOREN = ON // Brown-out Reset Enable (Brown-out Reset enabled) |
#pragma config CLKOUTEN = OFF // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin) |
#pragma config IESO = ON // Internal/External Switchover (Internal/External Switchover mode is enabled) |
#pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is enabled) |
// CONFIG2 |
#pragma config WRT = OFF // Flash Memory Self-Write Protection (Write protection off) |
#pragma config PLLEN = ON // PLL Enable (4x PLL enabled) |
#pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable (Stack Overflow or Underflow will cause a Reset) |
#pragma config BORV = LO // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), low trip point selected.) |
#pragma config LVP = OFF // Low-Voltage Programming Enable (High-voltage on MCLR/VPP must be used for programming) |
// </editor-fold> |
#include "defines.h" |
#include "INTERRUPTS.h" |
#include "STEPPER.h" |
#include "IOC.h" |
#include "SPI.h" |
#include "ADC.h" |
#include "OLED_SSD1306.h" |
#include "TIMER.h" |
#include <stdio.h> |
void Pins_Init(void) { |
// RA0 and RA1 pins as analog input |
ANSELA = 0x3; |
ANSELC = 0x0; |
// // Enable weak pull-up if WPU bit is set |
// OPTION_REGbits.nWPUEN = 0; |
// SDO1 on RC2 |
APFCON0bits.SDOSEL = 0; |
// Stepper Driver |
STEP_TRIS = 0; |
STEP_LAT = 0; |
M0_TRIS = 0; |
M0_LAT = 0; |
M1_TRIS = 0; |
M1_LAT = 0; |
M2_TRIS = 0; |
M2_LAT = 0; |
// I/O |
SW_1_TRIS = 1; |
SW_1_INLVL = 1; |
SW_2_TRIS = 1; |
SW_2_INLVL = 1; |
STEP_CURRENT_TRIS = 1; |
POT_CURRENT_TRIS = 1; |
// SPI |
SPI_MOSI_TRIS = 0; |
SPI_CLK_TRIS = 0; |
SPI_DC_SELECT_TRIS = 0; |
SPI_DC_SELECT_LAT = 0; |
SPI_RESET_TRIS = 0; |
SPI_RESET_LAT = 0; |
} |
OPERATING_MODE currMode; |
int main(void) { |
// Set internal oscillator speed to 32MHz |
OSCCONbits.SPLLEN = 1; // 4x PLL enable (overwritten by config bits) |
OSCCONbits.IRCF = 0xE; // Base frequency @ 8MHz |
OSCCONbits.SCS = 0b00; // System clock determined by config bits |
// Initialize I/O |
Pins_Init(); |
IOC_Init(); |
ADC_Init(); |
TIMER_DATA timer_data; |
TIMER_Init(&timer_data); |
SPI_DATA spi_data; |
SPI_Init(&spi_data, SPI2_FOSC_16); |
SSD1306_DATA ssd1306_data; |
SSD1306_Init(&ssd1306_data); |
Interrupt_Init(); |
Interrupt_Enable(); |
currMode = SINGLE_STEP; |
SSD1306_Begin(SSD1306_SWITCHCAPVCC); |
while(1) { |
Update_OLED(); |
// __delay_ms(1); |
} |
} |
void Set_Next_Mode() { |
switch (currMode) { |
case SINGLE_STEP: |
currMode = AUTO_STEP; |
break; |
case AUTO_STEP: |
currMode = SET_MICROSTEP; |
break; |
case SET_MICROSTEP: |
default: |
currMode = SINGLE_STEP; |
break; |
} |
} |
OPERATING_MODE Get_Cur_Mode(void) { |
return currMode; |
} |
void Update_OLED(void) { |
SSD1306_Clear_Display(); |
SSD1306_Set_Text_Size(2); |
SSD1306_Set_Text_Wrap(0); |
switch (currMode) { |
case SINGLE_STEP: |
Draw_Manual_Text(1); |
Draw_Auto_Text(0); |
Draw_Step_Text(STEPPER_Get_Cur_Step(), 0); |
break; |
case AUTO_STEP: |
Draw_Manual_Text(0); |
Draw_Auto_Text(1); |
Draw_Step_Text(STEPPER_Get_Cur_Step(), 0); |
break; |
case SET_MICROSTEP: |
Draw_Manual_Text(0); |
Draw_Auto_Text(0); |
Draw_Step_Text(STEPPER_Get_Cur_Step(), 1); |
break; |
} |
Draw_Stepper_Current(); |
Draw_Pot_Value(); |
SSD1306_Display(); |
} |
void Draw_Manual_Text(uint8_t selected) { |
// Draw and/or highlight the stepping mode in the top left corner |
uint8_t stringManual[] = "MANUAL"; |
if (selected) { |
SSD1306_Fill_Rect(0, 0, 75, 16, 1); |
SSD1306_Set_Text_Color(0); |
} else { |
SSD1306_Set_Text_Color(1); |
} |
SSD1306_Set_Cursor(3, 1); |
SSD1306_Write_String(stringManual, 6); |
} |
void Draw_Auto_Text(uint8_t selected) { |
// Draw and/or highlight the stepping mode in the top right corner |
uint8_t stringAuto[] = "AUTO"; |
if (selected) { |
SSD1306_Fill_Rect(76, 0, 53, 16, 1); |
SSD1306_Set_Text_Color(0); |
} else { |
SSD1306_Set_Text_Color(1); |
} |
SSD1306_Set_Cursor(79, 1); |
SSD1306_Write_String(stringAuto, 4); |
} |
void Draw_Stepper_Current() { |
// Draw the stepper motor current draw in the bottom right corner |
uint8_t buffer[6] = {0}; |
uint16_t potVoltage = ADC_Read(STEP_ADC_CHANNEL); |
// Compute current from voltage reading (2x) |
uint16_t current = potVoltage * 0.3222 * 2; |
uint8_t preDecimal = current / 100; |
uint8_t postDecimal = current % 100; |
sprintf(buffer, "%1d.%02dA", preDecimal, postDecimal); |
SSD1306_Set_Text_Color(1); |
SSD1306_Set_Cursor(67, 17); |
SSD1306_Write_String(buffer, 5); |
} |
void Draw_Pot_Value() { |
// Draw a line indicating auto rotation delay |
uint8_t potVoltage = ADC_Read(POT_ADC_CHANNEL) >> 4; |
SSD1306_Draw_Line(127, 31, 127 - potVoltage, 31, 1); |
} |
void Draw_Step_Text(STEPPER_MICROSTEP step, uint8_t selected) { |
// Draw and/or highlight the stepping in the bottom left corner |
uint8_t stringStepping32[] = "1/32"; |
uint8_t stringStepping16[] = "1/16"; |
uint8_t stringStepping8[] = "1/8"; |
uint8_t stringStepping4[] = "1/4"; |
uint8_t stringStepping2[] = "1/2"; |
uint8_t stringStepping1[] = "1/1"; |
if (selected) { |
SSD1306_Fill_Rect(0, 16, 52, 16, 1); |
SSD1306_Set_Text_Color(0); |
} else { |
SSD1306_Set_Text_Color(1); |
} |
if (step == STEP_1_32) { |
SSD1306_Set_Cursor(2, 17); |
SSD1306_Write_String(stringStepping32, 4); |
} else if (step == STEP_1_16) { |
SSD1306_Set_Cursor(2, 17); |
SSD1306_Write_String(stringStepping16, 4); |
} else if (step == STEP_1_8) { |
SSD1306_Set_Cursor(8, 17); |
SSD1306_Write_String(stringStepping8, 3); |
} else if (step == STEP_1_4) { |
SSD1306_Set_Cursor(8, 17); |
SSD1306_Write_String(stringStepping4, 3); |
} else if (step == STEP_1_2) { |
SSD1306_Set_Cursor(8, 17); |
SSD1306_Write_String(stringStepping2, 3); |
} else if (step == STEP_1_1) { |
SSD1306_Set_Cursor(8, 17); |
SSD1306_Write_String(stringStepping1, 3); |
} |
} |
//PIC Projects/PICX_16F1825_Stepper_Driver/nbproject/Makefile-default.mk |
---|
0,0 → 1,252 |
# |
# Generated Makefile - do not edit! |
# |
# Edit the Makefile in the project folder instead (../Makefile). Each target |
# has a -pre and a -post target defined where you can add customized code. |
# |
# This makefile implements configuration specific macros and targets. |
# Include project Makefile |
ifeq "${IGNORE_LOCAL}" "TRUE" |
# do not include local makefile. User is passing all local related variables already |
else |
include Makefile |
# Include makefile containing local settings |
ifeq "$(wildcard nbproject/Makefile-local-default.mk)" "nbproject/Makefile-local-default.mk" |
include nbproject/Makefile-local-default.mk |
endif |
endif |
# Environment |
MKDIR=gnumkdir -p |
RM=rm -f |
MV=mv |
CP=cp |
# Macros |
CND_CONF=default |
ifeq ($(TYPE_IMAGE), DEBUG_RUN) |
IMAGE_TYPE=debug |
OUTPUT_SUFFIX=elf |
DEBUGGABLE_SUFFIX=elf |
FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/PICX_16F1825_Stepper_Driver.${IMAGE_TYPE}.${OUTPUT_SUFFIX} |
else |
IMAGE_TYPE=production |
OUTPUT_SUFFIX=hex |
DEBUGGABLE_SUFFIX=elf |
FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/PICX_16F1825_Stepper_Driver.${IMAGE_TYPE}.${OUTPUT_SUFFIX} |
endif |
# Object Directory |
OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} |
# Distribution Directory |
DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} |
# Source Files Quoted if spaced |
SOURCEFILES_QUOTED_IF_SPACED=main.c INTERRUPTS.c STEPPER.c IOC.c SPI.c OLED_SSD1306.c ADC.c TIMER.c |
# Object Files Quoted if spaced |
OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/main.p1 ${OBJECTDIR}/INTERRUPTS.p1 ${OBJECTDIR}/STEPPER.p1 ${OBJECTDIR}/IOC.p1 ${OBJECTDIR}/SPI.p1 ${OBJECTDIR}/OLED_SSD1306.p1 ${OBJECTDIR}/ADC.p1 ${OBJECTDIR}/TIMER.p1 |
POSSIBLE_DEPFILES=${OBJECTDIR}/main.p1.d ${OBJECTDIR}/INTERRUPTS.p1.d ${OBJECTDIR}/STEPPER.p1.d ${OBJECTDIR}/IOC.p1.d ${OBJECTDIR}/SPI.p1.d ${OBJECTDIR}/OLED_SSD1306.p1.d ${OBJECTDIR}/ADC.p1.d ${OBJECTDIR}/TIMER.p1.d |
# Object Files |
OBJECTFILES=${OBJECTDIR}/main.p1 ${OBJECTDIR}/INTERRUPTS.p1 ${OBJECTDIR}/STEPPER.p1 ${OBJECTDIR}/IOC.p1 ${OBJECTDIR}/SPI.p1 ${OBJECTDIR}/OLED_SSD1306.p1 ${OBJECTDIR}/ADC.p1 ${OBJECTDIR}/TIMER.p1 |
# Source Files |
SOURCEFILES=main.c INTERRUPTS.c STEPPER.c IOC.c SPI.c OLED_SSD1306.c ADC.c TIMER.c |
CFLAGS= |
ASFLAGS= |
LDLIBSOPTIONS= |
############# Tool locations ########################################## |
# If you copy a project from one host to another, the path where the # |
# compiler is installed may be different. # |
# If you open this project with MPLAB X in the new host, this # |
# makefile will be regenerated and the paths will be corrected. # |
####################################################################### |
# fixDeps replaces a bunch of sed/cat/printf statements that slow down the build |
FIXDEPS=fixDeps |
.build-conf: ${BUILD_SUBPROJECTS} |
${MAKE} ${MAKE_OPTIONS} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/PICX_16F1825_Stepper_Driver.${IMAGE_TYPE}.${OUTPUT_SUFFIX} |
MP_PROCESSOR_OPTION=16F1825 |
# ------------------------------------------------------------------------------------ |
# Rules for buildStep: compile |
ifeq ($(TYPE_IMAGE), DEBUG_RUN) |
${OBJECTDIR}/main.p1: main.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/main.p1.d |
@${RM} ${OBJECTDIR}/main.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/main.p1 main.c |
@-${MV} ${OBJECTDIR}/main.d ${OBJECTDIR}/main.p1.d |
@${FIXDEPS} ${OBJECTDIR}/main.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
${OBJECTDIR}/INTERRUPTS.p1: INTERRUPTS.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/INTERRUPTS.p1.d |
@${RM} ${OBJECTDIR}/INTERRUPTS.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/INTERRUPTS.p1 INTERRUPTS.c |
@-${MV} ${OBJECTDIR}/INTERRUPTS.d ${OBJECTDIR}/INTERRUPTS.p1.d |
@${FIXDEPS} ${OBJECTDIR}/INTERRUPTS.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
${OBJECTDIR}/STEPPER.p1: STEPPER.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/STEPPER.p1.d |
@${RM} ${OBJECTDIR}/STEPPER.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/STEPPER.p1 STEPPER.c |
@-${MV} ${OBJECTDIR}/STEPPER.d ${OBJECTDIR}/STEPPER.p1.d |
@${FIXDEPS} ${OBJECTDIR}/STEPPER.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
${OBJECTDIR}/IOC.p1: IOC.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/IOC.p1.d |
@${RM} ${OBJECTDIR}/IOC.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/IOC.p1 IOC.c |
@-${MV} ${OBJECTDIR}/IOC.d ${OBJECTDIR}/IOC.p1.d |
@${FIXDEPS} ${OBJECTDIR}/IOC.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
${OBJECTDIR}/SPI.p1: SPI.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/SPI.p1.d |
@${RM} ${OBJECTDIR}/SPI.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/SPI.p1 SPI.c |
@-${MV} ${OBJECTDIR}/SPI.d ${OBJECTDIR}/SPI.p1.d |
@${FIXDEPS} ${OBJECTDIR}/SPI.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
${OBJECTDIR}/OLED_SSD1306.p1: OLED_SSD1306.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/OLED_SSD1306.p1.d |
@${RM} ${OBJECTDIR}/OLED_SSD1306.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/OLED_SSD1306.p1 OLED_SSD1306.c |
@-${MV} ${OBJECTDIR}/OLED_SSD1306.d ${OBJECTDIR}/OLED_SSD1306.p1.d |
@${FIXDEPS} ${OBJECTDIR}/OLED_SSD1306.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
${OBJECTDIR}/ADC.p1: ADC.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/ADC.p1.d |
@${RM} ${OBJECTDIR}/ADC.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/ADC.p1 ADC.c |
@-${MV} ${OBJECTDIR}/ADC.d ${OBJECTDIR}/ADC.p1.d |
@${FIXDEPS} ${OBJECTDIR}/ADC.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
${OBJECTDIR}/TIMER.p1: TIMER.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/TIMER.p1.d |
@${RM} ${OBJECTDIR}/TIMER.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/TIMER.p1 TIMER.c |
@-${MV} ${OBJECTDIR}/TIMER.d ${OBJECTDIR}/TIMER.p1.d |
@${FIXDEPS} ${OBJECTDIR}/TIMER.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
else |
${OBJECTDIR}/main.p1: main.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/main.p1.d |
@${RM} ${OBJECTDIR}/main.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/main.p1 main.c |
@-${MV} ${OBJECTDIR}/main.d ${OBJECTDIR}/main.p1.d |
@${FIXDEPS} ${OBJECTDIR}/main.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
${OBJECTDIR}/INTERRUPTS.p1: INTERRUPTS.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/INTERRUPTS.p1.d |
@${RM} ${OBJECTDIR}/INTERRUPTS.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/INTERRUPTS.p1 INTERRUPTS.c |
@-${MV} ${OBJECTDIR}/INTERRUPTS.d ${OBJECTDIR}/INTERRUPTS.p1.d |
@${FIXDEPS} ${OBJECTDIR}/INTERRUPTS.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
${OBJECTDIR}/STEPPER.p1: STEPPER.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/STEPPER.p1.d |
@${RM} ${OBJECTDIR}/STEPPER.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/STEPPER.p1 STEPPER.c |
@-${MV} ${OBJECTDIR}/STEPPER.d ${OBJECTDIR}/STEPPER.p1.d |
@${FIXDEPS} ${OBJECTDIR}/STEPPER.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
${OBJECTDIR}/IOC.p1: IOC.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/IOC.p1.d |
@${RM} ${OBJECTDIR}/IOC.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/IOC.p1 IOC.c |
@-${MV} ${OBJECTDIR}/IOC.d ${OBJECTDIR}/IOC.p1.d |
@${FIXDEPS} ${OBJECTDIR}/IOC.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
${OBJECTDIR}/SPI.p1: SPI.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/SPI.p1.d |
@${RM} ${OBJECTDIR}/SPI.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/SPI.p1 SPI.c |
@-${MV} ${OBJECTDIR}/SPI.d ${OBJECTDIR}/SPI.p1.d |
@${FIXDEPS} ${OBJECTDIR}/SPI.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
${OBJECTDIR}/OLED_SSD1306.p1: OLED_SSD1306.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/OLED_SSD1306.p1.d |
@${RM} ${OBJECTDIR}/OLED_SSD1306.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/OLED_SSD1306.p1 OLED_SSD1306.c |
@-${MV} ${OBJECTDIR}/OLED_SSD1306.d ${OBJECTDIR}/OLED_SSD1306.p1.d |
@${FIXDEPS} ${OBJECTDIR}/OLED_SSD1306.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
${OBJECTDIR}/ADC.p1: ADC.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/ADC.p1.d |
@${RM} ${OBJECTDIR}/ADC.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/ADC.p1 ADC.c |
@-${MV} ${OBJECTDIR}/ADC.d ${OBJECTDIR}/ADC.p1.d |
@${FIXDEPS} ${OBJECTDIR}/ADC.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
${OBJECTDIR}/TIMER.p1: TIMER.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/TIMER.p1.d |
@${RM} ${OBJECTDIR}/TIMER.p1 |
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/TIMER.p1 TIMER.c |
@-${MV} ${OBJECTDIR}/TIMER.d ${OBJECTDIR}/TIMER.p1.d |
@${FIXDEPS} ${OBJECTDIR}/TIMER.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ |
endif |
# ------------------------------------------------------------------------------------ |
# Rules for buildStep: assemble |
ifeq ($(TYPE_IMAGE), DEBUG_RUN) |
else |
endif |
# ------------------------------------------------------------------------------------ |
# Rules for buildStep: link |
ifeq ($(TYPE_IMAGE), DEBUG_RUN) |
dist/${CND_CONF}/${IMAGE_TYPE}/PICX_16F1825_Stepper_Driver.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} |
${MP_CC} $(MP_EXTRA_LD_PRE) --chip=$(MP_PROCESSOR_OPTION) -G -mdist/${CND_CONF}/${IMAGE_TYPE}/PICX_16F1825_Stepper_Driver.${IMAGE_TYPE}.map -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -odist/${CND_CONF}/${IMAGE_TYPE}/PICX_16F1825_Stepper_Driver.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} |
@${RM} dist/${CND_CONF}/${IMAGE_TYPE}/PICX_16F1825_Stepper_Driver.${IMAGE_TYPE}.hex |
else |
dist/${CND_CONF}/${IMAGE_TYPE}/PICX_16F1825_Stepper_Driver.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} |
${MP_CC} $(MP_EXTRA_LD_PRE) --chip=$(MP_PROCESSOR_OPTION) -G -mdist/${CND_CONF}/${IMAGE_TYPE}/PICX_16F1825_Stepper_Driver.${IMAGE_TYPE}.map --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%%f:%%l: error: %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -odist/${CND_CONF}/${IMAGE_TYPE}/PICX_16F1825_Stepper_Driver.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} |
endif |
# Subprojects |
.build-subprojects: |
# Subprojects |
.clean-subprojects: |
# Clean Targets |
.clean-conf: ${CLEAN_SUBPROJECTS} |
${RM} -r build/default |
${RM} -r dist/default |
# Enable dependency checking |
.dep.inc: .depcheck-impl |
DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) |
ifneq (${DEPFILES},) |
include ${DEPFILES} |
endif |
//PIC Projects/PICX_16F1825_Stepper_Driver/nbproject/Makefile-genesis.properties |
---|
0,0 → 1,8 |
# |
#Thu Sep 04 00:52:07 EDT 2014 |
default.languagetoolchain.dir=C\:\\Program Files (x86)\\Microchip\\xc8\\v1.32\\bin |
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=1f98a0eed69cb2a45c12981fa9470927 |
default.languagetoolchain.version=1.32 |
host.platform=windows |
conf.ids=default |
default.com-microchip-mplab-nbide-toolchainXC8-XC8LanguageToolchain.md5=52258db7536b2d1fec300cefc7ed9230 |
//PIC Projects/PICX_16F1825_Stepper_Driver/nbproject/configurations.xml |
---|
0,0 → 1,174 |
<?xml version="1.0" encoding="UTF-8"?> |
<configurationDescriptor version="62"> |
<logicalFolder name="root" displayName="root" projectFiles="true"> |
<logicalFolder name="HeaderFiles" |
displayName="Header Files" |
projectFiles="true"> |
<itemPath>defines.h</itemPath> |
<itemPath>INTERRUPTS.h</itemPath> |
<itemPath>STEPPER.h</itemPath> |
<itemPath>IOC.h</itemPath> |
<itemPath>SPI.h</itemPath> |
<itemPath>OLED_SSD1306.h</itemPath> |
<itemPath>ADC.h</itemPath> |
<itemPath>TIMER.h</itemPath> |
</logicalFolder> |
<logicalFolder name="LinkerScript" |
displayName="Linker Files" |
projectFiles="true"> |
</logicalFolder> |
<logicalFolder name="SourceFiles" |
displayName="Source Files" |
projectFiles="true"> |
<itemPath>main.c</itemPath> |
<itemPath>INTERRUPTS.c</itemPath> |
<itemPath>STEPPER.c</itemPath> |
<itemPath>IOC.c</itemPath> |
<itemPath>SPI.c</itemPath> |
<itemPath>OLED_SSD1306.c</itemPath> |
<itemPath>ADC.c</itemPath> |
<itemPath>TIMER.c</itemPath> |
</logicalFolder> |
<logicalFolder name="ExternalFiles" |
displayName="Important Files" |
projectFiles="false"> |
<itemPath>Makefile</itemPath> |
</logicalFolder> |
</logicalFolder> |
<projectmakefile>Makefile</projectmakefile> |
<confs> |
<conf name="default" type="2"> |
<toolsSet> |
<developmentServer>localhost</developmentServer> |
<targetDevice>PIC16F1825</targetDevice> |
<targetHeader></targetHeader> |
<targetPluginBoard></targetPluginBoard> |
<platformTool>PICkit3PlatformTool</platformTool> |
<languageToolchain>XC8</languageToolchain> |
<languageToolchainVersion>1.32</languageToolchainVersion> |
<platform>3</platform> |
</toolsSet> |
<compileType> |
<linkerTool> |
<linkerLibItems> |
</linkerLibItems> |
</linkerTool> |
<loading> |
<useAlternateLoadableFile>false</useAlternateLoadableFile> |
<alternateLoadableFile></alternateLoadableFile> |
</loading> |
</compileType> |
<makeCustomizationType> |
<makeCustomizationPreStepEnabled>false</makeCustomizationPreStepEnabled> |
<makeCustomizationPreStep></makeCustomizationPreStep> |
<makeCustomizationPostStepEnabled>false</makeCustomizationPostStepEnabled> |
<makeCustomizationPostStep></makeCustomizationPostStep> |
<makeCustomizationPutChecksumInUserID>false</makeCustomizationPutChecksumInUserID> |
<makeCustomizationEnableLongLines>false</makeCustomizationEnableLongLines> |
<makeCustomizationNormalizeHexFile>false</makeCustomizationNormalizeHexFile> |
</makeCustomizationType> |
<HI-TECH-COMP> |
<property key="asmlist" value="true"/> |
<property key="define-macros" value=""/> |
<property key="extra-include-directories" value=""/> |
<property key="identifier-length" value="255"/> |
<property key="operation-mode" value="free"/> |
<property key="opt-xc8-compiler-strict_ansi" value="false"/> |
<property key="optimization-assembler" value="true"/> |
<property key="optimization-assembler-files" value="true"/> |
<property key="optimization-debug" value="false"/> |
<property key="optimization-global" value="true"/> |
<property key="optimization-level" value="9"/> |
<property key="optimization-set" value="default"/> |
<property key="optimization-speed" value="true"/> |
<property key="preprocess-assembler" value="true"/> |
<property key="undefine-macros" value=""/> |
<property key="use-cci" value="false"/> |
<property key="use-iar" value="false"/> |
<property key="verbose" value="false"/> |
<property key="warning-level" value="0"/> |
<property key="what-to-do" value="ignore"/> |
</HI-TECH-COMP> |
<HI-TECH-LINK> |
<property key="additional-options-checksum" value=""/> |
<property key="additional-options-code-offset" value=""/> |
<property key="additional-options-command-line" value=""/> |
<property key="additional-options-errata" value=""/> |
<property key="additional-options-extend-address" value="false"/> |
<property key="additional-options-trace-type" value=""/> |
<property key="additional-options-use-response-files" value="false"/> |
<property key="backup-reset-condition-flags" value="false"/> |
<property key="calibrate-oscillator" value="true"/> |
<property key="calibrate-oscillator-value" value=""/> |
<property key="clear-bss" value="true"/> |
<property key="code-model-external" value="wordwrite"/> |
<property key="code-model-rom" value=""/> |
<property key="create-html-files" value="false"/> |
<property key="data-model-ram" value=""/> |
<property key="data-model-size-of-double" value="24"/> |
<property key="data-model-size-of-float" value="24"/> |
<property key="display-class-usage" value="false"/> |
<property key="display-hex-usage" value="false"/> |
<property key="display-overall-usage" value="true"/> |
<property key="display-psect-usage" value="false"/> |
<property key="fill-flash-options-addr" value=""/> |
<property key="fill-flash-options-const" value=""/> |
<property key="fill-flash-options-how" value="0"/> |
<property key="fill-flash-options-inc-const" value="1"/> |
<property key="fill-flash-options-increment" value=""/> |
<property key="fill-flash-options-seq" value=""/> |
<property key="fill-flash-options-what" value="0"/> |
<property key="format-hex-file-for-download" value="false"/> |
<property key="initialize-data" value="true"/> |
<property key="keep-generated-startup.as" value="false"/> |
<property key="link-in-c-library" value="true"/> |
<property key="link-in-peripheral-library" value="true"/> |
<property key="managed-stack" value="false"/> |
<property key="opt-xc8-linker-file" value="false"/> |
<property key="opt-xc8-linker-link_startup" value="false"/> |
<property key="opt-xc8-linker-serial" value=""/> |
<property key="program-the-device-with-default-config-words" value="true"/> |
</HI-TECH-LINK> |
<PICkit3PlatformTool> |
<property key="AutoSelectMemRanges" value="auto"/> |
<property key="Freeze Peripherals" value="true"/> |
<property key="SecureSegment.SegmentProgramming" value="FullChipProgramming"/> |
<property key="ToolFirmwareFilePath" |
value="Press to browse for a specific firmware version"/> |
<property key="ToolFirmwareOption.UseLatestFirmware" value="true"/> |
<property key="firmware.download.all" value="false"/> |
<property key="hwtoolclock.frcindebug" value="false"/> |
<property key="memories.aux" value="false"/> |
<property key="memories.bootflash" value="false"/> |
<property key="memories.configurationmemory" value="false"/> |
<property key="memories.eeprom" value="false"/> |
<property key="memories.flashdata" value="true"/> |
<property key="memories.id" value="false"/> |
<property key="memories.programmemory" value="true"/> |
<property key="memories.programmemory.end" value="0x1fff"/> |
<property key="memories.programmemory.start" value="0x0"/> |
<property key="poweroptions.powerenable" value="false"/> |
<property key="programmertogo.imagename" value=""/> |
<property key="programoptions.eraseb4program" value="true"/> |
<property key="programoptions.pgmspeed" value="2"/> |
<property key="programoptions.preserveeeprom" value="false"/> |
<property key="programoptions.preserveprogramrange" value="false"/> |
<property key="programoptions.preserveprogramrange.end" value="0x1fff"/> |
<property key="programoptions.preserveprogramrange.start" value="0x0"/> |
<property key="programoptions.preserveuserid" value="false"/> |
<property key="programoptions.testmodeentrymethod" value="VPPFirst"/> |
<property key="programoptions.usehighvoltageonmclr" value="false"/> |
<property key="programoptions.uselvpprogramming" value="false"/> |
<property key="voltagevalue" value="3.25"/> |
</PICkit3PlatformTool> |
<XC8-config-global> |
<property key="advanced-elf" value="true"/> |
<property key="output-file-format" value="-mcof,+elf"/> |
<property key="stack-size-high" value="auto"/> |
<property key="stack-size-low" value="auto"/> |
<property key="stack-size-main" value="auto"/> |
<property key="stack-type" value="compiled"/> |
</XC8-config-global> |
</conf> |
</confs> |
</configurationDescriptor> |
//PIC Projects/PICX_16F1825_Stepper_Driver/nbproject/private/configurations.xml |
---|
0,0 → 1,25 |
<?xml version="1.0" encoding="UTF-8"?> |
<configurationDescriptor version="62"> |
<projectmakefile>Makefile</projectmakefile> |
<defaultConf>0</defaultConf> |
<confs> |
<conf name="default" type="2"> |
<platformToolSN>:=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>900A:=<rev>0002:=<man>Microchip Technology Inc.:=<prod>PICkit 3:=<sn>BUR114189291:=<drv>x:=<xpt>h:=end</platformToolSN> |
<languageToolchainDir>C:\Program Files (x86)\Microchip\xc8\v1.32\bin</languageToolchainDir> |
<mdbdebugger version="1"> |
<placeholder1>place holder 1</placeholder1> |
<placeholder2>place holder 2</placeholder2> |
</mdbdebugger> |
<runprofile version="6"> |
<args></args> |
<rundir></rundir> |
<buildfirst>true</buildfirst> |
<console-type>0</console-type> |
<terminal-type>0</terminal-type> |
<remove-instrumentation>0</remove-instrumentation> |
<environment> |
</environment> |
</runprofile> |
</conf> |
</confs> |
</configurationDescriptor> |
//PIC Projects/PICX_16F1825_Stepper_Driver/nbproject/private/SuppressibleMessageMemo.properties |
---|
0,0 → 1,3 |
# |
#Thu Apr 03 21:51:18 EDT 2014 |
pk3/CHECK_4_HIGH_VOLTAGE_VPP=true |
//PIC Projects/PICX_16F1825_Stepper_Driver/nbproject/private/private.xml |
---|
0,0 → 1,3 |
<?xml version="1.0" encoding="UTF-8"?><project-private xmlns="http://www.netbeans.org/ns/project-private/1"> |
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/> |
</project-private> |
//PIC Projects/PICX_16F1825_Stepper_Driver/nbproject/Makefile-local-default.mk |
---|
0,0 → 1,37 |
# |
# Generated Makefile - do not edit! |
# |
# |
# This file contains information about the location of compilers and other tools. |
# If you commmit this file into your revision control server, you will be able to |
# to checkout the project and build it from the command line with make. However, |
# if more than one person works on the same project, then this file might show |
# conflicts since different users are bound to have compilers in different places. |
# In that case you might choose to not commit this file and let MPLAB X recreate this file |
# for each user. The disadvantage of not commiting this file is that you must run MPLAB X at |
# least once so the file gets created and the project can be built. Finally, you can also |
# avoid using this file at all if you are only building from the command line with make. |
# You can invoke make with the values of the macros: |
# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... |
# |
SHELL=cmd.exe |
PATH_TO_IDE_BIN=C:/Program Files (x86)/Microchip/MPLABX/mplab_ide/mplab_ide/modules/../../bin/ |
# Adding MPLAB X bin directory to path. |
PATH:=C:/Program Files (x86)/Microchip/MPLABX/mplab_ide/mplab_ide/modules/../../bin/:$(PATH) |
# Path to java used to run MPLAB X when this makefile was created |
MP_JAVA_PATH="C:\Program Files (x86)\Microchip\MPLABX\sys\java\jre1.7.0_25-windows-x64\java-windows/bin/" |
OS_CURRENT="$(shell uname -s)" |
MP_CC="C:\Program Files (x86)\Microchip\xc8\v1.32\bin\xc8.exe" |
# MP_CPPC is not defined |
# MP_BC is not defined |
# MP_AS is not defined |
# MP_LD is not defined |
# MP_AR is not defined |
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\xc8\v1.32\bin" |
# MP_CPPC_DIR is not defined |
# MP_BC_DIR is not defined |
# MP_AS_DIR is not defined |
# MP_LD_DIR is not defined |
# MP_AR_DIR is not defined |
# MP_BC_DIR is not defined |
//PIC Projects/PICX_16F1825_Stepper_Driver/nbproject/Makefile-impl.mk |
---|
0,0 → 1,69 |
# |
# Generated Makefile - do not edit! |
# |
# Edit the Makefile in the project folder instead (../Makefile). Each target |
# has a pre- and a post- target defined where you can add customization code. |
# |
# This makefile implements macros and targets common to all configurations. |
# |
# NOCDDL |
# Building and Cleaning subprojects are done by default, but can be controlled with the SUB |
# macro. If SUB=no, subprojects will not be built or cleaned. The following macro |
# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf |
# and .clean-reqprojects-conf unless SUB has the value 'no' |
SUB_no=NO |
SUBPROJECTS=${SUB_${SUB}} |
BUILD_SUBPROJECTS_=.build-subprojects |
BUILD_SUBPROJECTS_NO= |
BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} |
CLEAN_SUBPROJECTS_=.clean-subprojects |
CLEAN_SUBPROJECTS_NO= |
CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} |
# Project Name |
PROJECTNAME=PICX_16F1825_Stepper_Driver |
# Active Configuration |
DEFAULTCONF=default |
CONF=${DEFAULTCONF} |
# All Configurations |
ALLCONFS=default |
# build |
.build-impl: .build-pre |
${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf |
# clean |
.clean-impl: .clean-pre |
${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf |
# clobber |
.clobber-impl: .clobber-pre .depcheck-impl |
${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean |
# all |
.all-impl: .all-pre .depcheck-impl |
${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build |
# dependency checking support |
.depcheck-impl: |
# @echo "# This code depends on make tool being used" >.dep.inc |
# @if [ -n "${MAKE_VERSION}" ]; then \ |
# echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ |
# echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ |
# echo "include \$${DEPFILES}" >>.dep.inc; \ |
# echo "endif" >>.dep.inc; \ |
# else \ |
# echo ".KEEP_STATE:" >>.dep.inc; \ |
# echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ |
# fi |
//PIC Projects/PICX_16F1825_Stepper_Driver/nbproject/Makefile-variables.mk |
---|
0,0 → 1,13 |
# |
# Generated - do not edit! |
# |
# NOCDDL |
# |
CND_BASEDIR=`pwd` |
# default configuration |
CND_ARTIFACT_DIR_default=dist/default/production |
CND_ARTIFACT_NAME_default=PICX_16F1825_Stepper_Driver.production.hex |
CND_ARTIFACT_PATH_default=dist/default/production/PICX_16F1825_Stepper_Driver.production.hex |
CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package |
CND_PACKAGE_NAME_default=picx16f1825stepperdriver.tar |
CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/picx16f1825stepperdriver.tar |
//PIC Projects/PICX_16F1825_Stepper_Driver/nbproject/Package-default.bash |
---|
0,0 → 1,73 |
#!/bin/bash -x |
# |
# Generated - do not edit! |
# |
# Macros |
TOP=`pwd` |
CND_CONF=default |
CND_DISTDIR=dist |
TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging |
TMPDIRNAME=tmp-packaging |
OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/PICX_16F1825_Stepper_Driver.${IMAGE_TYPE}.${OUTPUT_SUFFIX} |
OUTPUT_BASENAME=PICX_16F1825_Stepper_Driver.${IMAGE_TYPE}.${OUTPUT_SUFFIX} |
PACKAGE_TOP_DIR=picx16f1825stepperdriver/ |
# Functions |
function checkReturnCode |
{ |
rc=$? |
if [ $rc != 0 ] |
then |
exit $rc |
fi |
} |
function makeDirectory |
# $1 directory path |
# $2 permission (optional) |
{ |
mkdir -p "$1" |
checkReturnCode |
if [ "$2" != "" ] |
then |
chmod $2 "$1" |
checkReturnCode |
fi |
} |
function copyFileToTmpDir |
# $1 from-file path |
# $2 to-file path |
# $3 permission |
{ |
cp "$1" "$2" |
checkReturnCode |
if [ "$3" != "" ] |
then |
chmod $3 "$2" |
checkReturnCode |
fi |
} |
# Setup |
cd "${TOP}" |
mkdir -p ${CND_DISTDIR}/${CND_CONF}/package |
rm -rf ${TMPDIR} |
mkdir -p ${TMPDIR} |
# Copy files and create directories and links |
cd "${TOP}" |
makeDirectory ${TMPDIR}/picx16f1825stepperdriver/bin |
copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 |
# Generate tar file |
cd "${TOP}" |
rm -f ${CND_DISTDIR}/${CND_CONF}/package/picx16f1825stepperdriver.tar |
cd ${TMPDIR} |
tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/picx16f1825stepperdriver.tar * |
checkReturnCode |
# Cleanup |
cd "${TOP}" |
rm -rf ${TMPDIR} |
//PIC Projects/PICX_16F1825_Stepper_Driver/nbproject/project.properties |
---|
--- nbproject/project.xml (nonexistent) |
+++ nbproject/project.xml (revision 342) |
@@ -0,0 +1,16 @@ |
+<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://www.netbeans.org/ns/project/1"> |
+ <type>com.microchip.mplab.nbide.embedded.makeproject</type> |
+ <configuration> |
+ <data xmlns="http://www.netbeans.org/ns/make-project/1"> |
+ <name>PICX_16F1825_Sabertooth</name> |
+ <creation-uuid>a37f9b7c-e474-41b7-9a5b-bc6808e97a44</creation-uuid> |
+ <make-project-type>0</make-project-type> |
+ <c-extensions>c</c-extensions> |
+ <cpp-extensions/> |
+ <header-extensions>h</header-extensions> |
+ <sourceEncoding>ISO-8859-1</sourceEncoding> |
+ <asminc-extensions/> |
+ <make-dep-projects/> |
+ </data> |
+ </configuration> |
+</project> |
//PIC Projects/PICX_16F1825_Stepper_Driver/OLED_SSD1306.c |
---|
0,0 → 1,771 |
#include "defines.h" |
#include <string.h> |
//#include <stdio.h> |
#include "OLED_SSD1306.h" |
#include "SPI.h" |
#include "glcdfont.c" |
static SSD1306_DATA *ssd1306_data_p; |
// 512 (128x32) or 1024 (128x64) bytes allocated for LCD buffer |
// See linker file for details |
static uint8_t LCD_BUFFER[SSD1306_LCDHEIGHT * SSD1306_LCDWIDTH / 8] = { |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, |
0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x80, 0x80, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xF8, 0xE0, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, |
0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0xFF, |
0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, |
0x80, 0xFF, 0xFF, 0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x8C, 0x8E, 0x84, 0x00, 0x00, 0x80, 0xF8, |
0xF8, 0xF8, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0, 0x80, |
0x00, 0xE0, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xC7, 0x01, 0x01, |
0x01, 0x01, 0x83, 0xFF, 0xFF, 0x00, 0x00, 0x7C, 0xFE, 0xC7, 0x01, 0x01, 0x01, 0x01, 0x83, 0xFF, |
0xFF, 0xFF, 0x00, 0x38, 0xFE, 0xC7, 0x83, 0x01, 0x01, 0x01, 0x83, 0xC7, 0xFF, 0xFF, 0x00, 0x00, |
0x01, 0xFF, 0xFF, 0x01, 0x01, 0x00, 0xFF, 0xFF, 0x07, 0x01, 0x01, 0x01, 0x00, 0x00, 0x7F, 0xFF, |
0x80, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x01, 0xFF, |
0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x03, 0x0F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0xC7, 0xC7, 0x8F, |
0x8F, 0x9F, 0xBF, 0xFF, 0xFF, 0xC3, 0xC0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFC, 0xFC, |
0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xF8, 0xF8, 0xF0, 0xF0, 0xE0, 0xC0, 0x00, 0x01, 0x03, 0x03, 0x03, |
0x03, 0x03, 0x01, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, |
0x03, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x03, 0x03, 0x00, 0x00, |
0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, |
0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x01, 0x00, 0x00, 0x00, 0x03, |
0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
#if (SSD1306_LCDHEIGHT == 64) |
0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF9, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x1F, 0x0F, |
0x87, 0xC7, 0xF7, 0xFF, 0xFF, 0x1F, 0x1F, 0x3D, 0xFC, 0xF8, 0xF8, 0xF8, 0xF8, 0x7C, 0x7D, 0xFF, |
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x0F, 0x07, 0x00, 0x30, 0x30, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xC0, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0xC0, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0x3F, 0x1F, |
0x0F, 0x07, 0x1F, 0x7F, 0xFF, 0xFF, 0xF8, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xE0, |
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00, |
0x00, 0xFC, 0xFE, 0xFC, 0x0C, 0x06, 0x06, 0x0E, 0xFC, 0xF8, 0x00, 0x00, 0xF0, 0xF8, 0x1C, 0x0E, |
0x06, 0x06, 0x06, 0x0C, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xFC, |
0xFE, 0xFC, 0x00, 0x18, 0x3C, 0x7E, 0x66, 0xE6, 0xCE, 0x84, 0x00, 0x00, 0x06, 0xFF, 0xFF, 0x06, |
0x06, 0xFC, 0xFE, 0xFC, 0x0C, 0x06, 0x06, 0x06, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00, 0xC0, 0xF8, |
0xFC, 0x4E, 0x46, 0x46, 0x46, 0x4E, 0x7C, 0x78, 0x40, 0x18, 0x3C, 0x76, 0xE6, 0xCE, 0xCC, 0x80, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x0F, 0x1F, 0x1F, 0x3F, 0x3F, 0x3F, 0x3F, 0x1F, 0x0F, 0x03, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, |
0x00, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x03, 0x07, 0x0E, 0x0C, |
0x18, 0x18, 0x0C, 0x06, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x01, 0x0F, 0x0E, 0x0C, 0x18, 0x0C, 0x0F, |
0x07, 0x01, 0x00, 0x04, 0x0E, 0x0C, 0x18, 0x0C, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, |
0x00, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x07, |
0x07, 0x0C, 0x0C, 0x18, 0x1C, 0x0C, 0x06, 0x06, 0x00, 0x04, 0x0E, 0x0C, 0x18, 0x0C, 0x0F, 0x07, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
#endif |
}; |
int16_t SSD1306_Abs(int16_t i) { |
if (i < 0) |
return -i; |
else |
return i; |
} |
void SSD1306_Swap(int16_t *a, int16_t *b) { |
int16_t tmp = *a; |
*a = *b; |
*b = tmp; |
} |
void SSD1306_Init(SSD1306_DATA *data) { |
ssd1306_data_p = data; |
ssd1306_data_p->_height = SSD1306_LCDHEIGHT; |
ssd1306_data_p->HEIGHT = SSD1306_LCDHEIGHT; |
ssd1306_data_p->_width = SSD1306_LCDWIDTH; |
ssd1306_data_p->WIDTH = SSD1306_LCDWIDTH; |
ssd1306_data_p->rotation = 0; |
ssd1306_data_p->cursor_x = ssd1306_data_p->cursor_y = 0; |
ssd1306_data_p->textsize = 1; |
ssd1306_data_p->textcolor = SSD1306_WHITE; |
ssd1306_data_p->textbgcolor = SSD1306_BLACK; |
ssd1306_data_p->wrap = 1; |
} |
void SSD1306_Begin(char vccstate) { |
// Toggle reset pin |
SPI_RESET_LAT = 0; |
__delay_us(10); |
SPI_RESET_LAT = 1; |
#if defined SSD1306_128_32 |
// Init sequence for 128x32 OLED module |
SSD1306_Command(SSD1306_DISPLAYOFF); // 0xAE |
SSD1306_Command(SSD1306_SETDISPLAYCLOCKDIV); // 0xD5 |
SSD1306_Command(0x80); // The suggested ratio 0x80 |
SSD1306_Command(SSD1306_SETMULTIPLEX); // 0xA8 |
SSD1306_Command(0x1F); |
SSD1306_Command(SSD1306_SETDISPLAYOFFSET); // 0xD3 |
SSD1306_Command(0x0); // No offset |
SSD1306_Command(SSD1306_SETSTARTLINE | 0x0); // Line #0 |
SSD1306_Command(SSD1306_CHARGEPUMP); // 0x8D |
if (vccstate == SSD1306_EXTERNALVCC) { |
SSD1306_Command(0x10); |
} else { |
SSD1306_Command(0x14); |
} |
SSD1306_Command(SSD1306_MEMORYMODE); // 0x20 |
SSD1306_Command(0x00); // 0x0 act like ks0108 |
SSD1306_Command(SSD1306_SEGREMAP | 0x1); |
SSD1306_Command(SSD1306_COMSCANDEC); |
SSD1306_Command(SSD1306_SETCOMPINS); // 0xDA |
SSD1306_Command(0x02); |
SSD1306_Command(SSD1306_SETCONTRAST); // 0x81 |
SSD1306_Command(0x8F); |
SSD1306_Command(SSD1306_SETPRECHARGE); // 0xd9 |
if (vccstate == SSD1306_EXTERNALVCC) { |
SSD1306_Command(0x22); |
} else { |
SSD1306_Command(0xF1); |
} |
SSD1306_Command(SSD1306_SETVCOMDETECT); // 0xDB |
SSD1306_Command(0x40); |
SSD1306_Command(SSD1306_DISPLAYALLON_RESUME); // 0xA4 |
SSD1306_Command(SSD1306_NORMALDISPLAY); // 0xA6 |
#endif |
#if defined SSD1306_128_64 |
// Init sequence for 128x64 OLED module |
SSD1306_Command(SSD1306_DISPLAYOFF); // 0xAE |
SSD1306_Command(SSD1306_SETDISPLAYCLOCKDIV); // 0xD5 |
SSD1306_Command(0x80); // The suggested ratio 0x80 |
SSD1306_Command(SSD1306_SETMULTIPLEX); // 0xA8 |
SSD1306_Command(0x3F); |
SSD1306_Command(SSD1306_SETDISPLAYOFFSET); // 0xD3 |
SSD1306_Command(0x0); // No offset |
SSD1306_Command(SSD1306_SETSTARTLINE | 0x0); // Line #0 |
SSD1306_Command(SSD1306_CHARGEPUMP); // 0x8D |
if (vccstate == SSD1306_EXTERNALVCC) { |
SSD1306_Command(0x10); |
} else { |
SSD1306_Command(0x14); |
} |
SSD1306_Command(SSD1306_MEMORYMODE); // 0x20 |
SSD1306_Command(0x00); // 0x0 act like ks0108 |
SSD1306_Command(SSD1306_SEGREMAP | 0x1); |
SSD1306_Command(SSD1306_COMSCANDEC); |
SSD1306_Command(SSD1306_SETCOMPINS); // 0xDA |
SSD1306_Command(0x12); |
SSD1306_Command(SSD1306_SETCONTRAST); // 0x81 |
if (vccstate == SSD1306_EXTERNALVCC) { |
SSD1306_Command(0x9F); |
} else { |
SSD1306_Command(0xCF); |
} |
SSD1306_Command(SSD1306_SETPRECHARGE); // 0xd9 |
if (vccstate == SSD1306_EXTERNALVCC) { |
SSD1306_Command(0x22); |
} else { |
SSD1306_Command(0xF1); |
} |
SSD1306_Command(SSD1306_SETVCOMDETECT); // 0xDB |
SSD1306_Command(0x40); |
SSD1306_Command(SSD1306_DISPLAYALLON_RESUME); // 0xA4 |
SSD1306_Command(SSD1306_NORMALDISPLAY); // 0xA6 |
#endif |
SSD1306_Command(SSD1306_DISPLAYON); // Turn on OLED panel |
} |
void SSD1306_Command(uint8_t cmd) { |
uint8_t c = cmd; |
SPI_DC_SELECT_LAT = 0; // D/C low (cmd) |
SPI_Write(&c, 1); |
} |
void SSD1306_Data(uint8_t data) { |
uint8_t c = data; |
SPI_DC_SELECT_LAT = 1; // D/C high (data) |
SPI_Write(&c, 1); |
} |
void SSD1306_Clear_Display() { |
memset(LCD_BUFFER, 0, (SSD1306_LCDWIDTH * SSD1306_LCDHEIGHT / 8)); |
} |
void SSD1306_Invert_Display(uint8_t c) { |
if (c) { |
SSD1306_Command(SSD1306_INVERTDISPLAY); |
} else { |
SSD1306_Command((SSD1306_NORMALDISPLAY)); |
} |
} |
void SSD1306_Display() { |
SSD1306_Command(SSD1306_SETLOWCOLUMN | 0x0); // low col = 0 |
SSD1306_Command(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0 |
SSD1306_Command(SSD1306_SETSTARTLINE | 0x0); // line #0 |
SPI_DC_SELECT_LAT = 1; // D/C high (data) |
SPI_Write(LCD_BUFFER, SSD1306_LCDWIDTH * SSD1306_LCDHEIGHT / 8); |
// if (SSD1306_LCDHEIGHT == 32) { |
// SPI2_Write_Repeat(0, SSD1306_LCDWIDTH * SSD1306_LCDHEIGHT / 8); |
// } |
} |
void SSD1306_Draw_Pixel(int16_t x, int16_t y, uint16_t color) { |
if ((x < 0) || (x >= ssd1306_data_p->_width) || (y < 0) || (y >= ssd1306_data_p->_height)) |
return; |
// check rotation, move pixel around if necessary |
switch (ssd1306_data_p->rotation) { |
case 1: |
SSD1306_Swap(&x, &y); |
x = SSD1306_LCDWIDTH - x - 1; |
break; |
case 2: |
x = SSD1306_LCDWIDTH - x - 1; |
y = SSD1306_LCDHEIGHT - y - 1; |
break; |
case 3: |
SSD1306_Swap(&x, &y); |
y = SSD1306_LCDHEIGHT - y - 1; |
break; |
default: |
break; |
} |
// Need to do this for some reason since x + (y / 8) * SSD1306_LCDWIDTH returns -128?! |
// TODO: Change this back when they fix the compiler |
int16_t loc = (y / 8) * SSD1306_LCDWIDTH; |
loc += x; |
// x is which column |
if (color == SSD1306_WHITE) { |
LCD_BUFFER[loc] |= 1<<(y % 8); |
} else { |
LCD_BUFFER[loc] &= ~(1<<(y % 8)); |
} |
} |
void SSD1306_Draw_Line(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) { |
int16_t dx, dy, err, ystep; |
int16_t steep = SSD1306_Abs(y1 - y0) > SSD1306_Abs(x1 - x0); |
if (steep) { |
SSD1306_Swap(&x0, &y0); |
SSD1306_Swap(&x1, &y1); |
} |
if (x0 > x1) { |
SSD1306_Swap(&x0, &x1); |
SSD1306_Swap(&y0, &y1); |
} |
dx = x1 - x0; |
dy = SSD1306_Abs(y1 - y0); |
err = dx / 2; |
if (y0 < y1) { |
ystep = 1; |
} else { |
ystep = -1; |
} |
for (; x0 <= x1; x0++) { |
if (steep) { |
SSD1306_Draw_Pixel(y0, x0, color); |
} else { |
SSD1306_Draw_Pixel(x0, y0, color); |
} |
err -= dy; |
if (err < 0) { |
y0 += ystep; |
err += dx; |
} |
} |
} |
void SSD1306_Draw_Fast_VLine(int16_t x, int16_t y, int16_t h, uint16_t color) { |
SSD1306_Draw_Line(x, y, x, y + h - 1, color); |
} |
void SSD1306_Draw_Fast_HLine(int16_t x, int16_t y, int16_t w, uint16_t color) { |
SSD1306_Draw_Line(x, y, x + w - 1, y, color); |
} |
void SSD1306_Draw_Rect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) { |
SSD1306_Draw_Fast_HLine(x, y, w, color); |
SSD1306_Draw_Fast_HLine(x, y + h, w, color); |
SSD1306_Draw_Fast_VLine(x, y, h, color); |
SSD1306_Draw_Fast_VLine(x + w, y, h, color); |
} |
void SSD1306_Fill_Rect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) { |
int16_t i; |
for (i = x; i < x + w; i++) { |
SSD1306_Draw_Fast_VLine(i, y, h, color); |
} |
} |
void SSD1306_Draw_Circle(int16_t x0, int16_t y0, int16_t r, uint16_t color) { |
int16_t f = 1 - r; |
int16_t ddF_x = 1; |
int16_t ddF_y = -2 * r; |
int16_t x = 0; |
int16_t y = r; |
SSD1306_Draw_Pixel(x0, y0 + r, color); |
SSD1306_Draw_Pixel(x0, y0 - r, color); |
SSD1306_Draw_Pixel(x0 + r, y0, color); |
SSD1306_Draw_Pixel(x0 - r, y0, color); |
while (x < y) { |
if (f >= 0) { |
y--; |
ddF_y += 2; |
f += ddF_y; |
} |
x++; |
ddF_x += 2; |
f += ddF_x; |
SSD1306_Draw_Pixel(x0 + x, y0 + y, color); |
SSD1306_Draw_Pixel(x0 - x, y0 + y, color); |
SSD1306_Draw_Pixel(x0 + x, y0 - y, color); |
SSD1306_Draw_Pixel(x0 - x, y0 - y, color); |
SSD1306_Draw_Pixel(x0 + y, y0 + x, color); |
SSD1306_Draw_Pixel(x0 - y, y0 + x, color); |
SSD1306_Draw_Pixel(x0 + y, y0 - x, color); |
SSD1306_Draw_Pixel(x0 - y, y0 - x, color); |
} |
} |
void SSD1306_Draw_Circle_Helper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color) { |
int16_t f = 1 - r; |
int16_t ddF_x = 1; |
int16_t ddF_y = -2 * r; |
int16_t x = 0; |
int16_t y = r; |
while (x < y) { |
if (f >= 0) { |
y--; |
ddF_y += 2; |
f += ddF_y; |
} |
x++; |
ddF_x += 2; |
f += ddF_x; |
if (cornername & 0x4) { |
SSD1306_Draw_Pixel(x0 + x, y0 + y, color); |
SSD1306_Draw_Pixel(x0 + y, y0 + x, color); |
} |
if (cornername & 0x2) { |
SSD1306_Draw_Pixel(x0 + x, y0 - y, color); |
SSD1306_Draw_Pixel(x0 + y, y0 - x, color); |
} |
if (cornername & 0x8) { |
SSD1306_Draw_Pixel(x0 - y, y0 + x, color); |
SSD1306_Draw_Pixel(x0 - x, y0 + y, color); |
} |
if (cornername & 0x1) { |
SSD1306_Draw_Pixel(x0 - y, y0 - x, color); |
SSD1306_Draw_Pixel(x0 - x, y0 - y, color); |
} |
} |
} |
void SSD1306_Fill_Circle(int16_t x0, int16_t y0, int16_t r, uint16_t color) { |
SSD1306_Draw_Fast_VLine(x0, y0 - r, 2 * r + 1, color); |
SSD1306_Fill_Circle_Helper(x0, y0, r, 3, 0, color); |
} |
void SSD1306_Fill_Circle_Helper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color) { |
int16_t f = 1 - r; |
int16_t ddF_x = 1; |
int16_t ddF_y = -2 * r; |
int16_t x = 0; |
int16_t y = r; |
while (x < y) { |
if (f >= 0) { |
y--; |
ddF_y += 2; |
f += ddF_y; |
} |
x++; |
ddF_x += 2; |
f += ddF_x; |
if (cornername & 0x1) { |
SSD1306_Draw_Fast_VLine(x0 + x, y0 - y, 2 * y + 1 + delta, color); |
SSD1306_Draw_Fast_VLine(x0 + y, y0 - x, 2 * x + 1 + delta, color); |
} |
if (cornername & 0x2) { |
SSD1306_Draw_Fast_VLine(x0 - x, y0 - y, 2 * y + 1 + delta, color); |
SSD1306_Draw_Fast_VLine(x0 - y, y0 - x, 2 * x + 1 + delta, color); |
} |
} |
} |
void SSD1306_Draw_Triangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color) { |
SSD1306_Draw_Line(x0, y0, x1, y1, color); |
SSD1306_Draw_Line(x1, y1, x2, y2, color); |
SSD1306_Draw_Line(x2, y2, x0, y0, color); |
} |
void SSD1306_Fill_Triangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color) { |
int16_t a, b, y, last; |
int16_t dx01 = x1 - x0; |
int16_t dy01 = y1 - y0; |
int16_t dx02 = x2 - x0; |
int16_t dy02 = y2 - y0; |
int16_t dx12 = x2 - x1; |
int16_t dy12 = y2 - y1; |
int16_t sa = 0; |
int16_t sb = 0; |
// Sort coordinates by Y order (y2 >= y1 >= y0) |
if (y0 > y1) { |
SSD1306_Swap(&y0, &y1); |
SSD1306_Swap(&x0, &x1); |
} |
if (y1 > y2) { |
SSD1306_Swap(&y2, &y1); |
SSD1306_Swap(&x2, &x1); |
} |
if (y0 > y1) { |
SSD1306_Swap(&y0, &y1); |
SSD1306_Swap(&x0, &x1); |
} |
if (y0 == y2) { // Handle awkward all-on-same-line case as its own thing |
a = b = x0; |
if (x1 < a) a = x1; |
else if (x1 > b) b = x1; |
if (x2 < a) a = x2; |
else if (x2 > b) b = x2; |
SSD1306_Draw_Fast_HLine(a, y0, b - a + 1, color); |
return; |
} |
// For upper part of triangle, find scanline crossings for segments |
// 0-1 and 0-2. If y1=y2 (flat-bottomed triangle), the scanline y1 |
// is included here (and second loop will be skipped, avoiding a /0 |
// error there), otherwise scanline y1 is skipped here and handled |
// in the second loop...which also avoids a /0 error here if y0=y1 |
// (flat-topped triangle). |
if (y1 == y2) last = y1; // Include y1 scanline |
else last = y1 - 1; // Skip it |
for (y = y0; y <= last; y++) { |
a = x0 + sa / dy01; |
b = x0 + sb / dy02; |
sa += dx01; |
sb += dx02; |
/* longhand: |
a = x0 + (x1 - x0) * (y - y0) / (y1 - y0); |
b = x0 + (x2 - x0) * (y - y0) / (y2 - y0); |
*/ |
if (a > b) SSD1306_Swap(&a, &b); |
SSD1306_Draw_Fast_HLine(a, y, b - a + 1, color); |
} |
// For lower part of triangle, find scanline crossings for segments |
// 0-2 and 1-2. This loop is skipped if y1=y2. |
sa = dx12 * (y - y1); |
sb = dx02 * (y - y0); |
for (; y <= y2; y++) { |
a = x1 + sa / dy12; |
b = x0 + sb / dy02; |
sa += dx12; |
sb += dx02; |
/* longhand: |
a = x1 + (x2 - x1) * (y - y1) / (y2 - y1); |
b = x0 + (x2 - x0) * (y - y0) / (y2 - y0); |
*/ |
if (a > b) SSD1306_Swap(&a, &b); |
SSD1306_Draw_Fast_HLine(a, y, b - a + 1, color); |
} |
} |
void SSD1306_Draw_Round_Rect(int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, uint16_t color) { |
// smarter version |
SSD1306_Draw_Fast_HLine(x + r, y, w - 2 * r, color); // Top |
SSD1306_Draw_Fast_HLine(x + r, y + h - 1, w - 2 * r, color); // Bottom |
SSD1306_Draw_Fast_VLine(x, y + r, h - 2 * r, color); // Left |
SSD1306_Draw_Fast_VLine(x + w - 1, y + r, h - 2 * r, color); // Right |
// draw four corners |
SSD1306_Draw_Circle_Helper(x + r, y + r, r, 1, color); |
SSD1306_Draw_Circle_Helper(x + w - r - 1, y + r, r, 2, color); |
SSD1306_Draw_Circle_Helper(x + w - r - 1, y + h - r - 1, r, 4, color); |
SSD1306_Draw_Circle_Helper(x + r, y + h - r - 1, r, 8, color); |
} |
void SSD1306_Fill_Round_Rect(int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, uint16_t color) { |
// smarter version |
SSD1306_Fill_Rect(x + r, y, w - 2 * r, h, color); |
// draw four corners |
SSD1306_Fill_Circle_Helper(x + w - r - 1, y + r, r, 1, h - 2 * r - 1, color); |
SSD1306_Fill_Circle_Helper(x + r, y + r, r, 2, h - 2 * r - 1, color); |
} |
void SSD1306_Draw_Bitmap(int16_t x, int16_t y, const uint8_t* bitmap, int16_t w, int16_t h, uint16_t color) { |
int16_t i, j; |
for (j = 0; j < h; j++) { |
for (i = 0; i < w; i++) { |
if (bitmap[i + (j / 8) * w] & (j % 8)) { |
SSD1306_Draw_Pixel(x + i, y + j, color); |
} |
} |
} |
} |
void SSD1306_Draw_Char(int16_t x, int16_t y, uint8_t c, uint16_t color, uint16_t bg, uint8_t size) { |
int16_t i, j; |
uint16_t line; |
if ((x >= ssd1306_data_p->_width) || // Clip right |
(y >= ssd1306_data_p->_height) || // Clip bottom |
((x + 5 * size - 1) < 0) || // Clip left |
((y + 8 * size - 1) < 0)) // Clip top |
return; |
for (i = 0; i < 6; i++) { |
if (i == 5) |
line = 0x0; |
else |
line = font[(c * 5) + i]; |
for (j = 0; j < 8; j++) { |
if (line & 0x1) { |
if (size == 1) {// default size |
SSD1306_Draw_Pixel(x + i, y + j, color); |
} else { // big size |
SSD1306_Fill_Rect(x + (i * size), y + (j * size), size, size, color); |
} |
} else if (bg != color) { |
if (size == 1) { // default size |
SSD1306_Draw_Pixel(x + i, y + j, bg); |
} else { // big size |
SSD1306_Fill_Rect(x + i*size, y + j*size, size, size, bg); |
} |
} |
line >>= 1; |
} |
} |
} |
void SSD1306_Write(uint8_t c) { |
if (c == '\n' || c == '\r') { |
ssd1306_data_p->cursor_y += ssd1306_data_p->textsize * 8; |
ssd1306_data_p->cursor_x = 0; |
// } else if (c == '\r') { |
// // skip em |
} else { |
SSD1306_Draw_Char(ssd1306_data_p->cursor_x, ssd1306_data_p->cursor_y, c, ssd1306_data_p->textcolor, ssd1306_data_p->textbgcolor, ssd1306_data_p->textsize); |
ssd1306_data_p->cursor_x += ssd1306_data_p->textsize * 6; |
if (ssd1306_data_p->wrap && (ssd1306_data_p->cursor_x > (ssd1306_data_p->_width - ssd1306_data_p->textsize * 6))) { |
ssd1306_data_p->cursor_y += ssd1306_data_p->textsize * 8; |
ssd1306_data_p->cursor_x = 0; |
} |
} |
} |
void SSD1306_Write_String(uint8_t* msg, uint8_t length) { |
for (uint8_t i = 0; i < length; i++) { |
SSD1306_Write(msg[i]); |
} |
} |
void SSD1306_Set_Cursor(int16_t x, int16_t y) { |
ssd1306_data_p->cursor_x = x; |
ssd1306_data_p->cursor_y = y; |
} |
void SSD1306_Set_Text_Color(uint16_t c) { |
// for 'transparent' background, we'll set the bg |
// to the same as fg instead of using a flag |
ssd1306_data_p->textcolor = c; |
ssd1306_data_p->textbgcolor = c; |
} |
void SSD1306_Set_Text_Color_BG(uint16_t c, uint16_t bg) { |
ssd1306_data_p->textcolor = c; |
ssd1306_data_p->textbgcolor = bg; |
} |
void SSD1306_Set_Text_Size(uint8_t s) { |
ssd1306_data_p->textsize = (s > 0) ? s : 1; |
} |
void SSD1306_Set_Text_Wrap(uint8_t w) { |
ssd1306_data_p->wrap = w; |
} |
void SSD1306_Set_Rotation(uint8_t x) { |
x %= 4; // cant be higher than 3 |
ssd1306_data_p->rotation = x; |
switch (x) { |
case 0: |
case 2: |
ssd1306_data_p->_width = ssd1306_data_p->WIDTH; |
ssd1306_data_p->_height = ssd1306_data_p->HEIGHT; |
break; |
case 1: |
case 3: |
ssd1306_data_p->_width = ssd1306_data_p->HEIGHT; |
ssd1306_data_p->_height = ssd1306_data_p->WIDTH; |
break; |
} |
} |
void SSD1306_Test_DrawChar() { |
uint8_t i; |
SSD1306_Set_Text_Size(1); |
SSD1306_Set_Text_Color(SSD1306_WHITE); |
SSD1306_Set_Cursor(0, 0); |
for (i = 0; i < 168; i++) { |
if (i == '\n') continue; |
SSD1306_Write(i); |
// if ((i > 0) && (i % 21 == 0)) |
// SSD1306_write('\n'); |
} |
SSD1306_Display(); |
} |
void SSD1306_Test_DrawCircle() { |
int16_t i; |
for (i = 0; i < ssd1306_data_p->_height; i += 2) { |
SSD1306_Draw_Circle(ssd1306_data_p->_width / 2, ssd1306_data_p->_height / 2, i, SSD1306_WHITE); |
SSD1306_Display(); |
} |
} |
void SSD1306_Test_DrawRect(void) { |
int16_t i; |
for (i = 0; i < ssd1306_data_p->_height / 2; i += 2) { |
SSD1306_Draw_Rect(i, i, ssd1306_data_p->_width - 2 * i, ssd1306_data_p->_height - 2 * i, SSD1306_WHITE); |
SSD1306_Display(); |
} |
} |
void SSD1306_Test_FillRect(void) { |
uint8_t color = 1; |
int16_t i; |
for (i = 0; i < ssd1306_data_p->_height / 2; i += 3) { |
// alternate colors |
SSD1306_Fill_Rect(i, i, ssd1306_data_p->_width - i * 2, ssd1306_data_p->_height - i * 2, color % 2); |
SSD1306_Display(); |
color++; |
} |
} |
void SSD1306_Test_DrawTriangle(void) { |
int16_t i; |
int16_t min = ssd1306_data_p->_width < ssd1306_data_p->_height ? ssd1306_data_p->_width : ssd1306_data_p->_height; |
for (i = 0; i < min / 2; i += 5) { |
SSD1306_Draw_Triangle(ssd1306_data_p->_width / 2, ssd1306_data_p->_height / 2 - i, |
ssd1306_data_p->_width / 2 - i, ssd1306_data_p->_height / 2 + i, |
ssd1306_data_p->_width / 2 + i, ssd1306_data_p->_height / 2 + i, SSD1306_WHITE); |
SSD1306_Display(); |
} |
} |
void SSD1306_Test_FillTriangle(void) { |
uint8_t color = SSD1306_WHITE; |
int16_t i; |
int16_t min = ssd1306_data_p->_width < ssd1306_data_p->_height ? ssd1306_data_p->_width : ssd1306_data_p->_height; |
for (i = min / 2; i > 0; i -= 5) { |
SSD1306_Fill_Triangle(ssd1306_data_p->_width / 2, ssd1306_data_p->_height / 2 - i, |
ssd1306_data_p->_width / 2 - i, ssd1306_data_p->_height / 2 + i, |
ssd1306_data_p->_width / 2 + i, ssd1306_data_p->_height / 2 + i, SSD1306_WHITE); |
if (color == SSD1306_WHITE) color = SSD1306_BLACK; |
else color = SSD1306_WHITE; |
SSD1306_Display(); |
} |
} |
void SSD1306_Test_DrawRoundRect(void) { |
int16_t i; |
for (i = 0; i < ssd1306_data_p->_height / 2 - 2; i += 2) { |
SSD1306_Draw_Round_Rect(i, i, ssd1306_data_p->_width - 2 * i, ssd1306_data_p->_height - 2 * i, ssd1306_data_p->_height / 4, SSD1306_WHITE); |
SSD1306_Display(); |
} |
} |
void SSD1306_Test_FillRoundRect(void) { |
uint8_t color = SSD1306_WHITE; |
int16_t i; |
for (i = 0; i < ssd1306_data_p->_height / 2 - 2; i += 2) { |
SSD1306_Fill_Round_Rect(i, i, ssd1306_data_p->_width - 2 * i, ssd1306_data_p->_height - 2 * i, ssd1306_data_p->_height / 4, color); |
if (color == SSD1306_WHITE) color = SSD1306_BLACK; |
else color = SSD1306_WHITE; |
SSD1306_Display(); |
} |
} |
void SSD1306_Test_DrawLine(void) { |
int16_t i; |
for (i = 0; i < ssd1306_data_p->_width; i += 4) { |
SSD1306_Draw_Line(0, 0, i, ssd1306_data_p->_height - 1, SSD1306_WHITE); |
SSD1306_Display(); |
} |
for (i = 0; i < ssd1306_data_p->_height; i += 4) { |
SSD1306_Draw_Line(0, 0, ssd1306_data_p->_width - 1, i, SSD1306_WHITE); |
SSD1306_Display(); |
} |
__delay_ms(10); |
SSD1306_Clear_Display(); |
for (i = 0; i < ssd1306_data_p->_width; i += 4) { |
SSD1306_Draw_Line(0, ssd1306_data_p->_height - 1, i, 0, SSD1306_WHITE); |
SSD1306_Display(); |
} |
for (i = ssd1306_data_p->_height - 1; i >= 0; i -= 4) { |
SSD1306_Draw_Line(0, ssd1306_data_p->_height - 1, ssd1306_data_p->_width - 1, i, SSD1306_WHITE); |
SSD1306_Display(); |
} |
__delay_ms(10); |
SSD1306_Clear_Display(); |
for (i = ssd1306_data_p->_width - 1; i >= 0; i -= 4) { |
SSD1306_Draw_Line(ssd1306_data_p->_width - 1, ssd1306_data_p->_height - 1, i, 0, SSD1306_WHITE); |
SSD1306_Display(); |
} |
for (i = ssd1306_data_p->_height - 1; i >= 0; i -= 4) { |
SSD1306_Draw_Line(ssd1306_data_p->_width - 1, ssd1306_data_p->_height - 1, 0, i, SSD1306_WHITE); |
SSD1306_Display(); |
} |
__delay_ms(10); |
SSD1306_Clear_Display(); |
for (i = 0; i < ssd1306_data_p->_height; i += 4) { |
SSD1306_Draw_Line(ssd1306_data_p->_width - 1, 0, 0, i, SSD1306_WHITE); |
SSD1306_Display(); |
} |
for (i = 0; i < ssd1306_data_p->_width; i += 4) { |
SSD1306_Draw_Line(ssd1306_data_p->_width - 1, 0, i, ssd1306_data_p->_height - 1, SSD1306_WHITE); |
SSD1306_Display(); |
} |
__delay_ms(10); |
} |
//PIC Projects/PICX_16F1825_Stepper_Driver/OLED_SSD1306.h |
---|
0,0 → 1,132 |
#ifndef OLED_SSD1306_H |
#define OLED_SSD1306_H |
/*========================================================================= |
SSD1306 Displays |
----------------------------------------------------------------------- |
The driver is used in multiple displays (128x64, 128x32, etc.). |
Select the appropriate display below to create an appropriately |
sized framebuffer, etc. |
SSD1306_128_64 128x64 pixel display |
SSD1306_128_32 128x32 pixel display |
You also need to set the LCDWIDTH and LCDHEIGHT defines to an |
appropriate size |
-----------------------------------------------------------------------*/ |
// #define SSD1306_128_64 |
#define SSD1306_128_32 |
/*=========================================================================*/ |
#if defined SSD1306_128_64 |
#define SSD1306_LCDWIDTH 128 |
#define SSD1306_LCDHEIGHT 64 |
#endif |
#if defined SSD1306_128_32 |
#define SSD1306_LCDWIDTH 128 |
#define SSD1306_LCDHEIGHT 32 |
#endif |
//#define SSD1306_STRING_BUFFER_SIZE 32 |
#define SSD1306_BLACK 0 |
#define SSD1306_WHITE 1 |
#define SSD1306_I2C_ADDRESS 0x3D // 011110+SA0+RW |
#define SSD1306_SETCONTRAST 0x81 |
#define SSD1306_DISPLAYALLON_RESUME 0xA4 |
#define SSD1306_DISPLAYALLON 0xA5 |
#define SSD1306_NORMALDISPLAY 0xA6 |
#define SSD1306_INVERTDISPLAY 0xA7 |
#define SSD1306_DISPLAYOFF 0xAE |
#define SSD1306_DISPLAYON 0xAF |
#define SSD1306_SETDISPLAYOFFSET 0xD3 |
#define SSD1306_SETCOMPINS 0xDA |
#define SSD1306_SETVCOMDETECT 0xDB |
#define SSD1306_SETDISPLAYCLOCKDIV 0xD5 |
#define SSD1306_SETPRECHARGE 0xD9 |
#define SSD1306_SETMULTIPLEX 0xA8 |
#define SSD1306_SETLOWCOLUMN 0x00 |
#define SSD1306_SETHIGHCOLUMN 0x10 |
#define SSD1306_SETSTARTLINE 0x40 |
#define SSD1306_MEMORYMODE 0x20 |
#define SSD1306_COMSCANINC 0xC0 |
#define SSD1306_COMSCANDEC 0xC8 |
#define SSD1306_SEGREMAP 0xA0 |
#define SSD1306_CHARGEPUMP 0x8D |
#define SSD1306_EXTERNALVCC 0x1 |
#define SSD1306_SWITCHCAPVCC 0x2 |
typedef struct { |
int16_t WIDTH, HEIGHT; // raw display size |
int16_t _width, _height; // size depending on rotation |
int16_t cursor_x, cursor_y; |
uint16_t textcolor, textbgcolor; |
uint8_t textsize; |
uint8_t rotation; |
uint8_t wrap; // If set, wrap text at right side |
} SSD1306_DATA; |
// Misc functions |
int16_t SSD1306_Abs(int16_t i); |
void SSD1306_Swap(int16_t *a, int16_t *b); |
// Core functions |
void SSD1306_Init(SSD1306_DATA *data); |
void SSD1306_Begin(uint8_t vcc); |
void SSD1306_Command(uint8_t cmd); |
void SSD1306_Data(uint8_t data); |
void SSD1306_Clear_Display(void); |
void SSD1306_Invert_Display(uint8_t); |
void SSD1306_Display(void); |
// Drawing functions |
void SSD1306_Draw_Pixel(int16_t x, int16_t y, uint16_t color); |
void SSD1306_Draw_Line(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color); |
void SSD1306_Draw_Fast_VLine(int16_t x, int16_t y, int16_t h, uint16_t color); |
void SSD1306_Draw_Fast_HLine(int16_t x, int16_t y, int16_t w, uint16_t color); |
void SSD1306_Draw_Rect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); |
void SSD1306_Fill_Rect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); |
void SSD1306_Draw_Circle(int16_t x0, int16_t y0, int16_t r, uint16_t color); |
void SSD1306_Draw_Circle_Helper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color); |
void SSD1306_Fill_Circle(int16_t x0, int16_t y0, int16_t r, uint16_t color); |
void SSD1306_Fill_Circle_Helper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color); |
void SSD1306_Draw_Triangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color); |
void SSD1306_Fill_Triangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color); |
void SSD1306_Draw_Round_Rect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color); |
void SSD1306_Fill_Round_Rect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color); |
void SSD1306_Draw_Bitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color); |
void SSD1306_Draw_Char(int16_t x, int16_t y, uint8_t c, uint16_t color, uint16_t bg, uint8_t size); |
void SSD1306_Write(uint8_t c); |
void SSD1306_Write_String(uint8_t *msg, uint8_t length); |
//void SSD1306_Write_String(const rom char *fmt, ...); |
//void SSD1306_Append_String(const rom char *fmt, ...); |
void SSD1306_Set_Cursor(int16_t x, int16_t y); |
void SSD1306_Set_Text_Color(uint16_t c); |
void SSD1306_Set_Text_Color_BG(uint16_t c, uint16_t bg); |
void SSD1306_Set_Text_Size(uint8_t s); |
void SSD1306_Set_Text_Wrap(uint8_t w); |
void SSD1306_Set_Rotation(uint8_t r); |
// Test functions |
void SSD1306_Test_DrawChar(void); |
void SSD1306_Test_DrawCircle(void); |
void SSD1306_Test_DrawRect(void); |
void SSD1306_Test_FillRect(void); |
void SSD1306_Test_DrawTriangle(void); |
void SSD1306_Test_FillTriangle(void); |
void SSD1306_Test_DrawRoundRect(void); |
void SSD1306_Test_FillRoundRect(void); |
void SSD1306_Test_DrawLine(void); |
#endif /* OLED_SSD1306_H */ |
//PIC Projects/PICX_16F1825_Stepper_Driver/SPI.c |
---|
0,0 → 1,159 |
#include "defines.h" |
#include "SPI.h" |
static SPI_DATA *spi_data_p; |
void SPI_Init(SPI_DATA *data, uint8_t speed) { |
spi_data_p = data; |
SPI_MOSI_TRIS = 0; |
SPI_CLK_TRIS = 0; |
#ifndef SPI_WRITE_ONLY |
SPI_MISO_TRIS = 1; |
#endif |
// SPI_SLAVE_SELECT_TRIS = 0; // SPI2 slave select |
// SPI_SLAVE_SELECT_LAT = 1; // SPI2 SS high (Idle) |
// SPI_RESET_TRIS = 0; // SPI2 reset |
// SPI_RESET_LAT = 1; // SPI2 reset active low |
SPI_DC_SELECT_TRIS = 0; // SPI2 D/C select |
SPI_DC_SELECT_LAT = 0; |
SSP1STATbits.SMP = 0; // Input is sampled in the middle of data output time |
SSP1STATbits.CKE = 0; // Transmit occurs on transition from Idle to active clock state |
SSP1CON1bits.SSPM = speed; |
SSP1CON1bits.CKP = 1; // Idle state for clock is a high level |
SSP1CON1bits.SSPEN = 1; // Enable MSSP module |
PIE1bits.SSP1IE = 0; // Disable MSSP interrupt |
#ifndef SPI_WRITE_ONLY |
spi_data_p->buffer_in_len = 0; |
spi_data_p->buffer_in_read_ind = 0; |
spi_data_p->buffer_in_write_ind = 0; |
#endif |
spi_data_p->buffer_out_ind = 0; |
spi_data_p->buffer_out_len = 0; |
} |
void SPI_Write(uint8_t *msg, uint16_t length) { |
uint16_t i = 0; |
// SPI_SLAVE_SELECT_LAT = 0; |
while (i != length) { |
SSP1BUF = msg[i]; |
i++; |
while (!SSP1STATbits.BF); |
#ifndef SPI_WRITE_ONLY |
spi_data_p->buffer_in[spi_data_p->buffer_in_write_ind] = SSP2BUF; |
if (spi_data_p->buffer_in_write_ind == MAXSPIBUF - 1) { |
spi_data_p->buffer_in_write_ind = 0; |
} else { |
spi_data_p->buffer_in_write_ind++; |
} |
spi_data_p->buffer_in_len++; |
#else |
// Read data in buffer to clear it |
uint8_t tmp = SSP1BUF; |
#endif |
} |
// SPI_SLAVE_SELECT_LAT = 1; |
} |
void SPI2_Write_Repeat(uint8_t c, uint16_t length) { |
uint16_t i = 0; |
// SPI_SLAVE_SELECT_LAT = 0; |
while (i != length) { |
SSP1BUF = c; |
i++; |
while (!SSP1STATbits.BF); |
#ifndef SPI_WRITE_ONLY |
spi_data_p->buffer_in[spi_data_p->buffer_in_write_ind] = SSP2BUF; |
if (spi_data_p->buffer_in_write_ind == MAXSPIBUF - 1) { |
spi_data_p->buffer_in_write_ind = 0; |
} else { |
spi_data_p->buffer_in_write_ind++; |
} |
spi_data_p->buffer_in_len++; |
#else |
// Read data in buffer to clear it |
uint8_t tmp = SSP1BUF; |
#endif |
} |
// SPI_SLAVE_SELECT_LAT = 1; |
} |
#ifndef SPI_WRITE_ONLY |
void SPI_Recv_Interrupt_Handler() { |
uint8_t c; |
if (SSP1STATbits.BF) { // Check if data receive flag is set |
if (spi_data_p->buffer_in_len == MAX_SPI_BUFFER - 1) { |
c = SSP1BUF; // Read SSP2BUF to clear it |
} else { |
// Save received data into buffer |
spi_data_p->buffer_in[spi_data_p->buffer_in_write_ind] = SSP1BUF; |
if (spi_data_p->buffer_in_write_ind == MAX_SPI_BUFFER - 1) { |
spi_data_p->buffer_in_write_ind = 0; |
} else { |
spi_data_p->buffer_in_write_ind++; |
} |
spi_data_p->buffer_in_len++; |
// Put next byte in SSP2BUF for transmit |
if (spi_data_p->buffer_out_ind != spi_data_p->buffer_out_len) { |
SSP1BUF = spi_data_p->buffer_out[spi_data_p->buffer_out_ind]; |
spi_data_p->buffer_out_ind++; |
} else { |
// SPI_SLAVE_SELECT_LAT = 1; // Bring SS line high |
spi_data_p->buffer_out_ind = 0; |
spi_data_p->buffer_out_len = 0; |
} |
} |
} |
} |
void SPI_Read(char length) { |
// SPI_SLAVE_SELECT_LAT = 0; |
for (uint8_t i = 0; i < length; i++) { |
SSP1BUF = 0x0; |
while (!SSP1STATbits.BF); |
spi_data_p->buffer_in[spi_data_p->buffer_in_write_ind] = SSP1BUF; |
if (spi_data_p->buffer_in_write_ind == MAX_SPI_BUFFER - 1) { |
spi_data_p->buffer_in_write_ind = 0; |
} else { |
spi_data_p->buffer_in_write_ind++; |
} |
spi_data_p->buffer_in_len++; |
} |
// SPI_SLAVE_SELECT_LAT = 1; |
} |
uint8_t SPI_Buffer_Len() { |
return spi_data_p->buffer_in_len; |
} |
uint8_t SPI_Read_Buffer(uint8_t* buffer) { |
uint8_t i = 0; |
while (spi_data_p->buffer_in_len != 0) { |
buffer[i] = spi_data_p->buffer_in[spi_data_p->buffer_in_read_ind]; |
i++; |
if (spi_data_p->buffer_in_read_ind == MAX_SPI_BUFFER - 1) { |
spi_data_p->buffer_in_read_ind = 0; |
} else { |
spi_data_p->buffer_in_read_ind++; |
} |
spi_data_p->buffer_in_len--; |
} |
return i; |
} |
#endif |
//PIC Projects/PICX_16F1825_Stepper_Driver/glcdfont.c |
---|
0,0 → 1,263 |
#ifndef FONT5X7_H |
#define FONT5X7_H |
// standard ascii 5x7 font |
const char font[] = { |
0x00, 0x00, 0x00, 0x00, 0x00, |
0x3E, 0x5B, 0x4F, 0x5B, 0x3E, |
0x3E, 0x6B, 0x4F, 0x6B, 0x3E, |
0x1C, 0x3E, 0x7C, 0x3E, 0x1C, |
0x18, 0x3C, 0x7E, 0x3C, 0x18, |
0x1C, 0x57, 0x7D, 0x57, 0x1C, |
0x1C, 0x5E, 0x7F, 0x5E, 0x1C, |
0x00, 0x18, 0x3C, 0x18, 0x00, |
0xFF, 0xE7, 0xC3, 0xE7, 0xFF, |
0x00, 0x18, 0x24, 0x18, 0x00, |
0xFF, 0xE7, 0xDB, 0xE7, 0xFF, |
0x30, 0x48, 0x3A, 0x06, 0x0E, |
0x26, 0x29, 0x79, 0x29, 0x26, |
0x40, 0x7F, 0x05, 0x05, 0x07, |
0x40, 0x7F, 0x05, 0x25, 0x3F, |
0x5A, 0x3C, 0xE7, 0x3C, 0x5A, |
0x7F, 0x3E, 0x1C, 0x1C, 0x08, |
0x08, 0x1C, 0x1C, 0x3E, 0x7F, |
0x14, 0x22, 0x7F, 0x22, 0x14, |
0x5F, 0x5F, 0x00, 0x5F, 0x5F, |
0x06, 0x09, 0x7F, 0x01, 0x7F, |
0x00, 0x66, 0x89, 0x95, 0x6A, |
0x60, 0x60, 0x60, 0x60, 0x60, |
0x94, 0xA2, 0xFF, 0xA2, 0x94, |
0x08, 0x04, 0x7E, 0x04, 0x08, |
0x10, 0x20, 0x7E, 0x20, 0x10, |
0x08, 0x08, 0x2A, 0x1C, 0x08, |
0x08, 0x1C, 0x2A, 0x08, 0x08, |
0x1E, 0x10, 0x10, 0x10, 0x10, |
0x0C, 0x1E, 0x0C, 0x1E, 0x0C, |
0x30, 0x38, 0x3E, 0x38, 0x30, |
0x06, 0x0E, 0x3E, 0x0E, 0x06, |
0x00, 0x00, 0x00, 0x00, 0x00, |
0x00, 0x00, 0x5F, 0x00, 0x00, |
0x00, 0x07, 0x00, 0x07, 0x00, |
0x14, 0x7F, 0x14, 0x7F, 0x14, |
0x24, 0x2A, 0x7F, 0x2A, 0x12, |
0x23, 0x13, 0x08, 0x64, 0x62, |
0x36, 0x49, 0x56, 0x20, 0x50, |
0x00, 0x08, 0x07, 0x03, 0x00, |
0x00, 0x1C, 0x22, 0x41, 0x00, |
0x00, 0x41, 0x22, 0x1C, 0x00, |
0x2A, 0x1C, 0x7F, 0x1C, 0x2A, |
0x08, 0x08, 0x3E, 0x08, 0x08, |
0x00, 0x80, 0x70, 0x30, 0x00, |
0x08, 0x08, 0x08, 0x08, 0x08, |
0x00, 0x00, 0x60, 0x60, 0x00, |
0x20, 0x10, 0x08, 0x04, 0x02, |
0x3E, 0x51, 0x49, 0x45, 0x3E, |
0x00, 0x42, 0x7F, 0x40, 0x00, |
0x72, 0x49, 0x49, 0x49, 0x46, |
0x21, 0x41, 0x49, 0x4D, 0x33, |
0x18, 0x14, 0x12, 0x7F, 0x10, |
0x27, 0x45, 0x45, 0x45, 0x39, |
0x3C, 0x4A, 0x49, 0x49, 0x31, |
0x41, 0x21, 0x11, 0x09, 0x07, |
0x36, 0x49, 0x49, 0x49, 0x36, |
0x46, 0x49, 0x49, 0x29, 0x1E, |
0x00, 0x00, 0x14, 0x00, 0x00, |
0x00, 0x40, 0x34, 0x00, 0x00, |
0x00, 0x08, 0x14, 0x22, 0x41, |
0x14, 0x14, 0x14, 0x14, 0x14, |
0x00, 0x41, 0x22, 0x14, 0x08, |
0x02, 0x01, 0x59, 0x09, 0x06, |
0x3E, 0x41, 0x5D, 0x59, 0x4E, |
0x7C, 0x12, 0x11, 0x12, 0x7C, |
0x7F, 0x49, 0x49, 0x49, 0x36, |
0x3E, 0x41, 0x41, 0x41, 0x22, |
0x7F, 0x41, 0x41, 0x41, 0x3E, |
0x7F, 0x49, 0x49, 0x49, 0x41, |
0x7F, 0x09, 0x09, 0x09, 0x01, |
0x3E, 0x41, 0x41, 0x51, 0x73, |
0x7F, 0x08, 0x08, 0x08, 0x7F, |
0x00, 0x41, 0x7F, 0x41, 0x00, |
0x20, 0x40, 0x41, 0x3F, 0x01, |
0x7F, 0x08, 0x14, 0x22, 0x41, |
0x7F, 0x40, 0x40, 0x40, 0x40, |
0x7F, 0x02, 0x1C, 0x02, 0x7F, |
0x7F, 0x04, 0x08, 0x10, 0x7F, |
0x3E, 0x41, 0x41, 0x41, 0x3E, |
0x7F, 0x09, 0x09, 0x09, 0x06, |
0x3E, 0x41, 0x51, 0x21, 0x5E, |
0x7F, 0x09, 0x19, 0x29, 0x46, |
0x26, 0x49, 0x49, 0x49, 0x32, |
0x03, 0x01, 0x7F, 0x01, 0x03, |
0x3F, 0x40, 0x40, 0x40, 0x3F, |
0x1F, 0x20, 0x40, 0x20, 0x1F, |
0x3F, 0x40, 0x38, 0x40, 0x3F, |
0x63, 0x14, 0x08, 0x14, 0x63, |
0x03, 0x04, 0x78, 0x04, 0x03, |
0x61, 0x59, 0x49, 0x4D, 0x43, |
0x00, 0x7F, 0x41, 0x41, 0x41, |
0x02, 0x04, 0x08, 0x10, 0x20, |
0x00, 0x41, 0x41, 0x41, 0x7F, |
0x04, 0x02, 0x01, 0x02, 0x04, |
0x40, 0x40, 0x40, 0x40, 0x40, |
0x00, 0x03, 0x07, 0x08, 0x00, |
0x20, 0x54, 0x54, 0x78, 0x40, |
0x7F, 0x28, 0x44, 0x44, 0x38, |
0x38, 0x44, 0x44, 0x44, 0x28, |
0x38, 0x44, 0x44, 0x28, 0x7F, |
0x38, 0x54, 0x54, 0x54, 0x18, |
0x00, 0x08, 0x7E, 0x09, 0x02, |
0x18, 0xA4, 0xA4, 0x9C, 0x78, |
0x7F, 0x08, 0x04, 0x04, 0x78, |
0x00, 0x44, 0x7D, 0x40, 0x00, |
0x20, 0x40, 0x40, 0x3D, 0x00, |
0x7F, 0x10, 0x28, 0x44, 0x00, |
0x00, 0x41, 0x7F, 0x40, 0x00, |
0x7C, 0x04, 0x78, 0x04, 0x78, |
0x7C, 0x08, 0x04, 0x04, 0x78, |
0x38, 0x44, 0x44, 0x44, 0x38, |
0xFC, 0x18, 0x24, 0x24, 0x18, |
0x18, 0x24, 0x24, 0x18, 0xFC, |
0x7C, 0x08, 0x04, 0x04, 0x08, |
0x48, 0x54, 0x54, 0x54, 0x24, |
0x04, 0x04, 0x3F, 0x44, 0x24, |
0x3C, 0x40, 0x40, 0x20, 0x7C, |
0x1C, 0x20, 0x40, 0x20, 0x1C, |
0x3C, 0x40, 0x30, 0x40, 0x3C, |
0x44, 0x28, 0x10, 0x28, 0x44, |
0x4C, 0x90, 0x90, 0x90, 0x7C, |
0x44, 0x64, 0x54, 0x4C, 0x44, |
0x00, 0x08, 0x36, 0x41, 0x00, |
0x00, 0x00, 0x77, 0x00, 0x00, |
0x00, 0x41, 0x36, 0x08, 0x00, |
0x02, 0x01, 0x02, 0x04, 0x02, |
0x3C, 0x26, 0x23, 0x26, 0x3C, |
0x1E, 0xA1, 0xA1, 0x61, 0x12, |
0x3A, 0x40, 0x40, 0x20, 0x7A, |
0x38, 0x54, 0x54, 0x55, 0x59, |
0x21, 0x55, 0x55, 0x79, 0x41, |
0x21, 0x54, 0x54, 0x78, 0x41, |
0x21, 0x55, 0x54, 0x78, 0x40, |
0x20, 0x54, 0x55, 0x79, 0x40, |
0x0C, 0x1E, 0x52, 0x72, 0x12, |
0x39, 0x55, 0x55, 0x55, 0x59, |
0x39, 0x54, 0x54, 0x54, 0x59, |
0x39, 0x55, 0x54, 0x54, 0x58, |
0x00, 0x00, 0x45, 0x7C, 0x41, |
0x00, 0x02, 0x45, 0x7D, 0x42, |
0x00, 0x01, 0x45, 0x7C, 0x40, |
0xF0, 0x29, 0x24, 0x29, 0xF0, |
0xF0, 0x28, 0x25, 0x28, 0xF0, |
0x7C, 0x54, 0x55, 0x45, 0x00, |
0x20, 0x54, 0x54, 0x7C, 0x54, |
0x7C, 0x0A, 0x09, 0x7F, 0x49, |
0x32, 0x49, 0x49, 0x49, 0x32, |
0x32, 0x48, 0x48, 0x48, 0x32, |
0x32, 0x4A, 0x48, 0x48, 0x30, |
0x3A, 0x41, 0x41, 0x21, 0x7A, |
0x3A, 0x42, 0x40, 0x20, 0x78, |
0x00, 0x9D, 0xA0, 0xA0, 0x7D, |
0x39, 0x44, 0x44, 0x44, 0x39, |
0x3D, 0x40, 0x40, 0x40, 0x3D, |
0x3C, 0x24, 0xFF, 0x24, 0x24, |
0x48, 0x7E, 0x49, 0x43, 0x66, |
0x2B, 0x2F, 0xFC, 0x2F, 0x2B, |
0xFF, 0x09, 0x29, 0xF6, 0x20, |
0xC0, 0x88, 0x7E, 0x09, 0x03, |
0x20, 0x54, 0x54, 0x79, 0x41, |
0x00, 0x00, 0x44, 0x7D, 0x41, |
0x30, 0x48, 0x48, 0x4A, 0x32, |
0x38, 0x40, 0x40, 0x22, 0x7A, |
0x00, 0x7A, 0x0A, 0x0A, 0x72, |
0x7D, 0x0D, 0x19, 0x31, 0x7D, |
0x26, 0x29, 0x29, 0x2F, 0x28, |
0x26, 0x29, 0x29, 0x29, 0x26, |
0x30, 0x48, 0x4D, 0x40, 0x20, |
0x38, 0x08, 0x08, 0x08, 0x08, |
0x08, 0x08, 0x08, 0x08, 0x38, |
0x2F, 0x10, 0xC8, 0xAC, 0xBA, |
0x2F, 0x10, 0x28, 0x34, 0xFA, |
0x00, 0x00, 0x7B, 0x00, 0x00, |
0x08, 0x14, 0x2A, 0x14, 0x22, |
0x22, 0x14, 0x2A, 0x14, 0x08, |
0xAA, 0x00, 0x55, 0x00, 0xAA, |
0xAA, 0x55, 0xAA, 0x55, 0xAA, |
0x00, 0x00, 0x00, 0xFF, 0x00, |
0x10, 0x10, 0x10, 0xFF, 0x00, |
0x14, 0x14, 0x14, 0xFF, 0x00, |
0x10, 0x10, 0xFF, 0x00, 0xFF, |
0x10, 0x10, 0xF0, 0x10, 0xF0, |
0x14, 0x14, 0x14, 0xFC, 0x00, |
0x14, 0x14, 0xF7, 0x00, 0xFF, |
0x00, 0x00, 0xFF, 0x00, 0xFF, |
0x14, 0x14, 0xF4, 0x04, 0xFC, |
0x14, 0x14, 0x17, 0x10, 0x1F, |
0x10, 0x10, 0x1F, 0x10, 0x1F, |
0x14, 0x14, 0x14, 0x1F, 0x00, |
0x10, 0x10, 0x10, 0xF0, 0x00, |
0x00, 0x00, 0x00, 0x1F, 0x10, |
0x10, 0x10, 0x10, 0x1F, 0x10, |
0x10, 0x10, 0x10, 0xF0, 0x10, |
0x00, 0x00, 0x00, 0xFF, 0x10, |
0x10, 0x10, 0x10, 0x10, 0x10, |
0x10, 0x10, 0x10, 0xFF, 0x10, |
0x00, 0x00, 0x00, 0xFF, 0x14, |
0x00, 0x00, 0xFF, 0x00, 0xFF, |
0x00, 0x00, 0x1F, 0x10, 0x17, |
0x00, 0x00, 0xFC, 0x04, 0xF4, |
0x14, 0x14, 0x17, 0x10, 0x17, |
0x14, 0x14, 0xF4, 0x04, 0xF4, |
0x00, 0x00, 0xFF, 0x00, 0xF7, |
0x14, 0x14, 0x14, 0x14, 0x14, |
0x14, 0x14, 0xF7, 0x00, 0xF7, |
0x14, 0x14, 0x14, 0x17, 0x14, |
0x10, 0x10, 0x1F, 0x10, 0x1F, |
0x14, 0x14, 0x14, 0xF4, 0x14, |
0x10, 0x10, 0xF0, 0x10, 0xF0, |
0x00, 0x00, 0x1F, 0x10, 0x1F, |
0x00, 0x00, 0x00, 0x1F, 0x14, |
0x00, 0x00, 0x00, 0xFC, 0x14, |
0x00, 0x00, 0xF0, 0x10, 0xF0, |
0x10, 0x10, 0xFF, 0x10, 0xFF, |
0x14, 0x14, 0x14, 0xFF, 0x14, |
0x10, 0x10, 0x10, 0x1F, 0x00, |
0x00, 0x00, 0x00, 0xF0, 0x10, |
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
0xF0, 0xF0, 0xF0, 0xF0, 0xF0, |
0xFF, 0xFF, 0xFF, 0x00, 0x00, |
0x00, 0x00, 0x00, 0xFF, 0xFF, |
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, |
0x38, 0x44, 0x44, 0x38, 0x44, |
0x7C, 0x2A, 0x2A, 0x3E, 0x14, |
0x7E, 0x02, 0x02, 0x06, 0x06, |
0x02, 0x7E, 0x02, 0x7E, 0x02, |
0x63, 0x55, 0x49, 0x41, 0x63, |
0x38, 0x44, 0x44, 0x3C, 0x04, |
0x40, 0x7E, 0x20, 0x1E, 0x20, |
0x06, 0x02, 0x7E, 0x02, 0x02, |
0x99, 0xA5, 0xE7, 0xA5, 0x99, |
0x1C, 0x2A, 0x49, 0x2A, 0x1C, |
0x4C, 0x72, 0x01, 0x72, 0x4C, |
0x30, 0x4A, 0x4D, 0x4D, 0x30, |
0x30, 0x48, 0x78, 0x48, 0x30, |
0xBC, 0x62, 0x5A, 0x46, 0x3D, |
0x3E, 0x49, 0x49, 0x49, 0x00, |
0x7E, 0x01, 0x01, 0x01, 0x7E, |
0x2A, 0x2A, 0x2A, 0x2A, 0x2A, |
0x44, 0x44, 0x5F, 0x44, 0x44, |
0x40, 0x51, 0x4A, 0x44, 0x40, |
0x40, 0x44, 0x4A, 0x51, 0x40, |
0x00, 0x00, 0xFF, 0x01, 0x03, |
0xE0, 0x80, 0xFF, 0x00, 0x00, |
0x08, 0x08, 0x6B, 0x6B, 0x08, |
0x36, 0x12, 0x36, 0x24, 0x36, |
0x06, 0x0F, 0x09, 0x0F, 0x06, |
0x00, 0x00, 0x18, 0x18, 0x00, |
0x00, 0x00, 0x10, 0x10, 0x00, |
0x30, 0x40, 0xFF, 0x01, 0x01, |
0x00, 0x1F, 0x01, 0x01, 0x1E, |
0x00, 0x19, 0x1D, 0x17, 0x12, |
0x00, 0x3C, 0x3C, 0x3C, 0x3C, |
0x00, 0x00, 0x00, 0x00, 0x00, |
}; |
#endif |
//PIC Projects/PICX_16F1825_Stepper_Driver/INTERRUPTS.h |
---|
0,0 → 1,15 |
#ifndef INTERRUPTS_H |
#define INTERRUPTS_H |
// Initialize the interrupts |
void Interrupt_Init(void); |
// Enable all interrupts (high and low priority) |
void Interrupt_Enable(void); |
// Disable all interrupts (high and low priority) |
void Interrupt_Disable(void); |
void interrupt InterruptHandler(void); |
#endif |
//PIC Projects/PICX_16F1825_Stepper_Driver/IOC.h |
---|
0,0 → 1,8 |
#ifndef IOC_H |
#define IOC_H |
void IOC_Init(void); |
void IOC_Interrupt_Handler(void); |
#endif /* IOC_H */ |
//PIC Projects/PICX_16F1825_Stepper_Driver/Makefile |
---|
0,0 → 1,113 |
# |
# There exist several targets which are by default empty and which can be |
# used for execution of your targets. These targets are usually executed |
# before and after some main targets. They are: |
# |
# .build-pre: called before 'build' target |
# .build-post: called after 'build' target |
# .clean-pre: called before 'clean' target |
# .clean-post: called after 'clean' target |
# .clobber-pre: called before 'clobber' target |
# .clobber-post: called after 'clobber' target |
# .all-pre: called before 'all' target |
# .all-post: called after 'all' target |
# .help-pre: called before 'help' target |
# .help-post: called after 'help' target |
# |
# Targets beginning with '.' are not intended to be called on their own. |
# |
# Main targets can be executed directly, and they are: |
# |
# build build a specific configuration |
# clean remove built files from a configuration |
# clobber remove all built files |
# all build all configurations |
# help print help mesage |
# |
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and |
# .help-impl are implemented in nbproject/makefile-impl.mk. |
# |
# Available make variables: |
# |
# CND_BASEDIR base directory for relative paths |
# CND_DISTDIR default top distribution directory (build artifacts) |
# CND_BUILDDIR default top build directory (object files, ...) |
# CONF name of current configuration |
# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) |
# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) |
# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) |
# CND_PACKAGE_DIR_${CONF} directory of package (current configuration) |
# CND_PACKAGE_NAME_${CONF} name of package (current configuration) |
# CND_PACKAGE_PATH_${CONF} path to package (current configuration) |
# |
# NOCDDL |
# Environment |
MKDIR=mkdir |
CP=cp |
CCADMIN=CCadmin |
RANLIB=ranlib |
# build |
build: .build-post |
.build-pre: |
# Add your pre 'build' code here... |
.build-post: .build-impl |
# Add your post 'build' code here... |
# clean |
clean: .clean-post |
.clean-pre: |
# Add your pre 'clean' code here... |
# WARNING: the IDE does not call this target since it takes a long time to |
# simply run make. Instead, the IDE removes the configuration directories |
# under build and dist directly without calling make. |
# This target is left here so people can do a clean when running a clean |
# outside the IDE. |
.clean-post: .clean-impl |
# Add your post 'clean' code here... |
# clobber |
clobber: .clobber-post |
.clobber-pre: |
# Add your pre 'clobber' code here... |
.clobber-post: .clobber-impl |
# Add your post 'clobber' code here... |
# all |
all: .all-post |
.all-pre: |
# Add your pre 'all' code here... |
.all-post: .all-impl |
# Add your post 'all' code here... |
# help |
help: .help-post |
.help-pre: |
# Add your pre 'help' code here... |
.help-post: .help-impl |
# Add your post 'help' code here... |
# include project implementation makefile |
include nbproject/Makefile-impl.mk |
# include project make variables |
include nbproject/Makefile-variables.mk |