kinda, but look a this part of your code really closerI have found the answer myself. The if statements where more than 4 levels deep
in clear if you A/D conversion is not ready you begin a new one...Code:if (word_wachttijd_aantal < 11) and (byte_status == 1) then if adcon0.2 == 0 then ' test AD conversion ready word_temp_int.highbyte = ADRESH ' store AD value word_temp_int.lowbyte = ADRESL ' store AD value word_pot_adc = word_pot_adc * 9 ' some calculations word_pot_adc = word_pot_adc + word_temp_int word_pot_adc = word_pot_adc / 10 endif adcon0.2 = 1 ' start new AD conversion endif
Simple to modify...
IF THEN statement don't use stacks... SO you can use as many level you want... SUBs use stacksCode:if (word_wachttijd_aantal < 11) and (byte_status == 1) then while ADCON0.2 'wait until AD conversion is ready pause 5 Wend word_temp_int.highbyte = ADRESH ' store AD value word_temp_int.lowbyte = ADRESL ' store AD value word_pot_adc = word_pot_adc * 9 ' some calculations word_pot_adc = word_pot_adc + word_temp_int word_pot_adc = word_pot_adc / 10 adcon0.2 = 1 ' start new AD conversion endif




Bookmarks