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.

ADC and DAC of a sine wave in PIC18f452

Status
Not open for further replies.

kakar133

Member level 2
Joined
Sep 16, 2010
Messages
49
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
USA
Activity points
1,579
hi all,
I want to do adc in pic18f452. For verification i am applying a sine wave(amplitude=1v and frequency=2Hz) as an analog input to the pic and want to convert the digital output of pic again to analog sine wave using a dac0808
pic18f452 has a 10bit adc but i have adjusted the input voltage and Vref in such a way that digital output is in 8 bits.
I am using a 11Mhz crystal and MPLAB to build a hex file.
I tried to simulate it in proteus but the wave is not correctly reconstructed at the output.
Kindly help to identify the bug.
Attached are the files: 1) c code for adc(text file) 2)hex file 3)proteus design 4)MPLAB project and workspace
 

Attachments

  • adc files.rar
    23.3 KB · Views: 135

Hello kakar133
I don't know if you waiting for answer yet. I have the same problem. Try to change the right justified ->Left Justified.
And then replace
Code:
PORTC=ADRESL;
with
Code:
PORTC=ADRESH;
With this you will lost the 2 LSB of the 10 bit (of pic ADC).

I hope this will solve your problem. I still have problem because i want to display the result to the LCD and the Left justified make me more problems.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top