CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

port a

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kable
Guest







port a
PostPosted: Sat Jan 24, 2004 7:11 pm     Reply with quote

can someone please help me

i need to set up port a for a0 - a2 as analog and a3-a5 and e0-e2 as digital inputs

i cant get it to work.

can someone please tell me the ccs code to set the port this way?
kable
Guest







PostPosted: Sat Jan 24, 2004 7:36 pm     Reply with quote

i was not clear on what i am doing, sorry,

i have a 16f877a

i want to use some inputs as listed above for analog voltage measurements and some as digital inputs.

do i need to put pull up resistors and have the buttons ground? currently i have the buttons switching a +5v to the pins.

someone please help me with setting this up.

please Smile
wa822



Joined: 17 Dec 2003
Posts: 4
Location: London UK

View user's profile Send private message

Analogue & Digital
PostPosted: Sun Jan 25, 2004 6:48 am     Reply with quote

The Microchip data sheet provides the information on what pins can be used for. It is a good idea to read this an much as time allows.

CMOS (PIC) Digital inputs have very high input impedance. They need to be pulled HIGH or LOW at all times. Otherwise they can cause all kinds of strange operation.
This includes oscillating at line frequency (50 / 60 Hz) or at any other frequency picked up. Also, the circuit can stop or start working when your hand comes near the board!

On this device, week pull-ups can be enabled on port B. If they are enabled, switches can be connected to 0V without using any resistors to Vdd.

Resistor values are not critical. 10k is a good value

Good luck
_________________
Andrew White
Charlie U



Joined: 09 Sep 2003
Posts: 183
Location: Somewhere under water in the Great Lakes

View user's profile Send private message

Port A configuration
PostPosted: Sun Jan 25, 2004 9:10 am     Reply with quote

Unfortunately, using A0 through A2 as analog inputs is not an available option. The only way you can have only 3 analog inputs is to configure the port with A0, A1, and A3 as analog inputs. All others will be digital I/O. Use the built in function for setting up the analog section with the proper parameter as follows:

#setup_adc_ports(RA0_RA1_RA3_ANALOG);

Refer to the device data sheet in section 11, and the device include file, PIC16F877A.h, and the compiler online help for additional information.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group