hi guys
i modified a serial program that i found so it can work for my pic18f97j60.i 'm using usart2.
although the program is build successfully every time i add the u2putrs .c file i get
C:\MCC18\src\pmc_common\USART\u2putrs.c:14:Error [1109] type mismatch in redeclaration of 'putrs2USART'
i test my program without the u2putrs file and the hyper terminal filling with different symbols (hp.jpg)
does any one know why .
Thanks.
i modified a serial program that i found so it can work for my pic18f97j60.i 'm using usart2.
although the program is build successfully every time i add the u2putrs .c file i get
C:\MCC18\src\pmc_common\USART\u2putrs.c:14:Error [1109] type mismatch in redeclaration of 'putrs2USART'
Code:
#include<p18f97j60.h>// Include files and definitions for the Processor
#include <delays.h>
#include<usart.h>// Include function definitions for the USART library
#pragma config XINST=OFF
#pragma config FOSC=HS
void Senddata(void);// Define function for sending data
void chk_isr(void);// ISR handler
void hi_prioriint(void)// Hi priority interrupt vector handler
{
_asm
GOTO chk_isr
_endasm
}
#pragma interrupt chk_isr
void chk_isr(void)
{
unsigned char startcode;
if(PIR3bits.RC2IF==1)
{
unsigned char startcode='S';
unsigned char startread;
if(PIR3bits.RC2IF==1)// If any thing received go ahead.
{
startread=Read2USART();//Read the character recieved and save in startread
if(startcode==startread)// If "S" received then send data, otherwise not
{
Senddata();
}
}
}
}
void main(void)
{
//OSCCON=0b01100000; //Internal 4MHZ Oscillator
ADCON1=0x7F;//Make all ports Digital
Open2USART(USART_TX_INT_OFF &// Initialize USART, Transmit interrupt off
USART_RX_INT_ON &// Receive interrupt ON
USART_ASYNCH_MODE & // Use USART in asynchronous mode
USART_EIGHT_BIT &// Eight bit data
USART_CONT_RX &// Enable continous receiving
USART_BRGH_LOW,// Do not use baud rate multiplication
80);// For a baud rate of 9600 value of SPBRGH:SPBRG register pair
//*****gia to diko moy prepei na einai 39//
INTCONbits.PEIE=1;// Enable peripheral interrupts
INTCONbits.GIEH=1;// Enable all interrupts
putrs2USART ("\nPlease type a S to Start");
while(1);// Stay here(wait for interrupts to occur)
Close2USART();// Disable USART Module.
}
void Senddata(void)// To send data
{
putrs2USART("\nHello World!\n");// Send Hello world to the serial port.
}
i test my program without the u2putrs file and the hyper terminal filling with different symbols (hp.jpg)
does any one know why .
Thanks.