Miscellaneous › Others › Creating hex file problem
- This topic has 2 replies, 3 voices, and was last updated 7 years ago by Ashutosh Bhatt.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
February 24, 2016 at 12:12 pm #4319NavneetParticipant
Please help me out in creating the hex file for this code. I have tried using MPLAB using xc 8 compiler. but its showing error. timers.h header file is not found. If possible please help me in converting this to hex file. i need it urgently for my final semester project
#include <p18f4550.h>#include <timers.h>//======================= chip config ==================/#pragma config PLLDIV = 1#pragma config CPUDIV = OSC1_PLL2#pragma config FOSC = HSPLL_HS#pragma config USBDIV = 1#pragma config IESO = OFF#pragma config PWRT = OFF#pragma config BOR = OFF#pragma config VREGEN = OFF#pragma config WDT = OFF#pragma config WDTPS = 32768#pragma config CCP2MX = ON#pragma config PBADEN = OFF#pragma config LPT1OSC = OFF#pragma config MCLRE = ON#pragma config STVREN = ON#pragma config LVP = OFF#pragma config ICPRT = OFF#pragma config XINST = OFF#pragma config DEBUG = OFF#pragma config WRTD = OFF//======================= chip config ==================///LCD Control pins#define rs PORTBbits.RB4#define rw PORTBbits.RB3#define en PORTBbits.RB2//LCD Data pins#define lcdport PORTD#define lcd_port_dir TRISDvoid lcd_clear ( void );void lcd_2nd_line ( void );void lcd_1st_line ( void );void lcd_ini ( void );void dis_cmd ( unsigned char cmd_value );void dis_data ( unsigned char data_value );void lcdcmd ( unsigned char cmdout );void lcddata ( unsigned char dataout );void delay_ms ( int delay );//============================ TIMER 0 ISR ================================/#pragma interrupt tmr0_interruptvoid tmr0_interrupt(void){unsigned int v = 0;ADCON0 |= 0x02; // Start A/D conversionwhile ( ADCON0 & 0x02 ); // Wait until conversion gets overv = ADRESH;v = v << 8;v |= ADRESL;if ( ( v > 1 ) && ( v < 100 ) ){CCP1CON |= ( ( v & 0x03 ) << 4 );CCPR1L = v >> 2;}else;INTCONbits.TMR0IF=0;}//============================ TIMER 0 ISR ================================/void adc_init(void){TRISA |= 0x01; // Configure RA0 as input pinLATA = 0;ADCON1=0x0E; // Make RA0/AN0 pin as analog pin (Other pins remain to be digital I/O)ADCON0=0x00; // Select Channel0 & ADC offADCON2=0x80; // Right justified, 0TAD, Fosc/2 clock optionADCON0bits.ADON = 1; // Enable ADC}void main ( void ){unsigned char data1 [] = "EngineersGarage";unsigned char data2 [] = " AUDIO IN OUT ";int i = 0;OSCCON = 0x0C;lcd_ini (); // LCD initializationdelay_ms ( 200 );//========================= start up display on LCD ===============================/while ( data1 != '