picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« on: August 14, 2012, 02:39:34 14:39 » |
|
hello every bady. i build a mini project with 18f4550 ,but when a test it in pcb ;evry analogic input attached to the gnd with aresistor (33k and less) give a result (perhaps) a noise but it s very big (33k give 100 (for 10bit adc resolution).
in the pcb (attached) only two input are used to demenstrate the problem but in the reality i use the 4052 ic.
i cant use a filter with capacity because i use many input (4ms max for each)
my native mcu family is atmel avr i would use 18f4550 because it s more disponible.
the same project with atmega32 give (0 for 33k /10bit) why its possible with atmega32 but with 4550 its not? javascript:void(0); is there a software solution ?javascript:void(0); with isis it give 0 (see file attached ,proton picbasic and eagle winpic800 are used)
|
|
|
Logged
|
|
|
|
Pasca
Newbie
Offline
Posts: 34
Thank You
-Given: 27
-Receive: 42
|
|
« Reply #1 on: August 14, 2012, 05:36:24 17:36 » |
|
Hi picavr, if you short circuit (0ohm) the analogue channel which value give the adc? If value is correct 0, you have to drive analog input with buffer op-amp.
Bye Pasca
Posted on: August 14, 2012, 06:18:07 18:18 - Automerged
I dont know pic 18f4550 so i read datasheet. Capter 21.1 said: "The maximum recommended impedance for analog sources is 2.5 kΩ."
Bye Pasca
|
|
|
Logged
|
More I know, more I need to know. Less I know, meglio sto!!!
|
|
|
picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« Reply #2 on: August 14, 2012, 06:09:30 18:09 » |
|
when i shurtcut the input analogic with 0 ohm it give arround (1) when i shurtcut the input analogic with 2.2k it give arround ( 2.2k is < rs(2.5k) it s not good if its normal in case of 18f i think the microchip mcu is not good because in avr series like atmega32 i can put the 33k in shorcut it s give arround ZERO where is the problem
|
|
|
Logged
|
|
|
|
Wizpic
Global Moderator
Hero Member
Offline
Posts: 1200
Thank You
-Given: 544
-Receive: 408
|
|
« Reply #3 on: August 14, 2012, 06:59:02 18:59 » |
|
Picavr Not sure what the voltage range is you want to measure or how you dislplay it, I don't have eagle installed so can't look at your pcb. The 18F4550 has 13 A/D channels why not jut use them instead of switching a 4052 ? If you need to measure with 4ms how are you displaying the data on the lcd and how do you know which channel your reading. I would use the 8 inputs on the pic then just display data on GLCD all 8 channels or 2 x 16 and just set a routine to display 2 or 4 channels on it.
ISIS is limited and does not pick or allow for noise issues this is whay it reads 0, The noise could be cuased by fast switching of the 4052 have you put a scope on the a/D pins to see what the signal is like upload your board in PDF or image and I will have a look at it
|
|
|
Logged
|
When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
|
|
|
Pasca
Newbie
Offline
Posts: 34
Thank You
-Given: 27
-Receive: 42
|
|
« Reply #4 on: August 14, 2012, 07:03:51 19:03 » |
|
Avr has internal analog buffer 18f no, so you have to externally provide it. In this situation avr is better.
Bye Pasca
|
|
|
Logged
|
More I know, more I need to know. Less I know, meglio sto!!!
|
|
|
picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« Reply #5 on: August 14, 2012, 07:19:02 19:19 » |
|
the program attached is for demonstrate the problem i use 4ms max because i amlimited by the 100ms (timer1) because my systeme is an real time and the voltage output come from sensor do not stabilise in time <=3.5ms for the lcd display i each cycle of timer1 i display one input the glcd display "eat" a lot of time (i am limited by 100ms)
is ther a solution for when i chortcut the input with 33k or less and the result give 0 or 1 or 2 not 100 its so big ?!! or for 18f4550 i slike this
|
|
|
Logged
|
|
|
|
Pasca
Newbie
Offline
Posts: 34
Thank You
-Given: 27
-Receive: 42
|
|
« Reply #6 on: August 14, 2012, 07:36:24 19:36 » |
|
Could you put schematics in png? I dont have eagle.
I dont understand what is value of adc with 2.5k resistor.
|
|
« Last Edit: August 14, 2012, 07:40:25 19:40 by Pasca »
|
Logged
|
More I know, more I need to know. Less I know, meglio sto!!!
|
|
|
Wizpic
Global Moderator
Hero Member
Offline
Posts: 1200
Thank You
-Given: 544
-Receive: 408
|
|
« Reply #7 on: August 14, 2012, 08:13:48 20:13 » |
|
Can't understand your PCB, you are not using any A/D input's, MCLR is feeding AN0 feeding your LCD ?? lookig at your code your LCD is connected to RD port, for a pic normally MCLR pin(1) is tied to +5 via 4K7 resistor, Cant understand what is the purpose of the 2 33K resistors on PORTD, The first thing that jumps out as well you have no GND plane(polygon) hence why you have got a lot of noise in your PCB. Normally best practice to have an analogue GND and digital GND in A/D conversion, I got a feeling that the noise/bounce is been casued by the switching of the LCD and 4052 thsat's why you would have the two GND planes, Pic/LCD on the digital and PSU/4052 on the analogue GND, Hold on I think I just worked it out about the PCB
If my understanding is correct you are inserting your pic the opposite way has to me pin 1 is in the top left corner and not the bottom right ??
Another thing I noticed where or how are you connecting the analogue input for the PIC, Have you tried a 10K to GND
|
|
« Last Edit: August 14, 2012, 08:16:11 20:16 by Wizpic »
|
Logged
|
When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
|
|
|
picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« Reply #8 on: August 14, 2012, 10:27:02 22:27 » |
|
Can't understand your PCB, you are not using any A/D input's, MCLR is feeding AN0 feeding your LCD ?? lookig at your code your LCD is connected to RD port, for a pic normally MCLR pin(1) is tied to +5 via 4K7 resistor, Cant understand what is the purpose of the 2 33K resistors on PORTD, The first thing that jumps out as well you have no GND plane(polygon) hence why you have got a lot of noise in your PCB. Normally best practice to have an analogue GND and digital GND in A/D conversion, I got a feeling that the noise/bounce is been casued by the switching of the LCD and 4052 thsat's why you would have the two GND planes, Pic/LCD on the digital and PSU/4052 on the analogue GND, Hold on I think I just worked it out about the PCB
If my understanding is correct you are inserting your pic the opposite way has to me pin 1 is in the top left corner and not the bottom right ??
Another thing I noticed where or how are you connecting the analogue input for the PIC, Have you tried a 10K to GND
in the real pcb i insert the pic in opposite side,sorry Posted on: August 14, 2012, 10:55:18 22:55 - Automerged
Can't understand your PCB, you are not using any A/D input's, MCLR is feeding AN0 feeding your LCD ?? lookig at your code your LCD is connected to RD port, for a pic normally MCLR pin(1) is tied to +5 via 4K7 resistor, Cant understand what is the purpose of the 2 33K resistors on PORTD, The first thing that jumps out as well you have no GND plane(polygon) hence why you have got a lot of noise in your PCB. Normally best practice to have an analogue GND and digital GND in A/D conversion, I got a feeling that the noise/bounce is been casued by the switching of the LCD and 4052 thsat's why you would have the two GND planes, Pic/LCD on the digital and PSU/4052 on the analogue GND, Hold on I think I just worked it out about the PCB
If my understanding is correct you are inserting your pic the opposite way has to me pin 1 is in the top left corner and not the bottom right ??
Another thing I noticed where or how are you connecting the analogue input for the PIC, Have you tried a 10K to GND
for the mclr pic its configurated like input digital (mclre =off) my output impedance sensors have between 33k and 1k every 04 imput are multiplixed with 4052 to an analogic imput there is a total 19 sensor, i cant put a capacitor in every adc imput when i put a 10nf the result decrease from 100 to 47 but its not sufisant. i cant put a capacitor big as 10nf (time multiplexing limitation) in case of atmega32 work fine without capacitor with the same GNDplane with the same circuit and program and lcd position and the same 4052 atmega32 work fine (work since 04 years) "no signal result =0 " Posted on: August 14, 2012, 11:10:47 23:10 - Automerged
Could you put schematics in png? I dont have eagle.
I dont understand what is value of adc with 2.5k resistor.
for 2.2k the result is 7 (10bit resolution) for 2.67k -----------9------------------ for 10k -------------31---------------- for 33k--------------100------------------ Posted on: August 14, 2012, 11:16:19 23:16 - Automerged
the input is sensor represented by a 33k Posted on: August 14, 2012, 11:21:41 23:21 - Automerged
the shematic is in proteuse
|
|
|
Logged
|
|
|
|
titi
Active Member
Offline
Posts: 229
Thank You
-Given: 3717
-Receive: 834
|
|
« Reply #9 on: August 14, 2012, 10:43:49 22:43 » |
|
Hi, About grounding, a good article is available from Analog Device : http://www.analog.com/library/analogDialogue/archives/46-06/staying_well_grounded.pdffigure 2 page 3, show a current problem with only one ground. About your design, it is a good pratice to put a small capacitor of 100nF between pin 1 and 2 of LM7805 and from 2 and 3 as close as possible from the regulator, to reduce noise and avoid the regulator to oscillate. It is not necessary to put big capacitors of 1000uF every where, more the capacitor is bigger, more inductive it is, so prefere big capacitor for power supply, but use low ESR capacitor like small tantale capacitor of 10uF near the microcontroler and the LCD power pins and allway put a 100nF or 220nF as close as possible of microcontroler power pins. Generaly, I use 100nF SMD ceramic capacitor solder under the microcontroler between power pins. Best regards.
|
|
|
Logged
|
|
|
|
picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« Reply #10 on: August 14, 2012, 11:04:47 23:04 » |
|
in real pcb there are more the 6 six capacitor one 100nf near 7805 one 100nf near 12v two 100nf near 4450 one 100nf near 4052 one 100nf near the lcd one 400nf in the usb pin (without influence because the usb regulator is disabled by the config VREGEN = off)
is there a a configuration setup by software that can reduce the noise ? or is there a source of noise created by the mcu 18f4550 caused by an bad "fuse-bits configuration " or by the mcu registre manipulation
Posted on: August 14, 2012, 11:59:57 23:59 - Automerged
the value gived by conversion of input attached with 33k is 100 this value represente 100*(5/1023)=488mv its so big without signal !!!!!! 488mv caused only by a 33k placed near the mcu its not good
|
|
|
Logged
|
|
|
|
Pasca
Newbie
Offline
Posts: 34
Thank You
-Given: 27
-Receive: 42
|
|
« Reply #11 on: August 14, 2012, 11:19:37 23:19 » |
|
Hi picavr, if your sensors have so high internal resistance the only think that you can do is to condition their signal. You can to condition signal after 4052 so your circuit need only five rail-to-rail op-amp (es. lmv324 http://www.ti.com/lit/ds/snos012f/snos012f.pdf). Lower internal resistence is needed for reduce the settling time less to 4ms so i think that you have no other chance. There is no a noise problem, but injection charge of internal capacitor of ADC, in my opinion ( http://www.analogzone.com/acqt1003.pdf). Bye Pasca
|
|
|
Logged
|
More I know, more I need to know. Less I know, meglio sto!!!
|
|
|
picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« Reply #12 on: August 14, 2012, 11:30:09 23:30 » |
|
i am restricted by the pcb-dimesion ,i know i can use ampli-op to reduce the impedance with a lm358 follower and a 2.2k in output the result is big as the zero. with atmega32 the 33k give me ZERO with the same pcb /gnd-plane. can i said the 18f4550 or 18f series is not good for an analogic interface??
|
|
|
Logged
|
|
|
|
Wizpic
Global Moderator
Hero Member
Offline
Posts: 1200
Thank You
-Given: 544
-Receive: 408
|
|
« Reply #13 on: August 14, 2012, 11:43:04 23:43 » |
|
Has some one pointed out AVR has buffers already built in pic does not, If that is the size of yor PCB why not use SMT op-amps mounted under-neath the PCB. My logic of thinking if it's worked well for 4 years with AVR why try and re-invent the wheel sort of thing. Don't give up yet you will get there, Like I said best practice is to use GND plane not sure about AVR but pic's might be slightly different. I will have a look at the code and see if there might be another way of doing it
|
|
|
Logged
|
When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
|
|
|
motox
Cracking Team
Active Member
Offline
Posts: 187
Thank You
-Given: 255
-Receive: 319
|
|
« Reply #14 on: August 15, 2012, 12:48:57 00:48 » |
|
Picavr, I know what your problem is, too many mistakes. You’re running the PIC18F4550 at 48MHz. According to register ADCON2 the acquisition time is zero (first mistake) and Tad is Fosc/2 = 24MHz (second mistake). Also “The maximum recommended impedance for analog sources is 2.5 kΩ.” (third mistake).
I pointed out the mistakes, now go read the PIC data sheet chapter 21. “10-BIT ANALOG-TO-DIGITAL CONVERTER (A/D) MODULE.”.
I’m not going to tell the solution because you MUST read the data sheet first. It takes 5min max. and is very easy to understand.
|
|
|
Logged
|
|
|
|
picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« Reply #15 on: August 15, 2012, 12:29:14 12:29 » |
|
dear MOTOX the configuration is remplacedt in the program look at osccon register Device = 18F4550 Declare Xtal 8 OSCCON.6=1 OSCCON.5=1 OSCCON.4=1 OSCCON.1=1 OSCCON.0=1 8MHZ internal oscillator look at the simulation in oscilloscope the cycle is 100ms the same timing in my real DSO -------------------------------------- the fuse configuration on winpi800 is not taked, because its remplaced by the proton picbasic configuration (config start ----config end ) Config_Start FOSC = INTOSCIO_EC PBADEN = On MCLRE = off PLLDIV = 1 USBDIV = 1 IESO = OFF PWRT = OFF BOR=On VREGEN = off WDTPS = 512 WDT = On LPT1OSC = OFF CCP2MX = On STVREN = On LVP = off ICPRT = OFF XINST = OFF WRTD = OFF Config_End ------------------------------------------------ look at the adc register ADCON2.7 = 1 ADCON1 = %00001001 'an0-an5 analogic input ADCON0.0=1 Declare Adin_Res = 10 ' 10-bit result required Declare Adin_Tad = FRC ' RC oscillator chosen Declare Adin_Stime = 50 ' Allow 50us sample time 50us sampling time you can see : PORTC.7=1 valadcge=ADIn 5 PORTC.7=0 in the simultion the with of this pulse (sampling time)is about 75us the same pulse is looked on my scope i think there is not a problem in timing
|
|
|
Logged
|
|
|
|
motox
Cracking Team
Active Member
Offline
Posts: 187
Thank You
-Given: 255
-Receive: 319
|
|
« Reply #16 on: August 15, 2012, 01:16:01 13:16 » |
|
Dear picavr, Yes, the Fosc is only 8MHz. Still is too high for the ADC module. Analyzing the machine code (HEX file) the ADCON2 register is 0b10000000. Like I told you before the acquisition time is zero and Tad is Fosc/2. According to uC data sheet “TABLE 21-1: TAD vs. DEVICE OPERATING FREQUENCIES”, if ADCS2:ADCS0 = 0b000 then the maximum Fosc is 2.5MHz. You are overclocking the ADC by 3.2x times. This is not an AMD cpu I don’t know what you mean by this: “Declare Adin_Res = 10 ' 10-bit result required Declare Adin_Tad = FRC ' RC oscillator chosen Declare Adin_Stime = 50 ' Allow 50us sample time”Is this basic?
|
|
|
Logged
|
|
|
|
picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« Reply #17 on: August 15, 2012, 02:00:08 14:00 » |
|
Dear picavr, Yes, the Fosc is only 8MHz. Still is too high for the ADC module. Analyzing the machine code (HEX file) the ADCON2 register is 0b10000000. Like I told you before the acquisition time is zero and Tad is Fosc/2. According to uC data sheet “TABLE 21-1: TAD vs. DEVICE OPERATING FREQUENCIES”, if ADCS2:ADCS0 = 0b000 then the maximum Fosc is 2.5MHz. You are overclocking the ADC by 3.2x times. This is not an AMD cpu I don’t know what you mean by this: “Declare Adin_Res = 10 ' 10-bit result required Declare Adin_Tad = FRC ' RC oscillator chosen Declare Adin_Stime = 50 ' Allow 50us sample time”Is this basic? adcon2.7 =1 is not the same as adcon2=0b10000000 adcon2.7 affect only bit N 7 adcon2.7 =1 =A/D Result Format Right justified the others bit of adcon2 will be affected by the instructions: Declare Adin_Res = 10 ' 10-bit result required Declare Adin_Tad = FRC ' RC oscillator chosen Declare Adin_Stime = 50 ' Allow 50us sample time” my programme is in proton pic basic dear motox if i need configure my adc at: 10bit,50us sampling speed,rc osclliator (internal oscillator 8MHZ) can you tel me how i can writing the adc register give me the code an i will test it in proteuse and in the real pcb thank you in avance
|
|
|
Logged
|
|
|
|
motox
Cracking Team
Active Member
Offline
Posts: 187
Thank You
-Given: 255
-Receive: 319
|
|
« Reply #18 on: August 15, 2012, 02:11:29 14:11 » |
|
the others bit of adcon2 will be affected by the instructions: Declare Adin_Res = 10 ' 10-bit result required Declare Adin_Tad = FRC ' RC oscillator chosen Declare Adin_Stime = 50 ' Allow 50us sample time”
Those lines of code are definitions (constants) and not instructions. They are defined but not used anywhere in the code. Add the following code (adapt to picbasic if necessary): ADCON2 = 0b10111001;
|
|
|
Logged
|
|
|
|
picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« Reply #19 on: August 15, 2012, 06:16:40 18:16 » |
|
Those lines of code are definitions (constants) and not instructions. They are defined but not used anywhere in the code.
Add the following code (adapt to picbasic if necessary): ADCON2 = 0b10111001;
i will test it Posted on: August 15, 2012, 06:36:01 18:36 - Automerged
it tested without change the new code is attached ichorcuted the (an0 GND(7805))with jumper it give 3 (3/1023) with jumper its not normal 33k give me 100 (100/1023) the plan of pcb-gnd is attached red=5v white=gnd
|
|
|
Logged
|
|
|
|
motox
Cracking Team
Active Member
Offline
Posts: 187
Thank You
-Given: 255
-Receive: 319
|
|
« Reply #20 on: August 15, 2012, 06:44:36 18:44 » |
|
First configure all ADC registers and after that turn on the ADC module. You’re still violating the ADC limits doing it in the wrong sequence. No one knows what could happen to the ADC!
Let’s make this clear. What is you analog input? The above schematic doesn’t correspond to your hardware. Show us a complete schematic. Is the picture 'the pcb corrected.png' or the 'the schematic.png'?
|
|
« Last Edit: August 15, 2012, 06:48:56 18:48 by motox »
|
Logged
|
|
|
|
picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« Reply #21 on: August 15, 2012, 07:04:45 19:04 » |
|
the pcb gived is a part of the real-pcb its an representation of a gnd plane and 18f4550 the other part is not interessant there are 3 cards (21cm*18cm) my problem is "in" or "near" the mcu
in proton picbasic only there tree instruction Declare Adin_Res = 10 ' 10-bit result required Declare Adin_Tad = FRC ' RC oscillator chosen Declare Adin_Stime = 50 ' Allow 50us sample time” ADCON2.7 = 1 "result right justifie ADCON1 = %00001001 'an0-an5 analogic input
if you have" isis" installed on your pc you can see it work
and if you read adin 0 'for input 0 adin 5 'for input 0
|
|
|
Logged
|
|
|
|
Wizpic
Global Moderator
Hero Member
Offline
Posts: 1200
Thank You
-Given: 544
-Receive: 408
|
|
« Reply #22 on: August 15, 2012, 07:11:30 19:11 » |
|
if you have" isis" installed on your pc you can see it work
and if you read adin 0 'for input 0 adin 5 'for input 0
Has I've said once before ISIS will work spot on and using the scope in ISIS will not show noise like it would in real time.
|
|
|
Logged
|
When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
|
|
|
motox
Cracking Team
Active Member
Offline
Posts: 187
Thank You
-Given: 255
-Receive: 319
|
|
« Reply #23 on: August 15, 2012, 07:36:51 19:36 » |
|
if you have" isis" installed on your pc you can see it work
I use MPLAB to import the HEX file and then simulate the code using MPLAB SIM with register injection to test the ADC. Now I can confirm that your code is writing the ADCON2 register to select the Frc clock. The simulation shows no problems…
|
|
|
Logged
|
|
|
|
Pasca
Newbie
Offline
Posts: 34
Thank You
-Given: 27
-Receive: 42
|
|
« Reply #24 on: August 15, 2012, 08:14:58 20:14 » |
|
Hi all, Assuming that the ADC is working correctly now and assuming that the signal of the sensors changes slowly, you may connect the capacitors to the input of multiplexer (one for sensor) and ground for dynamically reduce the internal resistance of the sensor.
Bye Pasca
|
|
|
Logged
|
More I know, more I need to know. Less I know, meglio sto!!!
|
|
|
picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« Reply #25 on: August 15, 2012, 11:27:59 23:27 » |
|
Has I've said once before ISIS will work spot on and using the scope in ISIS will not show noise like it would in real time.
yes iknow there is a probleme work in isis = the ADCON configuration is correct work in isis = the program is correct in 95% isis cant simulate the noise or other physical influence my problem is it work with atmega32 (program translated from bascom avr to proton picbasic) ******************PIC vs AVR************************* **************************************************** and i have an information for all in proton picbasic the program occupate 79.29% of32kb in 18f4550 in bascom avr its ocupate 92% of 32kb atmega32 in this case the 18f4550 is better (or picbasic is better then bascom avr !!?) ********************************************************* ********************************************************* Posted on: August 16, 2012, 12:16:48 00:16 - Automerged
Hi all, Assuming that the ADC is working correctly now and assuming that the signal of the sensors changes slowly, you may connect the capacitors to the input of multiplexer (one for sensor) and ground for dynamically reduce the internal resistance of the sensor.
Bye Pasca
no i cant use the capacitor big then 10nf ,because i am limited by the time (4052 used) and with atmega32 there no capacitor use in the adc input """""""""""""""""""""""""""""NOTA""""""""""""""""""""""""""""""" when i chortcut AN0 with 33k without signal i measure the voltage at AN0 =500mv !!!!!!!!!!!!!!!!!!! Posted on: August 16, 2012, 12:24:28 00:24 - Automerged
yes iknow there is a probleme work in isis = the ADCON configuration is correct work in isis = the program is correct in 95% isis cant simulate the noise or other physical influence
my problem is it work with atmega32 (program translated from bascom avr to proton picbasic)
******************PIC vs AVR************************* **************************************************** and i have an information for all in proton picbasic the program occupate 79.29% of32kb in 18f4550 in bascom avr its ocupate 92% of 32kb atmega32 in this case the 18f4550 is better (or picbasic is better then bascom avr !!?) ********************************************************* *********************************************************
Posted on: August 16, 2012, 12:16:48 00:16 - Automerged
no i cant use the capacitor big then 10nf ,because i am limited by the time (4052 used) and with atmega32 there no capacitor use in the adc input
"""""""""""""""""""""""""""""NOTA""""""""""""""""""""""""""""""" when i chortcut AN0 with 33k without signal i measure the voltage at AN0 =500mv !!!!!!!!!!!!!!!!!!!
i thik this (500mv) come from the mcu in the datasheet there no information (only in figure 21-3)
|
|
|
Logged
|
|
|
|
motox
Cracking Team
Active Member
Offline
Posts: 187
Thank You
-Given: 255
-Receive: 319
|
|
« Reply #26 on: August 15, 2012, 11:41:45 23:41 » |
|
The only possible thing I can imagine is a burnt pin. What is the RA0 pin voltage with the pin floating? Can you test with another PIC18F4550?
|
|
|
Logged
|
|
|
|
picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« Reply #27 on: August 15, 2012, 11:53:28 23:53 » |
|
yes i tesed it with two other mcu ,,,the same result
Posted on: August 16, 2012, 12:45:58 00:45 - Automerged
i change to an3 ,,,the same result
|
|
|
Logged
|
|
|
|
motox
Cracking Team
Active Member
Offline
Posts: 187
Thank You
-Given: 255
-Receive: 319
|
|
« Reply #28 on: August 16, 2012, 12:09:21 00:09 » |
|
Is the 4052 connected to the AN0 and AN5? Or are the PIC pins only pulled to ground by the 33k resistors?
Try to isolate the problem. Isolate the AN0 pin and forget the rest of the board. Hold the PIC in reset and measure the RA0 pin voltage (pin must be floating). Insert the pull down resistor and repeat the measurement. Write a small program to test only the ADC channel 0 with the pull down resistor. Measure again the voltage with the ADC running.
Tell me all the results.
|
|
|
Logged
|
|
|
|
picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« Reply #29 on: August 16, 2012, 12:21:37 00:21 » |
|
Is the 4052 connected to the AN0 and AN5? Or are the PIC pins only pulled to ground by the 33k resistors?
Try to isolate the problem. Isolate the AN0 pin and forget the rest of the board. Hold the PIC in reset and measure the RA0 pin voltage (pin must be floating). Insert the pull down resistor and repeat the measurement. Write a small program to test only the ADC channel 0 with the pull down resistor. Measure again the voltage with the ADC running.
Tell me all the results.
you can see at photo transmited ,now i work only with AN0 all the result transmitet are with AN0 AN0 free result=1023 AN0 chortcuted with gnd (near 7805) =3 AN0 chortcuted with 33k gnd =100 (voltage measured =arround 0.6V) AN0 chortcuted with 2.2k gnd =15 (voltage measured =arround 0.05V) no change
|
|
|
Logged
|
|
|
|
motox
Cracking Team
Active Member
Offline
Posts: 187
Thank You
-Given: 255
-Receive: 319
|
|
« Reply #30 on: August 16, 2012, 01:18:29 01:18 » |
|
You forgot this measurement: - Hold the PIC in reset and measure the RA0 pin voltage (pin must be floating - remove the 33k resistor). Check if the measured voltage corresponds to a floating pin. Tip: while measuring put one finger in the multimeter tip and with the other hand touch first the positive side of the power supply and then the ground. The multimeter should show the voltage rising and falling according to where you touch. - Insert the pull down resistor and repeat the measurement. Posted on: August 16, 2012, 01:34:02 01:34 - Automerged
I have a doubt: Capter 10.1: The TRISA register controls the direction of the RA pins, even when they are being used as analog inputs. The user must ensure the bits in the TRISA register are maintained set when using them as analog inputs.
I checked that, they are set to input. Posted on: August 16, 2012, 01:56:02 01:56 - Automerged
but "AN0 free result=1023" looks like a pull-up.
Yeah, but this micro doesn’t have a pull-up on RA0/AN0 pin. According to his info, this ‘pull-up’ is limiting the current to around 20uA…don’t know where it comes from…
|
|
« Last Edit: August 16, 2012, 12:28:55 12:28 by motox »
|
Logged
|
|
|
|
picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« Reply #31 on: August 16, 2012, 12:46:19 12:46 » |
|
hello every bady mclre is desactivated,i will activated for test
Posted on: August 16, 2012, 01:26:48 13:26 - Automerged
case 1 -system off (vdd=0) ( lcd off) -then hold on reset -system on (vdd=5v) (lcd on but no caractere on lcd) voltage mesured on an0: an0 free =5v an0 33k with GND =40mv (0.04v)
case 2 -system on(vdd=5v) (lcd active) -then hold on reset voltage mesured on an0: an0 free =5v an0 33k with GND =0.6v
i can see there the voltage decrease in case 1 (0.04v<0.5v)
|
|
|
Logged
|
|
|
|
motox
Cracking Team
Active Member
Offline
Posts: 187
Thank You
-Given: 255
-Receive: 319
|
|
« Reply #32 on: August 16, 2012, 01:35:10 13:35 » |
|
My conclusion is the PICs are broken. I use the PIC18F4550 a lot and never experienced something like that.
|
|
|
Logged
|
|
|
|
Pasca
Newbie
Offline
Posts: 34
Thank You
-Given: 27
-Receive: 42
|
|
« Reply #33 on: August 16, 2012, 01:42:42 13:42 » |
|
My conclusion is the PICs are broken. I use the PIC18F4550 a lot and never experienced something like that.
I would not be so sure. @picavr Please can you repeat case 2 without initialize adc in software? Can you connect oscilloscope probe on AN0 when res 33k is connect between AN0 and GND in normal operation mode (ADC run) to see what signal is there? If you dont have oscilloscope can you connect parallel 100nF or more capacitor to 33k res and verify that voltage across res decreases? I'm sorry, but you have to be tough to win it. Bye Pasca
|
|
« Last Edit: August 16, 2012, 01:56:57 13:56 by Pasca »
|
Logged
|
More I know, more I need to know. Less I know, meglio sto!!!
|
|
|
picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« Reply #34 on: August 16, 2012, 03:02:13 15:02 » |
|
bingo!!! i make a new poor pcb (attached) and there is no noise 33k attached at an0 and gnd the result is 0 yes ZERO an5 free =15
you can see the result on lcd an515v => an5=15 (15/1023)
an00v => an0=0 (0/1023)
i think the problem is not the GND plane ,because in the new one ,the pcb is not goood
but in the new pcb all other pin are free i will cut all other pin in my real pcb and i will post the result
Posted on: August 16, 2012, 03:29:12 15:29 - Automerged
AND THE PROBLEM IS RESOLVED I FOUND THAT THE PIN AN1 IS PULL UP WITH 12V (NOT 5V) by an 4.7k witout zener diode (5.1v) thank to all
(((((((((((((((((((((((((((((((((((((((((((((( IN 18f4550)))))))))))))))))))))))))))))))))))))))))))))) if you pulled up a adc input with a voltage ( >vdd) by a resistance you are in PROBLEM <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
|
Logged
|
|
|
|
motox
Cracking Team
Active Member
Offline
Posts: 187
Thank You
-Given: 255
-Receive: 319
|
|
« Reply #35 on: August 16, 2012, 03:19:00 15:19 » |
|
Picavr, next time provide a complete schematic like I asked before: The above schematic doesn’t correspond to your hardware. Show us a complete schematic.
I FOUND THAT THE PIN AN1 IS PULL UP WITH 12V (NOT 5V) by an 4.7k witout zener diode (5.1v)
If I knew about that circuit I would told you to check that in the first place.
|
|
|
Logged
|
|
|
|
picavr
Active Member
Offline
Posts: 173
Thank You
-Given: 263
-Receive: 100
|
|
« Reply #36 on: August 16, 2012, 05:47:46 17:47 » |
|
i think after that: then pic18f (or all pic) mcus ar note overprotected in adc mode for the complete pcb all pin (an0-an5) are protected by a zener diode 5.1v but in an1 it not placed (missed) *************************************************************************************************** *before this project ,i cant imagine an analogic input pulled up to voltage (> 5v) can cause this phenomene in other analogic pins * ***************************************************************************************************
i have some experience with pic ( 1999-2005) and after with avr (2006-2012) ,never imagine thanks for all
|
|
|
Logged
|
|
|
|
|