Hi Vasile,

Thank you for the quick reply.
Is have that feeling about something not right at some point of the code.
In fact tried to exchange some "if/end if" for "case of" but no luck.
Problem persists, but it seems only related to "if/end if" usage..

My code reads the ADC (PIC18F2550), for 100 times in a "for/end loop".
Then find the median of values read and send that median value to RS232.
Also has a button to do some extra actions.
All this code worked great even in a smaller PIC (16F18313).

Now have changed PIC for the 18F2550 and wanted to add some extra code to 
manage PWM and ADC reading times to find the median value.
Also added an oled display to show locally that value and the PWM/ ADC nr. 
of readings parameters. That's when this issue raised up.
Simptoms are the code running sluggish, not hangging...
Any ideas?
Thank you very much.

Cheers,
Filipe Santos


On Saturday, August 6, 2022 at 5:13:36 PM UTC+1 vasile wrote:

> This issue appears usually when you do not manage in a correct way the 
> timing required by a specific hardware and the costs of your code length is 
> higher than required for the device to run properly. Common workaround is 
> to use interrupts or other sequential techniques.
>
> Example: DS18B20 is a temperature sensor which requires 750ms or so for a 
> 12bit conversion. If you have complex software involving USB interrupts, 
> real time clock generation, 7segment LED multiplexed display, etc , and 
> those are not shared correctly with your resources ( aka you try everything 
> to be solved in pure software) at one moment your code will freeze at a 
> specific code length. Removing some lines, no matter that are if/end if or 
> something else will apparently make your code functional, but the issue is 
> not where you suppose it is...
>
> Instead of if/end if you may use "case of". However it will not do 
> something special or different compared with if/end if, except a more 
> understandable structure for your source.
> best wishes,
>
>
> On Sat, Aug 6, 2022 at 7:00 PM flyway38 <fsfo...@gmail.com> wrote:
>
>> Hi all,
>>
>> Is there any limit in using IF/ END IF conditions?
>> My code was running good untill added one more IF/END IF.
>> At first didn't realize about a limit in using these conditions code, but 
>> then figured out that any other IF/END IF removal would let my code run ok 
>> again...
>> Does anyone knows anything about this issue?
>> Thank you very much.
>>
>> Cheers,
>> Filipe Santos.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "jallib" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jallib+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jallib/3f8189dd-fd0a-4df9-8948-518503485e61n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jallib/3f8189dd-fd0a-4df9-8948-518503485e61n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jallib+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/d77c7605-af0d-43ff-b2fb-4fe3a987e507n%40googlegroups.com.

Reply via email to