Browse Source

transfer again

git-svn-id: https://bucket.mit.edu/svn/nilm/zoom@7596 ddd99763-3ecb-0310-9145-efcb8ce7c51f
tags/zoom-1.0
jim 15 years ago
parent
commit
45afdd15ba
7 changed files with 70 additions and 35 deletions
  1. +0
    -0
      firmware/mode_debug.c
  2. +0
    -0
      firmware/mode_debug.h
  3. +0
    -0
      firmware/mode_normal.c
  4. +6
    -0
      firmware/mode_normal.h
  5. +46
    -25
      firmware/zoom.c
  6. +18
    -10
      firmware/zoom.mcp
  7. BIN
      firmware/zoom.mcw

+ 0
- 0
firmware/mode_debug.c View File


+ 0
- 0
firmware/mode_debug.h View File


+ 0
- 0
firmware/mode_normal.c View File


+ 6
- 0
firmware/mode_normal.h View File

@@ -0,0 +1,6 @@
#ifndef MODE_NORMAL_H
#define MODE_NORMAL_H
#include "config.h"
#endif

+ 46
- 25
firmware/zoom.c View File

@@ -24,7 +24,35 @@ float dac_current_max;

#define TIMER_RATE 8000 /* how often to read the ADC and update DAC */
#define PC_RATE 8000 /* how often to send data to the PC */
#define DEBUG_BLINK_RATE 4

/* Debug LED */
void TISR_HANDLER(6)
{
static int toggle = 0;
timer_clear_txif(6);
toggle = !toggle;
if (toggle)
led_on();
else
led_off();
}

/* Debug mode */
int debug_zero_adc = 0;
void TISR_HANDLER(7)
{
timer_clear_txif(7);

if (debug_zero_adc)
{

}
}

/* Run mode */
void TISR_HANDLER(5)
{
static int count = 0;
@@ -110,6 +138,8 @@ void run_debug(void)
char buf[4];
uart1_init(115200);

timer_setup_16bit(6, DEBUG_BLINK_RATE, 1);

uart1_put_string("Zoom NILM Debug\r\n");

while (1) {
@@ -237,43 +267,34 @@ void run_normal(void)
}
}

/* This mode is used when the programmer is connected,
or PGD is tied to ground (jumper between ICD pins 3 and 4) */
#define MODE_1 run_debug

/* This mode is used when the programmer is not connected
and PGD is left floating */
#define MODE_2 run_normal

int main(void)
{
int jumper;

config_init();
led_init();
led_on();

led_on();
/* debug */
/* debug output */
TRISAbits.TRISA9 = 0;
/* Detect jumper on B10/B11 */
//TRISCbits.TRISC13 = 1;
//CNPU1bits.CN1PUE = 1;

adcext_init();
dac_init();
dac_write(32768);
adc_init();

led_off();
msleep(100);
led_on();
degauss();
/* If PGD is externally tied to ground, use MODE_1
(Short ICD pins 3 and 4) */
// if (PORTCbits.RC13 == 0)
// MODE_1();
// else
MODE_2();
/* Detect jumper from B8 to GND */
TRISBbits.TRISB8 = 0;
LATBbits.LATB8 = 1;
nop(); nop(); nop();
jumper = (PORTBbits.RB8 == 0);
TRISBbits.TRISB8 = 1;
/* If jumper present, use MODE_1 */
if (jumper)
run_debug();
else
run_normal();

for (;;)
continue;


+ 18
- 10
firmware/zoom.mcp View File

@@ -37,6 +37,10 @@ file_016=no
file_017=no
file_018=no
file_019=no
file_020=no
file_021=no
file_022=no
file_023=no
[FILE_INFO]
file_000=zoom.c
file_001=config.c
@@ -48,16 +52,20 @@ file_006=adcext.c
file_007=adc.c
file_008=scaling.c
file_009=led.c
file_010=config.h
file_011=uart.h
file_012=util.h
file_013=dac.h
file_014=timer.h
file_015=adcext.h
file_016=adc.h
file_017=scaling.h
file_018=led.h
file_019=p33fj256gp710.gld
file_010=mode_debug.c
file_011=mode_normal.c
file_012=config.h
file_013=uart.h
file_014=util.h
file_015=dac.h
file_016=timer.h
file_017=adcext.h
file_018=adc.h
file_019=scaling.h
file_020=led.h
file_021=mode_debug.h
file_022=mode_normal.h
file_023=p33fj256gp710.gld
[SUITE_INFO]
suite_guid={479DDE59-4D56-455E-855E-FFF59A3DB57E}
suite_state=


BIN
firmware/zoom.mcw View File


Loading…
Cancel
Save