problem RB4-7 on a 18F876A
hello all
last year i had a problem on these inputs also. i had a keypad matrix with RB0-3 as outputs (with diode) and RB4-7 as inputs (external pull downs, no interrupts!). with a keypad with a cable of 20cm it ever works fine. later in the installation with a keypad cable of about 150cm, after a while the pic ever seems frozen in a state where he never came back. because i hadn't much time then i solved the problem when i changed the inputs RB4-7 to RC0-3 where the longer cabel never was a problem.
some idea what that could be then?
now, RB5-7 are inputs with internal pull up and interrupt. the pic-board is powered by a power supply. i have an old soldering iron. when i turn it out, i get some short noise over 230V back to the 5V of my pic. then an interrupt is initialised over my RB5-7 inputs. i solved it now with a 10ms delay in the begin of the interrput servide routine and asking RB5-7 back again before execute the code.
but what could be the reason for this? that the pull up of RB5-7 are connected to 5V....
sorry for this mystified characterisation and thanks for any ideas
If your VDD is not well decoupled
Hi,
It is a good practice to have the PIC powered by a separate regulator and the rest with another one. When the internal pull-ups are enabled and there is a glitch in the PS then interrupts can occur without possibly resetting the chip through brown-out detect. I have found that in noisy environments with tens of MOCB and contactors switching in an out there are false interrupts due to interference. I revised my PCBs and redesigned the PS. It did improve but was never totally fool proof. Normally the PICs are very stable from EMI standpoint. So the only way out was software. I introduced a short delay just entering the interrupts and checked that if the PIN was still high (or low). Since the interrupt is predictable you can detect if it was a glitch. Then simply clear the flags and quit from the interrupt. BTW I use asm interrupts.
Hope this helps.
Regards
Sougata
Knowing your entire setup would help
Hi,
Internal pull ups are weak as stated and Steve is again damn right. Optocontrollers do help but then you need an additional power line light the LEDs. PCB layout is equally important. If you post your whole code then we can find out if it is an interrupt issue. Normally a PIC would reset if it freezes, (WDT) so an improper code may put your PIC in endless loop especially interrupts. If you do not have an ICD then it is possible to dump some values of the SFRs related to PIC power, stack etc,. This would ease diagonisis what went wrong and where.
Then you loose interrupts too
Hi,
If you change from PORTB to PORTA you will be loosing interrupts. So might limit the functionality of your system. Why not revise the pull-ups have a clean PS proper freewheeling diodes for the relays and so on
sorry, don't unterstand...
Quote:
Why not revise the pull-ups have a clean PS proper freewheeling diodes for the relays and so on
what means this? external pull ups and then ... power supply something...?
sorry, my english is not so fine ;-)