What compiler are you using? MPLAB xIDE? Is C your go-to language? I'm more of a BASIC guy if I have my choice, but I do know some C. You're using a C based language, but I'm not familiar the commands you are using.
The tutorials at electrosome.com are pretty awesome. Here's a very basic one for making an LED blink on and off using an MPLAB compiler and C based code
https://electrosome.com/led-pic-microco ... mplab-xc8/In my experience, when something "kinda" works, but doesn't work perfectly, it's usually a problem with the config or registers. Your configs look a little sparse.
Is ~ the command for toggle? Perhaps, instead of trying to use the toggle command, try a more straight forward approach:
Code:
void main() {
TRISAbits.TRISA1 = 0; // Set RA1 as output
while (1)
{
LATAbits.LATA1 = 1; // Set RA1 as HIGH
Delay10KTCYx(25); // Delay
LATAbits.LATA1 = 0; // Set RA1 as LOW
Delay10KTCYx(25); // Delay
}
}
In my experience, the canned command statements like toggle and button and pot just causes more trouble than it's worth when your code starts getting more intricate. They only save you a couple lines of code, use up more processor, and can be a little buggy with certain PICs.
_________________
*patience is a virtue*
Please do not PM me. email is prefered.
keith@buildyourownclone.com