PDA

View Full Version : Strange electrical behavior with PIC16F684



xnihilo
- 27th March 2008, 18:09
I'm using the following connexions for pic16F684. It is connected to a 8*2 LCD display.
Power supply is 9V duracell with 5V L7805 voltage regulator.

VDD: +5V
VSS: 0V
There is a ceramic disk 0.1 UF capacitor between VSS and VDD pins.

I enabled PORTA on-change interrupts because I need to monitor for a 5V pulse on RA5 which is default low (I disabled WPU and set the port as output and set PORTA.5=0)

RA0: nothing connected, output, WPU disabled
RA1: nothing connected, output, WPU disabled
RA2: nothing connected, output, WPU disabled
RA3: nothing connected, with an external 10k weakPU between the pin and +5V, INT enabled
RA4: nothing connected, internal WPU enabled, INT enabled
RA5: nothing connected, WPU DISABLED, INT enabled

RC0: lcd data bit 4
RC1: lcd data bit 5
RC2: lcd data bit 6
RC3: lcd data bit 7
RC4: with an external 10k weakPU between the pin and +5V, LCD R/S bit
RC5: LCD Enable bit

When I touch any pin, an int is triggered on portA.5 (RA5).

WHY???

sougata
- 27th March 2008, 18:13
Hi,

Try using a pullup 2.7K resistor on the PIN.

While touching the pin you may induce quite a few volts(k) so perhaps it is not a good practice. PICs are sensitive to esd which may kill them.

mister_e
- 27th March 2008, 21:51
No pull-up or WPU... the i/o is set as an output and set to low and AN INT happen???? huh???? I must miss something here!

Maybe i'm blind... but i don't see any cod in here... so i would assume the TRIS register haven't been changed. Try LOW PORTA.5 instead.. if this work.. it just mean you didn't at least changed TRISA setting....or the INT don't care about the TRIS... i'll check the datasheet...

xnihilo
- 27th March 2008, 22:48
Hi,

Try using a pullup 2.7K resistor on the PIN.

While touching the pin you may induce quite a few volts(k) so perhaps it is not a good practice. PICs are sensitive to esd which may kill them.

I can't use a WPU because I want this pin LOW by default.

Huh... Yes, I know about ESD, I should be more careful. Anyway PICs are pretty tough.

xnihilo
- 27th March 2008, 22:53
No pull-up or WPU... the i/o is set as an output and set to low and AN INT happen???? huh???? I must miss something here!


Yes an int happens... No clue why it happens.


Maybe i'm blind... but i don't see any cod in here... so i would assume the TRIS register haven't been changed. Try LOW PORTA.5 instead.. if this work.. it just mean you didn't at least changed TRISA setting....or the INT don't care about the TRIS... i'll check the datasheet...

I didn't put any code here but beleive me,

TRIS is set as 0 (output) for RA5 and I used PORTA.5 = 0 to be sure it has been set LOW.

I beleive the pin should be low and an int should be triggered when I apply +5V on the pin to set it logicaly HIGH but that's not what's happening.
And an int happens for this pin even in I touch another pin or even the GND heatsink of the L7805 voltage regulator or +5V or GND...

I checked the connexions on the breadboard and everything looks fine...
Very frustrating.

mister_e
- 27th March 2008, 23:07
obviously, there's something else... great news i have over 500 of those in stock :D

i'll try a simple snippet and see what happen. I would guess the interrupt will happen 'cause it's feeded in a X way inside. Probably you will need to disable the interrupt as well...

let's see what will happen on my side in a few minutes.. gimme 1/2 hour + couple of RedBull+Amaretto (even if i shouldn't... don't tell to my doctor ;) )... or so.

mister_e
- 28th March 2008, 01:51
unable to reproduce the problem here...

post your code.

sougata
- 28th March 2008, 06:09
When I touch any pin, an int is triggered on portA.5 (RA5).

WHY???

Hi,

Is your PORTA.5 changing all the time. Please note that the latch that holds the value for a mismatch is not cleared upon MCLR reset. Thus depending on your code there may be a condition where your PIC resets and you don't realize. (If you are manually polling values)

Please post your complete code and schematic.

xnihilo
- 28th March 2008, 06:53
obviously, there's something else... great news i have over 500 of those in stock

i'll try a simple snippet and see what happen. I would guess the interrupt will happen 'cause it's feeded in a X way inside. Probably you will need to disable the interrupt as well...

let's see what will happen on my side in a few minutes.. gimme 1/2 hour + couple of RedBull+Amaretto (even if i shouldn't... don't tell to my doctor or so.

Redbull + Amareto... Thats GEEK stuff ;) ;) ;)

xnihilo
- 28th March 2008, 06:55
unable to reproduce the problem here...

post your code.

You don't have exactly the same components and connexion :(

How can I discover the source of the problem... I will have to rebuild a clone of the system but this time not on a breadboard.

xnihilo
- 28th March 2008, 06:58
Hi,

Is your PORTA.5 changing all the time. Please note that the latch that holds the value for a mismatch is not cleared upon MCLR reset. Thus depending on your code there may be a condition where your PIC resets and you don't realize. (If you are manually polling values)

Please post your complete code and schematic.

Okay, I will draw the schematics today.
The code is huge (I fill all the 2048 words program space!!).

PortA does not change all the time. It is set as output and set to LOW, there is no reason why it should change.
When an interrupt occurs, the int handler takes care of reading porta to refresh the latch so there should be no mismatch.