PIC18F4410
Hi There,
Am new to all this PIC stuff so apologise in advance if I say anything that drives you crazy. The problem I am having is with the analogue input on this PIC, before you say it I have read the datasheet on this several times but cannot see a solution. It says in BOLD on the data sheet that the Impedance cannot be greater than 2.5Kohmes for any analogue input.
I am trying to get a pressure sensor working on this input and have used the +5v and 0v ref (the supply voltage).
Now although it said 2.5Kohmes what I am using is probably more than that as I have one resistor between ground value 2kOhmes then it is attached to the pressure sensor which itself is a variable resistor whose value changes with pressure (when no pressure is applied it is a huge resistance value). The other connector goes to +5v.
The signal wire is taken where the 2k resistors and the pressure sensor meet and goes to the PIC.
0volts----[2k]-------(Sensor Connection to PIC)------[Pressure Sensor]-------------+5v
Hence I don’t think I meet the 2.5kohme limit required so if anyone has any way of changing that let me know.
Anyway the questions if have are as follows:
1) How to solve the Impedance limit.
2) How to calculate the correct TAD to use
3) Check through my pressure sensor function and see if at least that part looks ok.
Just need to be pointed in the right direction J
Many Thanks.
//Analogue Inputs
TRISA= 1; //setting trisa as input
PORTA= 0b00000001;
//END of ANALOGUE INPUTS
void pressure_sensor(void)
{
char highpressure;
char lowpressure;
char counter;
highpressure = 0;
lowpressure = 0;
counter = 0;
ADCON1 = 0b00000000; //Switches on port AN0
ADCON0 = 0b00000000; //Set Enable A/d off
ADCON2 = 0b00100110;
ADCON0 = 0b00000001;
ADCON0 = 0b00000011;
while ((ADCON0 != 0b00000010)&& (counter !=1) && (ADIF==1) ){
highpressure = ADRESH;
lowpressure = ADRESL;
putch('<');
putch(highpressure);
putch(lowpressure);
putch('>');
ADIF =0;
ADCON0 != 0b00000000;
counter = 1;
}
Hi There,
Am new to all this PIC stuff so apologise in advance if I say anything that drives you crazy. The problem I am having is with the analogue input on this PIC, before you say it I have read the datasheet on this several times but cannot see a solution. It says in BOLD on the data sheet that the Impedance cannot be greater than 2.5Kohmes for any analogue input.
I am trying to get a pressure sensor working on this input and have used the +5v and 0v ref (the supply voltage).
Now although it said 2.5Kohmes what I am using is probably more than that as I have one resistor between ground value 2kOhmes then it is attached to the pressure sensor which itself is a variable resistor whose value changes with pressure (when no pressure is applied it is a huge resistance value). The other connector goes to +5v.
The signal wire is taken where the 2k resistors and the pressure sensor meet and goes to the PIC.
0volts----[2k]-------(Sensor Connection to PIC)------[Pressure Sensor]-------------+5v
Hence I don’t think I meet the 2.5kohme limit required so if anyone has any way of changing that let me know.
Anyway the questions if have are as follows:
1) How to solve the Impedance limit.
2) How to calculate the correct TAD to use
3) Check through my pressure sensor function and see if at least that part looks ok.
Just need to be pointed in the right direction J
Many Thanks.
//Analogue Inputs
TRISA= 1; //setting trisa as input
PORTA= 0b00000001;
//END of ANALOGUE INPUTS
void pressure_sensor(void)
{
char highpressure;
char lowpressure;
char counter;
highpressure = 0;
lowpressure = 0;
counter = 0;
ADCON1 = 0b00000000; //Switches on port AN0
ADCON0 = 0b00000000; //Set Enable A/d off
ADCON2 = 0b00100110;
ADCON0 = 0b00000001;
ADCON0 = 0b00000011;
while ((ADCON0 != 0b00000010)&& (counter !=1) && (ADIF==1) ){
highpressure = ADRESH;
lowpressure = ADRESL;
putch('<');
putch(highpressure);
putch(lowpressure);
putch('>');
ADIF =0;
ADCON0 != 0b00000000;
counter = 1;
}