--- In l..., "viskr" wrote: >
> Sorry David-
>
> I was cutting and pasting.
>
> the if(mb_accum) should have been if(port) as you noted.
>
> AP_DIV is 4 in my setup, 60 MHz PCLK, 15 MHz peripheral clock
> It may be different in your setup
>
> Bruce
> www.coridiumcorp.com
> home of ARMexpress modules and ARMmite SBC
>
Thank you VERY much for the help, Bruce. You have no idea how much
trouble you've saved me! I have been playing around with the program
since you initially sent the code, and am able to successfully read
analog inputs 2-7, like I initially wanted. I ended up changing
AP_DIV to 4 also. I will paste the code below just in case it could
be helpful to somebody else who is using my board and LCD combo.
Thanks again for spending some of your time on this issue.
the if(mb_accum) should have been if(port) as you noted.
AP_DIV is 4 in my setup, 60 MHz PCLK, 15 MHz peripheral clock
It may be different in your setup
Bruce
www.coridiumcorp.com
home of ARMexpress modules and ARMmite SBC
Reply by soufeazie●October 11, 20062006-10-11
Just to let you know what's happening, I have changed the mb_accum in
the if() statements in get_adin() definition to "port". I am
reading
an unstable value between 0 and 65472 (continually fluctuates). I had
to comment out the AD_DIV definition to allow the program to compile.
-David
Reply by soufeazie●October 11, 20062006-10-11
Bruce, thanks for the response! I have tried to adapt your code to
the header file I'm using (lpc2103.h), but have not figured out what
"mb_accum" refers to. The ADC section of the header is shown below.
I have made the following adaptions to the code so far:
Is there anything wrong with the header file I'm using? I'm not
sure
if the above changes preserve the functionality of your code or
not...there are still errors when I compile, and the errors are shown
below. If you have any idea how to correct this, or what these errors
mean, I would greatly appreciate your help! Thanks again.
While you code kinda looks OK, it would be more readable to set the
control register to the value you want in 1 or 2 steps, and faster too.
One other issue that may be causing a problem, is that if the analog
mux is being used then no analog input may exceed 3.3V. This is from
the errata on the 2103, I haven't tested this and don't know if it
means even when that analog input is used as a digital line.
Anyway here is the code we use to read an A/D
Bruce
www.coridiumcorp.com
home of the ARMexpress modules and ARMmite SBCs
Reply by soufeazie●October 11, 20062006-10-11
Hello, I am relatively new to microcontroller programming and have
been banging my head against the wall for the past couple of weeks
trying to configure my lpc2103 controller to function properly. I
have got an hd44780 based LCD module and have successfully configured
it to display text...that was good. Now, I am currently spinning my
wheels trying to read an analog input port. I have looked through the
user's manual for my microcontroller as well as the LPC-ARM book
published on the web. I have still not been able to correctly sample
and display an analog input. I believe the problem stems from the R/W
register of the LCD "taking over" pin P0.22, which I believe is the
pin for analog input 1. I have included links to the owner's manual
for the microcontroller and LCD I'm working with (pin block diagram
describes the functionality of each pin) and have also included the
main body of the code I have so far...which doesn't work! I would
really appreciate any information on configuring and using the analog
input ports 2,3,4,5,6,7 (these do not interfere with the LCD pins).
Thanks in advance for your help!