/PIC Stuff/PICX_16F1825_Controller/base_I2C.c |
---|
310,7 → 310,7 |
SSPCON2bits.RCEN = 1; |
break; |
case I2C_SEND_STOP: |
// Send the stop bit and copy message to send to Main() |
// Send the stop bit |
i2c_data_p->operating_state = I2C_IDLE; |
SSPCON2bits.PEN = 1; |
i2c_data_p->master_status = I2C_MASTER_IDLE; |
518,6 → 518,8 |
uint8_t I2C_Process_Receive(uint8_t c) { |
uint8_t ret = 0; |
BTN_STATUS btns; |
CLRWDT(); |
btns.value = 0; |
switch (c) { |
case CMD_QUERY_BTN: |
Pins_Read(&btns); |
/PIC Stuff/PICX_16F1825_Controller/funclist |
---|
1,17 → 1,17 |
_I2C_Get_Status: CODE, 1171 0 54 |
_I2C_Get_Status: CODE, 1174 0 54 |
_I2C_Interrupt_Master: CODE, 19 0 591 |
_I2C_Read_Buffer: CODE, 1046 0 65 |
_I2C_Interrupt_Slave: CODE, 610 0 358 |
_main: CODE, 1111 0 60 |
_Interrupt_Enable: CODE, 1444 0 3 |
_I2C_Configure_Slave: CODE, 1391 0 28 |
_main: CODE, 1111 0 63 |
_Interrupt_Enable: CODE, 1449 0 3 |
_I2C_Configure_Slave: CODE, 1396 0 28 |
_InterruptHandler: CODE, 4 0 13 |
_I2C_Process_Receive: CODE, 1360 0 31 |
_I2C_Interrupt_Handler: CODE, 1419 0 22 |
_Interrupt_Init: CODE, 1447 0 3 |
__initialization: CODE, 1441 0 0 |
_I2C_Process_Receive: CODE, 1363 0 33 |
_I2C_Interrupt_Handler: CODE, 1424 0 22 |
_Interrupt_Init: CODE, 1452 0 3 |
__initialization: CODE, 1446 0 0 |
_I2C_Init: CODE, 968 0 78 |
_Pins_Read: CODE, 1316 0 44 |
_Pins_Init: CODE, 1271 0 45 |
_Leds_Write: CODE, 1225 0 46 |
Total: 1441 |
_Pins_Read: CODE, 1319 0 44 |
_Pins_Init: CODE, 1274 0 45 |
_Leds_Write: CODE, 1228 0 46 |
Total: 1446 |
/PIC Stuff/PICX_16F1825_Controller/main.c |
---|
3,7 → 3,7 |
// CONFIG1 |
#pragma config FOSC = INTOSC // Oscillator Selection (INTOSC oscillator: I/O function on CLKIN pin) |
#pragma config WDTE = OFF // Watchdog Timer Enable (WDT disabled) |
#pragma config WDTE = ON // 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) |
26,6 → 26,8 |
#include "base_I2C.h" |
void Pins_Init(void) { |
// Set all pins to digital I/O |
ANSELA = 0x0; |
ANSELC = 0x0; |
78,6 → 80,9 |
LED_4_LAT = leds->LED_4; |
} |
// TODO: Set watchdog timer to reset device if no I2C messages are received every x seconds |
// TODO: Use a timer to manually PWM the LEDs |
int main(void) { |
uint8_t buffer[32]; |
uint8_t result, length; |
87,6 → 92,10 |
OSCCONbits.IRCF = 0xE; // Base frequency @ 8MHz |
OSCCONbits.SCS = 0b00; // System clock determined by config bits |
// Set watchdog timer to reset device every 1s |
// CLRWDT is issued upon receiving data over I2C |
WDTCON = 0x0A; |
// Initialize I/O |
Pins_Init(); |
104,6 → 113,7 |
do { |
result = I2C_Get_Status(); |
} while (!result); |
CLRWDT(); |
length = I2C_Read_Buffer(buffer); |
if (length == 2 && buffer[0] == CMD_SET_LEDS) { |
LED_STATUS leds; |
/PIC Stuff/PICX_16F1825_Controller/nbproject/Makefile-genesis.properties |
---|
1,5 → 1,5 |
# |
#Tue Dec 10 11:43:51 EST 2013 |
#Wed Dec 11 18:53:23 EST 2013 |
default.languagetoolchain.dir=C\:\\Program Files (x86)\\Microchip\\xc8\\v1.20\\bin |
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=0d2b1469ad71adb787c711a416386331 |
default.languagetoolchain.version=1.20 |
/PIC Stuff/PICX_16F1825_Controller/nbproject/private/private.xml |
---|
1,3 → 1,7 |
<?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"/> |
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1"> |
<file>file:/C:/Users/Kevin/Documents/Code/PICX_16F1825_Controller/main.c</file> |
<file>file:/C:/Users/Kevin/Documents/Code/PICX_16F1825_Controller/base_I2C.c</file> |
</open-files> |
</project-private> |