CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Uart stream - solved

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jaime



Joined: 25 Nov 2005
Posts: 56
Location: Porto - Portugal

View user's profile Send private message Visit poster's website

Uart stream - solved
PostPosted: Mon May 25, 2009 3:13 pm     Reply with quote

Hello
I'm testing the fat driver from ccs with 4.072 compiler. Everything works with one uart, but when I change my code for two uarts and add a stream for each one I have some compiler error.

undefined identifier pc

Can anyone explain this?

Code:

#include <18F2525.h>
#device PASS_STRINGS = IN_RAM
#fuses NOWDT,HS, NOPROTECT
#use delay(clock=16M)

#use rs232(baud=57600, xmit=pin_b6, rcv=pin_b7, errors, stream=pc)
#use rs232(baud=4800, xmit=pin_c6, rcv=pin_c7, errors, stream=gps)

#define MMCSD_PIN_SCL     PIN_A1 //o
#define MMCSD_PIN_SDI     PIN_A3 //i
#define MMCSD_PIN_SDO     PIN_A2 //o
#define MMCSD_PIN_SELECT  PIN_A0 //o

#include <mmcsd.c>
#include <fat.c>

void main()
{
int i;
char file_name[20];
char buffer[255];
FILE stream_file;
   
strcpy(file_name,"/log.txt");

delay_ms(3000);

fprintf(pc,"\r\nINIT: ");
i = fat_init();
if (i)
   fprintf(pc,"ERROR INITIALIZING FAT");
else
   fprintf(pc,"INIT OK");
   
delay_ms(1000);

fprintf(pc,"\r\nMAKING FILE '%s': ", file_name);
if(mk_file(file_name) != GOODEC)   //??????????????
   fprintf(pc,"ERROR CREATING FILE");
else
   fprintf(pc,"FILE CREATED");

delay_ms(1000);

fprintf(pc,"\r\nWRITE SOMETHING : ");
while(1)
   {
   do{
      buffer[i] = getch();
         
      // check for a backspace
      if(buffer[i] != 8)
         {
         fprintf(pc,"%c", buffer[i]);
         i++;
         }
      else if(i > 0)
         {
         // delete the last character
         i--;
         putc(8);
         putc(' ');
         putc(8);
         }
      }while(buffer[i - 1] != '\r');
   buffer[i-1] = '\0';
   
   fprintf(pc,"\r\nAPPENDING '%s' TO '%s':", buffer, file_name);
   
   if(fatopen(file_name, "a", &stream_file) != GOODEC)
      fprintf(pc,"\n\rERROR OPENING FILE");
   else
      fprintf(pc,"\n\rOPEN OK");
     
   fatputs(buffer, &stream_file);
   fatputs("\r\n", &stream_file);

   if(fatclose(&stream_file) != GOODEC)
      fprintf(pc,"\n\rERROR CLOSING FILE");
   else
      fprintf(pc,"\n\rCLOSING OK");

   fprintf(pc,"\r\nWRITE SOMETHING : ");
   
   i=0;
   }
}


Last edited by jaime on Tue May 26, 2009 1:40 am; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 25, 2009 3:36 pm     Reply with quote

It works for me if I change 'pc' to upper case: PC
Do that in the #use statement and in all the functions that call it.
jaime



Joined: 25 Nov 2005
Posts: 56
Location: Porto - Portugal

View user's profile Send private message Visit poster's website

PostPosted: Tue May 26, 2009 1:40 am     Reply with quote

OK. It works
thanks
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group