Menu

No Compile Error when using unavailable Analog Ports

bed
2017-09-20
2017-09-22
  • bed

    bed - 2017-09-20

    I found by accident a liitle oddity.
    When you are using a unavailable Interrupt handler Great Cow BASIC will display a warning.
    Let's asume you use the wrong chip in the setting#chip 18f25k20, 16 (in reality you use the Chip 18F25K20)
    instead of #chip 18f25k22, 16
    the 18F25K20 has no AN16 and no AN17 i.e.

    But, when you using the unavailable AN17 Port Great Cow BASIC does it treat as normal Variable and do not complain.
    It is possible to look into the chipdata.dat and find if the chip you used has this ANx Port or not.
    You as the user have made the error, you should look always in the Datasheet :-)
    But I think, the Compiler is your friend he has the knowledge of the Chip and available Ports and should complain and throw a Warning as like it does for the Interrupt handler.

     

    Last edit: bed 2017-09-20
    • Anobium

      Anobium - 2017-09-21

      Hard to resolve this one. Just really hard - with AN0 you must be sure that you have the addressing correct. The ADC routines accept constants and variables to give the greatest flexible.

      I am not sure of a way to resolve without a huge amount of work.

       
  • bed

    bed - 2017-09-22

    Ok, if one fell once over it, it's solved anyway. Sometimes making a Program foolprof is nce but I agree, this time the point goes to you. Leave it as it is, Take brain for other more important things :-)

    I could make a FAQ Entry for that ... hmhm

     

Log in to post a comment.