Mrunal Ahirrao
Full Member level 2
- Joined
- Nov 26, 2012
- Messages
- 133
- Helped
- 2
- Reputation
- 4
- Reaction score
- 2
- Trophy points
- 1,298
- Location
- India
- Activity points
- 2,213
/
sbit OLow at RB0_bit;
sbit ILow at RA2_bit;
sbit BM at RB7_bit;
sbit OHigh at RB2_bit;
unsigned short SUBS;
void main() {
TRISA=0b00100100;
TRISB=0b00000111;
CMCON =0x07;
//ANSEL=0;
//OSCCAL=0b11111100;
OPTION_REG=0b00110000;
BM=0;
//SUBSW=0;
SUBS=1;
do{
if(SUBS==1&&OLow==0)
{
delay_ms(30000); //Rechecking whether Olow==1
if(BM==0&&OLow==0){
delay_ms(30000);
if(BM==0&&OLow==0){
delay_ms(30000);
if(BM==0&&OLow==0){
delay_ms(30000);
if(BM==0&&OLow==0){
delay_ms(30000);//Recheck completed
delay_us(200);
if(ILow==1)
{
BM=1;
SUBS=0;
}
//SUBST();
}
}
}
}
}
//delay_us(200);
if(ILow==0)
{
BM=0;
SUBS=1;
}
if(OHigh==1)
{
BM=0;
SUBS=1;
}
}while(1);
}
I have used this method but its behaving same. the LED is getting off just when I touch the RA2 pin with my handThe simple debug method is to use led on pin7 and a switch on pin1 to simulate the scenario.
I have used internal pullups and I have also checked voltage on that pin, it was 4.25V when I didn't touched with my hand and its, 4.18V when I touched that pin with hand. and how We can validate by software regarding internal pull ups?hello,
Did you put pull-up resistors to Vdd to fix the voltage (at logical level 1) when not connected to the Zero by the switch.
you can use 2.7K up to 10K Resistor value.
internal pull up for PORT B are too high ..abd must be validate by software
Earth is good and as a sensor its magnetic float sensor!did you check if you have earth leckageproblem..with AC power supply.
Water level.. is the recipe conneced to the earth (Ground) ?
Actually I am using internal pullups and its a 1N4148 diode which in series with VDD and not a resistor! and yes its single layer PCB.Could you post a schematic of your circuit?
From what I understand of your PCB, RB1 is floating, there is no external pullup, only a couple of connectors for LEDs and sensors?
What value has the resistor in series with the Vdd supply to the PIC?
Is this a single layer PCB?
Have you got a datasheet of your sensors?
Check once again your power supply connection.
Check once with Blinking LED code.
Which programer you are using?
Hi,
avoid floating (digital) inputs.
and you have to take care of the "absolute maximum ratings". Especially with the sensor connection to "unknown" voltage levels. I recommend additional protection diodes.
Klaus
Yes I have connected 5V to VDD and I have measured its correct 5V. And I have not connected ground of PIC via a resistor, its a jumper.One possibility, you do actually have the 5v connected to the power pin of the PIC? If you don't you could be powering the PIC via one of its inputs which would explain its strange behavior. Measure the 5V with a load. Also the 0V goes to the PIC via a resistor? check this. Why would you want to connect the ground of the PIC via a resistor? If you were to show the circuit it would be a lot easier to help you.
EMI? so how should I ground? where should I ground?to pin which is giving error? and will 0.1 uf cap would suffice?Looks like an EMI noise issue. Try grounding. Direct or with a cap..
What is result for blinking LED code?? did you get same on time and off time
There is any oscillator settings or configuration bits in PIC PGM????
yea this is something I was unknown about. I will try.If you are using a diode on the Vdd to the PIC you need to add decoupling capacitor(s) on the inside of the diode. 100nF in parallel with 1-10uF should be good.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?