From: SourceForge.net <no...@so...> - 2007-07-02 18:39:42
|
Bugs item #1746717, was opened at 2007-07-02 18:39 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1746717&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: msc51(8051) target Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: BNOLL (bnoll) Assigned to: Nobody/Anonymous (nobody) Summary: bugreport sdcc Initial Comment: The following code extract will control a max 187, 12 BIT ADC. The ADC read function uses a simple shift operation and it will be compiled with SDCC Version: SDCC 2.6.1030 BUILD 4444 without any problems. Now I have tryed with latest version and the shift operation ends up in a mess. If you analyse the ASM code the problem is easy to find, "a" will be cleared in the loop and as a result the rlc a will allways be 0. I've attached the complete sourcecode so you can examine the ASM output, its really a BUG. Please have a try and let me know what you think about it. void adc_max_187 (void) { // MAX-187, 12 BIT ADC char i=12, m=0, _adc_va[4]; // unsigned int adc_val=0; // // startcondition ADC_DATA |= 0x01; // DATA = 1 => INPUT ADC_CLOCK &=~0x01; // CLOCK = 0 ADC_CS |= 0x01; // CHIP SELECT = 1 ADC_CS &=~0x01; // CHIP SELECT = 0 while (!ADC_DATA); // do { ADC_CLOCK |= 0x01; // Shift Clock ADC_CLOCK &=~0x01; adc_val <<= 1; // if (ADC_DATA) adc_val |= 0x01; // } while (--i); // } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1746717&group_id=599 |