I have the a serial ADC setup and mostly working, but I have a problem with the output value being too high. I shift bit 11 through 0 into a byte as shown below.
Full file here: http://www.wallacecompany.com/machine_shop/EMC2/serial_adc/LTC1286.comp ... case 1: // *** Mode 1 : Shift Data from ADC clock_out=0x1 & adc_step; // Set clock_out high on odd adc_step's if (clock_out) { // If clock_out is high ... bit_shifted=(bit_in << which_bit); accum=accum+bit_shifted; // get input bit, shift to current bit location, and add to accumulator which_bit--; } ... On the shop PC the output comes out seven shifts too high. My office PC works properly. They both have the same software and EMC 2.2.2 and get undated automatically. I have a screen-shot showing the value of each shift on the bottom trace here: http://www.wallacecompany.com/machine_shop/EMC2/serial_adc/bad_shift-1a.png The first peak should have a value of 2048, but 262144 is indicated. Just before this shot, I looked at a trace of the shift values, and they were correct at 11 decrementing to 0. Both PC's are the same except, the office PC has a simulated input, and the shop PC has the real ADC input. Anyone have any ideas how an unsigned integer can be seven bits off? ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users