An old simple program to read illumination on a photocell will no longer compile; the culprit is this:
dir AN2 in. Code attached. Error message when compiling is:
ToPost.gcb (17): Error: 2 is not a valid I/O pin or port
If I replace dir AN2 with dir GPIO 0b00000100 , it compiles fine. I'm stumped.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Only 2 things I would sugggest which might be helpful, one of which was in your initial reply.
1. Indicate under ANX that X=0 to 29, corresponding to port pin numbers. (Same for pX and nY).
2. Demonstrate in example code that ANX can be replaced by anything previously #define(d) equalling ANX.
Thanks again.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
An old simple program to read illumination on a photocell will no longer compile; the culprit is this:
dir AN2 in. Code attached. Error message when compiling is:
ToPost.gcb (17): Error: 2 is not a valid I/O pin or port
If I replace dir AN2 with dir GPIO 0b00000100 , it compiles fine. I'm stumped.
Here's the code.
Hi Jack,
The .dat file format was updated some time ago with a new set of tools and features and so may have changed for your device.
The best solution is to change:
To read:
Cheers
Chris
'dir an2' should never have worked in the past. anX is, and always has been, a numeric constant somewhere between 0 ..29
So, change code. As the error message is correct.
And, you not need to set the dir, and, you should add ADC optimisation to your code.
Last edit: Anobium 2020-01-25
Thanks for the helpful replies!
@Jack. Take a look at the Help. What can be done to make it clearer? What can be done to prevent new users failing into the same trap?
See these links for the HELP source. Change to clarify please.
See https://github.com/Anobium/Great-Cow-BASIC-Help/blob/master/source/readad.adoc
https://github.com/Anobium/Great-Cow-BASIC-Help/blob/master/source/readad10.adoc
https://github.com/Anobium/Great-Cow-BASIC-Help/blob/master/source/readad12.adoc
The three docs cover the three methods but any clarification should be in all three docs.
Cheers
Only 2 things I would sugggest which might be helpful, one of which was in your initial reply.
1. Indicate under ANX that X=0 to 29, corresponding to port pin numbers. (Same for pX and nY).
2. Demonstrate in example code that ANX can be replaced by anything previously #define(d) equalling ANX.
Thanks again.
The idea was to get you to do the changes based upon your experience.
Editing in GitHub is very easy. You can ask to become a contributor (and edit the masters), or, you can clone and then submit for inclusion.
The more people editing and revising will improve the Help.