-
Categories
-
Platforms
-
Content
In general, if you don't understand it, turn it off.
when you decide you need those things (watchdog timers, etc) then you can turn them on.
DO NOT turn off Low Voltage Programming (LVP).
__CONFIG(HS & // External Crystal at High Speed
WDTDIS & // Disable Watchdog Timer.
PWRTEN & // Enable Power Up Timer.
BORDIS & // Disable Brown Out Reset.
MCLREN & // MCLR function is enabled
LVPDIS); // Disable Low Voltage Programming.
But what is watchdog timer all that ? when to used them ?
why do not turn off LVP ?
But I see the code from some web they disable it ?
Code:__CONFIG(HS & // External Crystal at High Speed WDTDIS & // Disable Watchdog Timer. PWRTEN & // Enable Power Up Timer. BORDIS & // Disable Brown Out Reset. MCLREN & // MCLR function is enabled LVPDIS); // Disable Low Voltage Programming.
Thank you
Oh..Now I understand.
I seldom use PORTA=0b00000010.
It is the same as if I define my LED = RA1, then in my code I wan it to get high I can just write LED =1.
Same thing right ?
Correct me if I am wrong![]()
No..I just wan to ask
PORTA=0b00000010 means that I light up the LED at pin RA1 rite ?
My way is that :
#define LED RA1
void main()
{
LED=1;
delay(10000);
LED=0;
}
which is same as
void main()
{
PORTA=0b00000010;
delay(10000);
PORTA=0b00000000;
}
Both are same rite ?
You would answer your own question if you looked at the header file included in the above code for your pic. Read again what I said and then go look at the header file. Prove it to yourself that the above is true.
C:\Program Files (x86)\HI-TECH Software\PICC\9.83\include is where the headers can be found for the pic's on my computer. Your location should be similar if you are using MPLAB and the C compiler.
What header should I find ?
Then presuming all bits are outputs, you're turning one on and seven off. I'll leave it to you to determine which one you're turning on (high) and which seven you're setting low.
Perhaps you should try to pick up something like "123 PIC Microcontroller experiments for the evil genius". It does a reasonable job of explaining the basics even if you don't make any of the projects.