jayanth.devarayanadurga
Banned
- Joined
- Dec 4, 2012
- Messages
- 4,280
- Helped
- 822
- Reputation
- 1,654
- Reaction score
- 791
- Trophy points
- 1,393
- Location
- Bangalore, India
- Activity points
- 0
I have written a USART program for PIC18F45K22 in MPLAB 8.89 with Hi-Tech C PICC-18 9.90 as the Compiler but when I try to build the project nothing happens. The ouput files are not created. My other Hi-Tech projects Compile fine but this project is not Compiling. Can someone please build the project (Release and Debug versions) and send me the hex file. My Fosc is 16 MHz
I have attached the project files. I am using Hi-Tech C PICC-18 9.80 PRO. Can somebody guess what might be the problem for project not Compiling?
I have modified the code. Here is my new code. It is not working. I am just trying to transmit a character 'A' to USART.
I have attached the project files. I am using Hi-Tech C PICC-18 9.80 PRO. Can somebody guess what might be the problem for project not Compiling?
I have modified the code. Here is my new code. It is not working. I am just trying to transmit a character 'A' to USART.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 #include <htc.h> //__CONFIG(FOSC_HS & WDTE_OFF & PWRTE_ON & CP_OFF & BOREN_ON & LVP_OFF & CPD_OFF & WRT_ON & DEBUG_OFF); #define _XTAL_FREQ 16000000 //MHz int main() { TRISDbits.RD6 = 0; //TX Pin TRISDbits.RD7 = 1; //Rx Pin PORTD = 0x00; INTCONbits.PEIE = 1; INTCONbits.GIEL = 1; INTCONbits.GIE = 1; INTCONbits.GIEH = 1; PIE1bits.RC1IE = 1; PIE1bits.TX1IE = 1; PIE3bits.RC2IE = 1; PIE3bits.TX2IE = 1; IPR1bits.TX1IP = 0; BAUDCON1bits.BRG16 = 0; BAUDCON2bits.BRG16 = 0; SPBRG2 = 25; TXSTA2 = 0x2A; RCSTA2bits.SPEN = 1; ANSELD = 0xFF; /* TXSTA1bits.TX9D = 0; TXSTA1bits.TRMT = 1; TXSTA1bits.BRGH = 1; TXSTA1bits.SENDB = 0; TXSTA1bits.SYNC = 0; TXSTA1bits.TXEN = 1; TXSTA1bits.TX9 = 0; TXSTA1bits.CSRC = 0; */ while(1) { TXREG2 = 'A'; while(PIR3bits.TX2IF == 0); } }
Attachments
Last edited: