Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to assign digatal and analogue pic pin

Status
Not open for further replies.

esweya

Newbie level 6
Joined
Jan 15, 2011
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Dar es Salaam Tanzania
Activity points
1,386
hi there! i have a problem of assigning pic16F876A pins as digital and analogue input. am using digital and analogue sensor at the same time.
 

are you using both on the same i/o pin?
 

eswya, please, give us more information about your problem, in order we can try helping you.
 

Am actually using ds1820 digital temperature sensor and piezo-electric thin film as a pressure sensor which gives analogue output to the microcontroller. am using RA5 as a digital input for ds1820 and RA0 for analogue input for piezo-electric sensor. I have failed to assign those pins to their respective input.
 

what setting (PIC registers) are you currently using?
 

i think you are connecting analog sensor in RA0 and RA5 want to be digital. right?
do this
ADCON1 = 0b10000001;
ADCON2 = 0b01000010;
//then for conversion set channel first
CHS0 = 0;
CHS1 = 0;
CHS2 = 0;
//set go/down pin to one
ADGO/*depending on compiler the registor value may be different*/ = 1;
//wait for conversion
while(ADGO == 1);
//take the value
ADC0 = ADRESH;
// give a delay for 20 milliseconds
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top