CRTC Electronics

Click here to edit subtitle

C Template

#include <stdio.h>
#include <stdlib.h>
#include <xc.h>

#pragma config MCLRE = ON, CP = OFF, CPD = OFF, BOREN = OFF, WDTE = OFF
#pragma config PWRTE = OFF, FOSC = INTRCIO
#define _XTAL_FREQ 8000000

/*******************************************************************
                     Name of Project
                        ___________
                    +   !Vdd   Vss!   -
                        !A5     A0!
                        !A4     A1!
                        !A3     A2!
               LED 4    !C5     C0! LED 1
               LED 5    !C4     C1! LED 2
               LED 6    !C3     C2! LED 3
               LED 7    !C6     B4!
               LED 8    !C7     B5!
                        !B7     B6!
                        -----------

*******************************************************************/

/*******************************************************************
  for(int i = 0; 1 < 55; i++)
        {
            //do something here
        }
*******************************************************************

     while(true)
    {
       //do something here
    }
*******************************************************************

 if(ture)
  {
    //do something here
  }
  else if (true)
  {
    //do something here
  }
  else
  {
    //do something here
  }

*******************************************************************/

void SetUpIO()
{
    // SETUP INPUTS and OUTPUTS        0=Output  1=Input
    TRISA = 0b00000000;    //PORTA
    TRISB = 0b00000000;    //PORTB
    TRISC = 0b00000000;    //PORTC
    VRCON = 0;
    CM2CON0 = 0;
}

int main(int argc, char** argv)
{


    SetUpIO();
    while(1)
    {

        PORTA = 0b11111111;
        __delay_ms(500);   //this will show an error but will compile fine
        PORTA = 0b00000000;
        __delay_ms(500);  //this will show an error but will compile fine


        

    }


    return (EXIT_SUCCESS);
}




Link

 

#include <stdlib.h>
#include <xc.h>

#pragma config MCLRE = ON, CP = OFF, CPD = OFF, BOREN = OFF, WDTE = OFF
#pragma config PWRTE = OFF, FOSC = INTRCIO
#define _XTAL_FREQ 8000000

/*******************************************************************
                     Name of Project  
                        ___________
                    +   !Vdd   Vss!   -
                        !A5 A0!
                        !A4 A1!
!A3 A2!
                        !C5 C0!
                        !C4 C1!
                        !C3 C2!
                        !C6 B4!
                        !C7 B5!
                        !B7 B6!
-----------

*******************************************************************/


/*******************************************************************
  for(int i = 0; 1 < 55; i++)
        {
            //do something here
        }          
******************************************************************* 
  
     while(true)
    {
       //do something here
    }     
*******************************************************************
  
 if(ture)
  {
    //do something here
  }
  else if (true)
  {
    //do something here
  }
  else
  {
    //do something here
  }
  
*******************************************************************/

void SetUpIO()
{
    // SETUP INPUTS and OUTPUTS        0=Output  1=Input
    TRISA = 0b00000000;    //PORTA
    TRISB = 0b01110000;    //PORTB
    TRISC = 0b00000000;    //PORTC
    VRCON = 0;
    CM2CON0 = 0;
}





int main(int argc, char** argv)
{
 


    
    
    
    
    
    
    
    
    
    
    
    
    
    return (EXIT_SUCCESS);
}







#pragma config MCLRE = ON, CP = OFF, CPD = OFF, BOREN = OFF, WDTE = OFF
#pragma config PWRTE = OFF, FOSC = INTRCIO
#define _XTAL_FREQ 8000000
https://docs.google.com/file/d/0ByEqF97nn9I2bS1zQnNaMVJvSGc/edit?usp=sharing
 

#pragma config MCLRE = ON, CP = OFF, CPD = OFF, BOREN = OFF, WDTE = OFF
#pragma config PWRTE = OFF, FOSC = INTRCIO
#define _XTAL_FREQ 8000000

#include <stdlib.h>
#include <xc.h>

Members Area

Recent Blog Entries

Upcoming Events

Recent Videos

Recent Photos

Recent Forum Posts