Basic Chip AD as outputs

basically miscellaneous, if it doesn't fit another sub-forum enter it here, we might even promote it to its own sub-forum
Post Reply
ronr
Posts: 22
Joined: Tue Nov 05, 2013 8:17 pm

Basic Chip AD as outputs

Post by ronr »

I am testing the Basic Chip for the first time. I have control of the IO pins as outputs, except the ones that are AD0 to AD5.
I tried first using x=IO(32), for AD1 (pin9), then using IO(32)=1 to set it high - but no response at the pin. I also tried OUTPUT(32) first then IO(32)=1 with no responce.
I have the AVdd and AVss connected to Vdd and Vss. I tried this on two BasicChips with same results.
Is it some connection problem, or do I need to make some software call to get ADs to be outputs?
Thanks for any advice.



basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: Basic Chip AD as outputs

Post by basicchip »

For now you will have to explicitly change AD inputs to digital IOs with the following code

Code: Select all

#include <LPC11xx.bas>

IOCON_PIO1_4 = &H90               ' convert AD(5) to digital input or output
IOCON_SWDIO_PIO1_3 = &H91         'AD(4)
IOCON_R_PIO1_2 = &H91             'AD(3)
IOCON_R_PIO1_1 = &H91             'AD(2)
IOCON_R_PIO1_0 = &H91             'AD(1)
IOCON_R_PIO0_11 = &H91            'AD(0)

ronr
Posts: 22
Joined: Tue Nov 05, 2013 8:17 pm

Re: Basic Chip AD as outputs

Post by ronr »

Thank you for the information. I could not find it in any documentation that I looked through.
I now have control of the AD pins as outputs except for AD(4). When set as an output, that pin stays high and using IO(35)=0 does not set it low. I can live with that, as I don't need that pin yet, but it is odd. Any thoughts?

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: Basic Chip AD as outputs

Post by basicchip »

That code is taken from the BASIC help files pages on Pin Controls for AD.

Though the second line (corrected now) should be

IOCON_SWDIO_PIO1_3 = &H91 'AD(4)

And that information (cue broken record) is in the NXP help files on the IOCON, which admitedly is quite scattered and inconsistent

ronr
Posts: 22
Joined: Tue Nov 05, 2013 8:17 pm

Re: Basic Chip AD as outputs

Post by ronr »

Thank you, sir. "As of now, I am in control."

Post Reply