Add 8khz streaming to debug mode

git-svn-id: https://bucket.mit.edu/svn/nilm/zoom@6942 ddd99763-3ecb-0310-9145-efcb8ce7c51f
This commit is contained in:
jim 2008-10-22 22:23:44 +00:00
parent f0764c2636
commit a3a5a41951

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;
}
}
}