Input issue on a Pic16F88

PaulEE

Joined Dec 23, 2011
474
Yeah.

I don't think mods care about computer programming. I think the reason the automotive guidelines exist are to protect people from the dangers that can result in modifying the internals of the car's electrical system.

If you're simply programming a PIC, you don't have to advertise the fact that you're working in a car.

I'm actually surprised that none of the mods shut off this thread yet. At the very least, I'm sure they've seen and debated about it.
 

PaulEE

Joined Dec 23, 2011
474
For those interested on why the RA4 interrupt wouldn't work, the interrupt on RA4 was dedicated to TMR0 and not the comparators. B7, a spare pin in the design, is going to be sub'd for RA4.
 

Thread Starter

Geoffr67

Joined Dec 5, 2011
69
For those interested on why the RA4 interrupt wouldn't work, the interrupt on RA4 was dedicated to TMR0 and not the comparators. B7, a spare pin in the design, is going to be sub'd for RA4.

I will be modifying the program now and then reflashing the 88 to try this solution.
 

Thread Starter

Geoffr67

Joined Dec 5, 2011
69
Excellent! Let us know!
well i reflashed the 88 used port B7 instead of A4 addes a 4.7k pulldown resistor, and it WORKS as intended. SO FAR. i am going to do some further testing before i call it a success. Im gonna have another beer and work on this some more. ill call it a final sucess after im done :).
 

PaulEE

Joined Dec 23, 2011
474
well i reflashed the 88 used port B7 instead of A4 addes a 4.7k pulldown resistor, and it WORKS as intended. SO FAR. i am going to do some further testing before i call it a success. Im gonna have another beer and work on this some more. ill call it a final sucess after im done :).
EXCELLENT news! Let us know when "success" means "SUCCESS"! Thanks for the continued updates.
 

Thread Starter

Geoffr67

Joined Dec 5, 2011
69
EXCELLENT news! Let us know when "success" means "SUCCESS"! Thanks for the continued updates.
Unfortunatly its not a complete sucess. It works better, BUT it still isnt rock solid, sometimes when i boot the ckt, it will not change modes, as indicated on a LCD screen. What ive noticed after testing is If i let it sit for 5-10 sec between applying pwr is it works. if i remove power and then reapply pwr to the ckt it does not work. Im wondering if my power supply mainly the capacitors used as filters is still powering the ckt after 12v is removes for a few sec as they discharge and causing it to hang up when power is reapplied quickly. Tell me what you all think here. Im learning allot!
 

PaulEE

Joined Dec 23, 2011
474
Unfortunatly its not a complete sucess. It works better, BUT it still isnt rock solid, sometimes when i boot the ckt, it will not change modes, as indicated on a LCD screen. What ive noticed after testing is If i let it sit for 5-10 sec between applying pwr is it works. if i remove power and then reapply pwr to the ckt it does not work. Im wondering if my power supply mainly the capacitors used as filters is still powering the ckt after 12v is removes for a few sec as they discharge and causing it to hang up when power is reapplied quickly. Tell me what you all think here. Im learning allot!
What you just said is accurate. For a few seconds after power is removed, the PIC still runs.

Obvious things to check:
-Check that the interrupt routine checks which button is being pressed
-Check that the TRISB.B7 bit is SET "1"
-Check that a 16-bit timer isn't throwing random interrupts upon overflow (which is tied to RB7, as we talked about)

I'd be happy to look at your edits if you want. I'm done for tonight, though. It's 3 am my time.
 

Thread Starter

Geoffr67

Joined Dec 5, 2011
69
What you just said is accurate. For a few seconds after power is removed, the PIC still runs.

Obvious things to check:
-Check that the interrupt routine checks which button is being pressed
-Check that the TRISB.B7 bit is SET "1"
-Check that a 16-bit timer isn't throwing random interrupts upon overflow (which is tied to RB7, as we talked about)

I'd be happy to look at your edits if you want. I'm done for tonight, though. It's 3 am my time.
ok this makes sense then.
In flowcode i set port b7 as a input Single bit, not masking or entire port.. it is definatly reading the pin. just not all the time.

I do not have the 16bit timer enabled i dont think i should need that timer active to poll the status of that pin +5V logic 1 or 0 v logic zero. depending on the state of the pin it throws it into varible and then makes a decision on if it should enter this mode or the other mode.

I dunno if this helps.
 

PaulEE

Joined Dec 23, 2011
474
ok this makes sense then.
In flowcode i set port b7 as a input Single bit, not masking or entire port.. it is definatly reading the pin. just not all the time.

I do not have the 16bit timer enabled i dont think i should need that timer active to poll the status of that pin +5V logic 1 or 0 v logic zero. depending on the state of the pin it throws it into varible and then makes a decision on if it should enter this mode or the other mode.

I dunno if this helps.
I recall your code constantly using PORTB for LCD operations. I am concerned that the TRISB.B7 bit is being written, or something along those lines. If you re-send the code, I can check out the mods you made.

Timer1 shouldn't need to be enabled, but the interrupt that is attached to RB7 that triggers the timer1if (the interrupt flag for timer1) does need enabled, but you probably knew that/did that already.
 

Thread Starter

Geoffr67

Joined Dec 5, 2011
69
I recall your code constantly using PORTB for LCD operations. I am concerned that the TRISB.B7 bit is being written, or something along those lines. If you re-send the code, I can check out the mods you made.

Timer1 shouldn't need to be enabled, but the interrupt that is attached to RB7 that triggers the timer1if (the interrupt flag for timer1) does need enabled, but you probably knew that/did that already.
I understand, but what i dont get now that its on portB7 is that on a cold boot it works, if i disconnect power and then reapply within a few seconds it no longer works. If i wait 5-10 sec between boots, it works fine again.
When you come back on paul ill send you updated code.
 

Thread Starter

Geoffr67

Joined Dec 5, 2011
69
I understand, but what i dont get now that its on portB7 is that on a cold boot it works, if i disconnect power and then reapply within a few seconds it no longer works. If i wait 5-10 sec between boots, it works fine again.
When you come back on paul ill send you updated code.
Well, did some more testing today, It seems that if its a cold boot the thing works, If power is reapplied quickly it does not work. If i let it chill for about 5 sec it then works again. im thinking it could be the caps, How could i discharge them quickly once the power is removed? i want to try this to see if it solves the problem.
 

PaulEE

Joined Dec 23, 2011
474
Well, did some more testing today, It seems that if its a cold boot the thing works, If power is reapplied quickly it does not work. If i let it chill for about 5 sec it then works again. im thinking it could be the caps, How could i discharge them quickly once the power is removed? i want to try this to see if it solves the problem.
It might solve the problem, but it's bandaid-ish.

Do you have the power-on reset timer enabled or disabled?
 
Top