Tuesday 23 May 2017

microcontroller - Is my GPIO pin fried?


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;

}

Answer



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.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...