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.

Please help: ADC for PIC18f452 Urgent need.

Status
Not open for further replies.

arafat_054

Newbie level 4
Joined
Apr 18, 2009
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,322
Dear all,

I am new in mc. I am working with a project for reading analog signal from a sensor and after converting it with PIC18F452 to digital signal, need to display in data logger in pc (i am using stamp plot).

I am using: mikro c pro and mplab ide.

Please help me. It is very urgent for me..

Regards,
Arafat
 

have a look at Microchip's code examples for the PIC18 and ADC
**broken link removed**
 

have a look at Microchip's code examples for the PIC18 and ADC
**broken link removed**

Thanks for your ref. I need the c code and also could you show me the way of interfacing the digital output from p18F452 with the rs232?
 


if you look in the Microchip examples you will find C code for the USART
https://ww1.microchip.com/downloads/en/DeviceDoc/USART.zip

Ok.

I am trying. But as i am new at mc, so, may be i need time. Actually, i am passing hard time with a project part of which is reading data from a sensor and displaying the converted digital signal into PC. I am in the Ocean now.. i am trying with the below code which is for PIC18f4550 (collected from edaboard.com >> https://www.edaboard.com/threads/234369/) but showing error in my compiler. Addition, i need to know how can i put this into pc through RS232.

I need urgent help in this regard for PIC18F452. i am using MPLAB & mikro c compilers...

Regards,
Arafat
 

I can help you if you zip and upload the schematic of your project. What sensor are you using and what compiler?

- - - Updated - - -

Do you want something like this.
 

Attachments

  • ss7.jpg
    ss7.jpg
    208 KB · Views: 97

I can help you if you zip and upload the schematic of your project. What sensor are you using and what compiler?

- - - Updated - - -

Do you want something like this.



Please find the attachment.

I need to modify the schematic by replacing the PICAXE with PIC18F452. And the code is found from edaboard.com i mentioned previous reply..

Thanks.

- - - Updated - - -

Yes. I need a conversion like you post. I will also need to display in PC with a data logger (i m trying with stamp plot). I also got some help from a friend... he send me the below code:

unsigned int temp_res;
unsigned char text[6];
void main()
{
int len=0;
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
do
{
temp_res = ADC_Read(2); // Get 10-bit results of AD conversion
if(temp_res>999)
len = 1;
else if(temp_res<1000 && temp_res>99)
len = 2;
else if(temp_res<100 && temp_res>9)
len = 3;
else
len = 4;
WordToStr(temp_res,text);
UART1_Write_Text(text+len);
UART1_Write(13);
Delay_ms(1000);
} while(1);
}

with mikro c i compiled this to hex with no error. Then loaded to MCU. I m using a dev board for PIC18F452.
Any more help from you is highly appreciated.

Thanks.
 

Attachments

  • project.rar
    103.5 KB · Views: 70

Your code is OK. Check the attachement. Are you sure that your 741 op amp circuit gives an output from 0-5V?
 

Attachments

  • ss8.jpg
    ss8.jpg
    260.3 KB · Views: 96
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top