Page 1 of 1
16F877A A/D question
Posted: Fri Dec 09, 2011 2:39 am
by CRAIG CHAMBERLAIN
Hi All!
Is it possible to use a A/D on Port A when running the 16 X 2 LCD on port A as well?
If not, what would be recommended?
Thanks,
-Craig
Re: 16F877A A/D question
Posted: Fri Dec 09, 2011 4:40 am
by Werner
Hi Craig, I am fairly new to Flowcode and may get corrected but I think you should be able to use 2 pins - bit 0/1 for A/D and the rest for LCD? It seems to simulate.
Good luck Buddy!
Werner
Re: 16F877A A/D question
Posted: Fri Dec 09, 2011 5:22 am
by CRAIG CHAMBERLAIN
Hey, Werner!
Thanks for the input. If you simmed it, I would imagine it will work.
I"ll give it a shot.
-Craig
Re: 16F877A A/D question
Posted: Fri Dec 09, 2011 8:43 am
by medelec35
Hi CRAIG,
I i remember correctly you need to set an output to low for the enable line of LCD eg 0>A5 (if LCD connected to port A)
But you will will need to remember that:
If you connect any of the data pins to an analoge o/p, then when writing to LCD the pin connected to the LCD data/ analogue line will be an output so will force that line high or low. So I would recommend a resistor in series with analogue source and pin of microcontroller to limit the analogue signal if microcontroller pin is set high and analogue signal is low, and vice-versa. So do not connect the wiper of a pot directly to the data pin of LCD without a resistor (at least 1K to limit to 5mA) in series from wiper of pot to data pin.
Martin
Re: 16F877A A/D question
Posted: Sat Dec 10, 2011 8:49 am
by CRAIG CHAMBERLAIN
Hi Martin.
I plan on using a multiplexor to send in the input signal to whatever is the best A/D to use.
The output of the multiplexor will be in tristate until I do a read of whatever channel.
Is there a way to access the a/d inputs on ports other than A?
I don't see the option on the component macro for A/D inputs.
Cheers,
-Craig
Re: 16F877A A/D question
Posted: Sat Dec 10, 2011 11:55 am
by medelec35
Hi Craig,
Tried on hardware.
This works.
I have used LCD on portA and AN0 together.
Martin
Re: 16F877A A/D question
Posted: Sun Dec 11, 2011 3:57 am
by CRAIG CHAMBERLAIN
Martin,
Thanks, works for me to.
What are the components after the loop for?
And how could the program get there?
Thanks,
-Craig
Re: 16F877A A/D question
Posted: Sun Dec 11, 2011 11:11 am
by medelec35
CRAIG CHAMBERLAIN wrote:
What are the components after the loop for?
Hi Craig, I have posted my test file for you to try.
I use them components at the beginning of my flow charts for testing the hardware is running at the correct speed, and to test what bits light up when toggled.
I then dragged the group below the main loop, so will never be accessed until I require them again, to test a different port for example.
So you can delete them as they now don't play a part in the flowchart.
Martin