Labs/Lab6/lab6_orig_2021.c
/******************************************************************************
 * Initial()
 *
 * This subroutine performs all initializations of variables and registers.
 * 
 ******************************************************************************/
Initial()
This subroutine performs all initializations of variables and registers.
Initial () This subroutine performs all initializations of variables and registers .
void Initial() {
    TRISD  = 0b00001111;
    LATD = 0;
    TRISC  = 0b10010011;
    LATC = 0;
    LCD_RS_TRIS   = 0;              
    LCD_E_TRIS    = 0;              
    LCD_DATA_TRIS = 0b11000000;     
    LCD_DATA_LAT = 0;           
    InitLCD();
    DisplayC(LCDRow1);
    T0CON = 0b01001000;             
    TMR0L = 0;                      
    TMR0H = 0;
    RCONbits.IPEN = 1;              
    INTCON2bits.TMR0IP = 0;         
    INTCONbits.TMR0IE = 1;          
    INTCONbits.GIEL = 1;            
    INTCONbits.GIEH = 1;            
    T0CONbits.TMR0ON = 1;           
}
void Initial ( ) { TRISD = 0b00001111 ; LATD = 0 ; TRISC = 0b10010011 ; LATC = 0 ; LCD_RS_TRIS = 0 ; LCD_E_TRIS = 0 ; LCD_DATA_TRIS = 0b11000000 ; LCD_DATA_LAT = 0 ; InitLCD ( ) ; DisplayC ( LCDRow1 ) ; T0CON = 0b01001000 ; TMR0L = 0 ; TMR0H = 0 ; RCONbits . IPEN = 1 ; INTCON2bits . TMR0IP = 0 ; INTCONbits . TMR0IE = 1 ; INTCONbits . GIEL = 1 ; INTCONbits . GIEH = 1 ; T0CONbits . TMR0ON = 1 ; }
Initial()
 This subroutine performs all initializations of variables and registers.
Initial () This subroutine performs all initializations of variables and registers .
// Configure the IO ports // Configure the LCD pins for output. Defined in LCDRoutinesEasyPic.h // Register Select Control line // Enable control line  // Note the LCD data is only on the upper nibble RB0:3 // Redundant to line above RB 4:5 for control // RB 6:7 set as inputs for other use, not used by LCD // Initialize LCD data LAT to zero // Initialize the LCD and print to it // Initializing TMR0 // 8-bit, Fosc / 4, no pre/post scale timer // Clearing TMR0 registers // Configuring Interrupts // Enable priority levels // Assign low priority to TMR0 interrupt // Enable TMR0 interrupts // Enable low-priority interrupts to CPU // Enable all interrupts // Turning on TMR0