Browse Source

Add 8khz streaming to debug mode

git-svn-id: https://bucket.mit.edu/svn/nilm/zoom@6942 ddd99763-3ecb-0310-9145-efcb8ce7c51f
tags/zoom-1.0
jim 15 years ago
parent
commit
a3a5a41951
1 changed files with 24 additions and 1 deletions
  1. +24
    -1
      firmware/zoom.c

+ 24
- 1
firmware/zoom.c View File

@@ -46,7 +46,7 @@ void TISR_HANDLER(5)
}

/* Update DAC. Add whatever is necessary to cause the ADC
to change by 150% towards the center of 0x0800
to change by 150% towards the center of n0x0800
(intentional overshoot to increase slew rate capability) */
adjustment = ((int32_t) v - 0x0800) * 1.50 * ADC_DAC_SCALING;
newdac = dac_cmd + adjustment;
@@ -61,6 +61,15 @@ void TISR_HANDLER(5)
}
}

void TISR_HANDLER(6)
{
uint16_t v;
timer_clear_txif(6);
v = adc_get();
send_adc = v;
send_data = 1;
}

void send_to_pc(void)
{
/* Sent data format:
@@ -112,6 +121,20 @@ void run_debug(void)
case '0':
dac = 32768;
break;
case 'g':
/* change baudrate */
/* read ADC at 8KHz */
/* send DAC and ADC values to PC */
uart1_init(500000);
timer_setup_16bit(6, 8000, 1);
send_dac = dac;
for (;;) {
if (send_data) {
send_to_pc();
send_data = 0;
}
}
break;
}
}
}


Loading…
Cancel
Save