help with adc 12bit
Posted: Mon Oct 24, 2016 11:38 pm
I need a code with hysteresis 10 mv.
He needs to work well when reading adc is greater than 1.3 V my exit will be 1 and when the reading is less than 1.29 V my output will be 0. I'm reading a gear tooth with a hall and then I will have only two transition stages ( with tooth or toothless) and therefore need a hysteresis in changing stages .The difference of tension between tooth and tooth is not only 10 mv at the iC hall.
I'm using pic18f2423 with 12-bit ad converter and I'm using mcp1525 2.5 V to VREF +.
I Medelec help in the code that I am attaching .What is happening is that I'm simulating these tensions with a potentiometer and when I have the voltage below 1.29 V the output is okay. But when I raise output above 1.29 V to 1.30 V (my region hysteresis) the output is cycling and stabilizes only when it exceeds 1.33 V which should be 1.3 V. I do not know if I'm correct but my reference voltage is 2.5 V and the Resolution of the ad converter is 4095 then 2.5 / 4095 = 0.0006 which should differentiate the hysteresis 10 mv. It seems that the code is not this getting to understand the adc 12 bit if I'm correct. I am attaching the code for someone to help.
Grateful;
Ricardo
He needs to work well when reading adc is greater than 1.3 V my exit will be 1 and when the reading is less than 1.29 V my output will be 0. I'm reading a gear tooth with a hall and then I will have only two transition stages ( with tooth or toothless) and therefore need a hysteresis in changing stages .The difference of tension between tooth and tooth is not only 10 mv at the iC hall.
I'm using pic18f2423 with 12-bit ad converter and I'm using mcp1525 2.5 V to VREF +.
I Medelec help in the code that I am attaching .What is happening is that I'm simulating these tensions with a potentiometer and when I have the voltage below 1.29 V the output is okay. But when I raise output above 1.29 V to 1.30 V (my region hysteresis) the output is cycling and stabilizes only when it exceeds 1.33 V which should be 1.3 V. I do not know if I'm correct but my reference voltage is 2.5 V and the Resolution of the ad converter is 4095 then 2.5 / 4095 = 0.0006 which should differentiate the hysteresis 10 mv. It seems that the code is not this getting to understand the adc 12 bit if I'm correct. I am attaching the code for someone to help.
Grateful;
Ricardo