/*
* File: main.c
*
- * Created on August 16, 2010, 12:09 PM
+ * PWM test program
+ *
+ * PIC resources in use, 18-pin DIP, by pin:
+ * - ( 1) RA2 - unused
+ * - ( 2) RA3 - CCP3 PWM for blu LED
+ * - ( 3) RA4 - CCP4 PWM for wht LED. ICSP pin 6, PGM/LVP.
+ * - ( 4) RA5 - ICSP pin 1, MCLR#/Vpp
+ * - ( 5) Vss
+ * - ( 6) RB0 - pushbutton
+ * - ( 7) RB1 - unused
+ * - ( 8) RB2 - unused
+ * - ( 9) RB3 - CCP1 PWM for red LED
+ * - (10) RB4 - rocker switch position B (right)
+ * - (11) RB5 - rocker switch position A (left)
+ * - (12) RB6 - unused
+ * - (13) RB7 - unused
+ * - (14) Vdd
+ * - (15) RA6 - unused
+ * - (16) RA7 - CCP2 PWM for grn LED
+ * - (17) RA0 - unused
+ * - (18) RA1 - unused
+ *
*/
#define RUNAT32MHZ /* else 16 MHz */
#include "picinit.h"
#include "buttons.h"
#include "rgb.h"
+#include "unused.h"
#define STEP_SIZE 32 /* ms */
#define reset_steps() do { incolor_steps = 1; fade_steps = 0; } \
int fade_steps;
pic_init();
+ unused_init();
buttons_init();
rgb_init();
- reset_steps();
+ reset_steps();
if (buttons_on())
rgb_on();
--- /dev/null
+/*
+ * File: unused.h
+ *
+ * Initialize unused resources
+ */
+
+
+#ifndef _UNUSED_H
+#define _UNUSED_H
+
+#include <htc.h>
+
+#define UNUSED_PORTA 0b00000000
+
+/* Initialize unused resources. */
+#define unused_init() do { \
+ nWPUEN = 0; /* enable weak pull-ups on PortB */ \
+ PORTA |= UNUSED_PORTA; /* set unused PortA pins ... */ \
+ TRISA &= ~UNUSED_PORTA; /* ... to output high. */ \
+} while (0)
+
+#endif