4
\$\begingroup\$

I have a piece of code that toggles the GP2 pin on a PIC12F615 and suddenly it started producing a weird waveform, I'm not sure what I've done that could cause this. I isolated the code that toggles the pin alone in a new project to see if I'm doing something wrong but I still get the same result.

Here's the waveform:

enter image description here And here's the code

void main(void)
{
    __delay_ms(10);

    TRISAbits.TRISA2 = 0;
    while(1)
    {
        PORTAbits.GP2 = 0;
        __delay_us(55);
        PORTAbits.GP2 = 1;
        __delay_us(55);
    }

    return;
}
\$\endgroup\$
  • 1
    \$\begingroup\$ Try a different pin. \$\endgroup\$ – Eugene Sh. Jul 25 '17 at 14:55
  • 2
    \$\begingroup\$ It looks like the transistor that sinks (NMOS) is broken. Because it's not happening, the capacitance is discharging through the probe by the looks of it. But I'll second @EugeneSh. and ask you to test another pin as well. \$\endgroup\$ – Harry Svensson Jul 25 '17 at 15:00
  • 1
    \$\begingroup\$ Usually fried transistors will go short so you'll see something intermediate, but maybe you fried the metalization or something. Try another chip. \$\endgroup\$ – Spehro Pefhany Jul 25 '17 at 15:01
  • 2
    \$\begingroup\$ General rule of electronics... If it worked before and it does not work now... what did you do in between. If the pin is attached to something check the circuit loads. If not, what else did you change. It could also always be static discharge if you are not following proper ESD protection techniques. \$\endgroup\$ – Trevor_G Jul 25 '17 at 15:03
  • 2
    \$\begingroup\$ I'd highly recommend spending some time figuring out how your pin got fried. If it happened once, it will probably happen again. \$\endgroup\$ – Mathieu L. Jul 25 '17 at 15:31
3
\$\begingroup\$

It looks like the transistor that sinks (NMOS) is broken. Because it's not happening, the capacitance is discharging through the probe by the looks of it.

But the pin is still usable if you just use a pull down resistor on that pin. Say 2k ohm resistor tied to ground.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.