Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Analog to Digital conversion using PIC16f877

Status
Not open for further replies.

winsthon

New Member
Could anyone help me, Im having a problem making the code using C to convert analog to digital and display them on an LCD as HEX using PIC16f877. I use the analog input RA0, RA1 and RA2, the ouputs are RB0 to RB7and RD7 to RD6 equal to 10bits. I want to display the result of this in HEX value to the LCD. can anyone give me a code for this? If you want the schematic diagram of the circuit I can email it. Thanks
 
I'm not a very experienced guy on this topic.. :)

but.. as far as I remember, you might need to read the specsheet of the PIC you're using.. learn how to activate the analog inputs, the should be 5-10 lines of code to turn on the adc converters on input pins.

after the ADC's are turned on, you might poll the converter outputs for "read_voltage" kinda pic command (in C code) , and then implement a short function, that outputs the voltage readout from the analog inputs, to the output data port. as it's bigger than 8 bits, you might concatanate the value, or divide the valur into two different integer values (MSB 8 bits are the number rightshifted by two bits) and the LSB 2 bits are number module 4, or the number ORed with x03 (hexadecimal three)...

hope it helps...
 
the input pins can be turned on and off, later in time (while the program is running) by a simple port_enable or port_disable command from the C code in the PIC...
 
the input pins can be turned on and off, later in time (while the program is running) by a simple port_enable or port_disable command from the C code in the PIC...

hi energy,
Have you seen the date of the OP..?:)
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top