Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx

Ads

Discussion Groups

Discussion Groups | Piclist | help in a/d conversion pic18f458

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

help in a/d conversion pic18f458 - kaci25500 - Sep 8 8:05:58 2008

hi all,
in need some hope(oriontatin) in my application.
my application consist in;
i have 3 analog input (3 sinusoidal tensions),then i neeed a/d
converter
an0,an1,an3 (10bit conversion) and the 3 result of conversion will
be used in calcul(var =fonction(read(1),read(2),read(3...) fonction
is(arctan..) )
i use the pic 18f458(with picc compiler) and i want to obtain a
hightspeed intern (40MHZ)
,for this i have used 10MHZ with pll enabled

my progam;
#include<18f458.h>
#device adc=10
#fuses hs, NOWDT, NOPROTECT, PUT, BROWNOUT, NOLVP
#use delay (clock=40000000)
double result;
float v1,v2,v3;

void main(void)
{
ld:
setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_DIV_32); // utilisation de l'horloge interne
pour l'ADC
set_adc_channel(0); // Lecture sur le canal 0 du port
result=(double)(read_adc());
v1 = ( 5.0 * result ) / 1024;
set_adc_channel(1); // Lecture sur le canal 1 du portA
delay_us(10);
result=(double)(read_adc());
v2 = (5.01 * result) / 1024;
delay_us(10);
result=(double)(read_adc());
v3 = (5.01 * result) / 1024;
goto ld;
}
my questions;
1.how much time to the ad convertion (convert 3analog input to
digital)
2.what is the faster a/d convertion 8bit or 10bit.and how much for
difference.
3.what the declaration can i use to obtain max internal execution
speed (40Mhz)(i use 10MHZ with pll enabled)
(1).#fuses hs, NOWDT, NOPROTECT, PUT, BROWNOUT, NOLVP
#use delay (clock=40000000)

or:
(2).#fuses hs, NOWDT, NOPROTECT, PUT, BROWNOUT, NOLVP
#use delay (clock=10000000)
4.is it necessary to do delay time; (delay_us(10);)

------------------------------------

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )