How to read txt file and send it by USART (PIC18)

Status
Not open for further replies.

cascomio

Newbie level 3
Joined
Jan 15, 2013
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,299
Hi guys,

I am new with the PICs and compilers and I have to use it in a part of a project.:| I am using the PIC184520 and the MPLAB 8.86 C compiler. Im trying to read txt file and send it by USART

My code:

Code:
/* Serial Communication Transmit Example */
/* Using Port C as a USART Port */

#pragma config OSC = HS     /*set osc mode to HS */
#pragma config WDT = OFF    /* set watchdog timer off */
#pragma config LVP = OFF    /* Low Voltage Programming Off */
#pragma config DEBUG = OFF  /* Compile without extra Debug compile Code */
#include <p18f4520.h>
#include <delays.h>

#include <usart.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


void main ()

{

	char ch;
	FILE *fp;

	/* Make Port C O/P */
     TRISC = 0x00;

	/* Set USART Parameters Baud rate 19.200 */
   
     OpenUSART(USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_LOW, 15);
		
	fp = fopen("test.txt","r");// read mode

	while( ( ch = fgetc(fp) ) != EOF )
		putrsUSART("%c",ch);

	fclose(fp);

}

I obtained this errors in the compiler:

Code:
31:Warning [2058] call of function without prototype
31:Error [1131] type mismatch in assignment
33:Warning [2058] call of function without prototype
34:Warning [2066] type qualifier mismatch in assignment
34:Error [1204] too many arguments in function call
36:Warning [2058] call of function without prototype

There is something wrong with fopen and putrsUSART.

Thank you for your help and time!!
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…