Page 1 of 1

Basic Chip AD as outputs

Posted: Fri Nov 29, 2013 8:00 pm
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.

Re: Basic Chip AD as outputs

Posted: Sun Dec 01, 2013 9:44 pm
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)

Re: Basic Chip AD as outputs

Posted: Mon Dec 02, 2013 5:52 pm
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?

Re: Basic Chip AD as outputs

Posted: Mon Dec 02, 2013 7:59 pm
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

Re: Basic Chip AD as outputs

Posted: Mon Dec 02, 2013 9:18 pm
by ronr
Thank you, sir. "As of now, I am in control."