/* file: main.c project: oLogic version: 1.2 description: Oscilloscope 4/8ch Logic Display written by : Michael Bradley Changelog: 08/01/09 added alt/chop mode 07/31/09 v1.2 Changed pic from 18f2525(10mip) to an 18f26k20 (16mip) 07/23/09 Setup for 4/8 ch mode. Ground SEL_TRACE for 8 ch mode 07/19/09 Optimized code for faster speed was 150us per ladder iteration, under 60us now 05/04/09 Addred SYNC_OUT pulse, starts at each cycle of ladder 10/01/08 Fixed trace floor and roof 09/30/08 Updated with MX7224 DAC, 8bit parallel, SPI was way too slow DAC0-7 connected to Port C0-7 09/16/08 Prj Begin, using SPI DAC */ #define CLK 96000000 #define USE_PLL #include "main.h" #include "conf.h" #include "chop.c" #include "alt.c" void main() { setup_adc_ports(NO_ANALOGS|VSS_VDD); setup_adc(ADC_OFF|ADC_TAD_MUL_0); setup_spi(SPI_SS_DISABLED); setup_wdt(WDT_OFF); setup_timer_0(RTCC_INTERNAL); setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1); setup_timer_3(T3_DISABLED|T3_DIV_BY_1); setup_comparator(NC_NC_NC_NC); // TODO: USER CODE!! delay_ms(10); // let clock, etc come up to speed #use fast_io(c) SET_TRIS_C( 0x00 ); output_drive(SYNC_OUT); bitTest = 0; ndxTrace = 0; altCurTrace = 0; // endless loop while(true) { if ( input(SEL_TRACES) == 0) { showTraces = TRACE_MAX; } else { showTraces = TRACE_MIN; } if (input(SEL_TRACEWIDTH) == 0 ) { traceWidth = TRACE_WIDTH_A; } else { traceWidth = TRACE_WIDTH_B; } if (input(SEL_MODE) == 0) { showTracesAlt(); } if (input(SEL_MODE) == 1) { showTracesChop(); } } }