Had to document the fact i started to dig into the series 24 of the PICs (PIC24FJ64GB002), after some time in the PIC16F (887 and 886 mainly) and some PIC18.
This time, im using the Microstick II board.
My intention is to start looking at the USB stack !!
/* ** ** Hello1.c my first PIC24fj program in C */ #include <p24FJ64GB002.h> // this is the config bits that work for me on my microstick II _CONFIG1( JTAGEN_OFF // disable JTAG interface & GCP_OFF // disable general code protection & GWRP_OFF // disable flash write protection & ICS_PGx2 // ICSP interface (2=default) & FWDTEN_OFF) // disable watchdog timer #define DELAY 1600 // use just 10 to speed up the simulation with MPLAB SIM unsigned char count; // an 8-bit counter (also see chapt.4) main() { // init control registers TRISA = 0xff00; // all PORTA as output T1CON = 0x8030; // TMR1 on, prescale 1:256 Tclk/2 // init counter count = 0; // main application loop while( 1) { // increment counter value count = count+1; // output counter value and wait PORTA = count; TMR1 = 0; while ( TMR1 < DELAY) { } } // main loop } // main
No comments:
Post a Comment
Feel free to contact me with any suggestions, doubts or requests.
Bless