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

comunictino through rs232 and lcd proplem

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



Joined: 05 Jan 2006
Posts: 105

View user's profile Send private message

comunictino through rs232 and lcd proplem
PostPosted: Thu Jan 05, 2006 1:22 pm     Reply with quote

hi all

i try to communication between two pic16f874 through rs-232 , iuse the interrput
(#int_rda)on the second pic,but ihave no good result on lcd which supposed
to print the recieved information from the first pic,its print some time nothig
and other time print some of string character and some times print correctly.

note: i use protuse to make run,the apply hardware ,....ineed to say that
my lcd is working correctly.
here is the code of first pic
Code:

#include <16f874.h>
#include "lcd_kbd1.c"
#include <string.h>
#fuses XT,NOWDT
#use delay(clock=4000000)    //one instruction=1us
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)


void main()

{
    LCD_Init ( );
   LCD_PutCmd ( CLEAR_DISP );
   LCD_SetPosition ( LINE_16_1);
   printf(LCD_PutChar," hello");
   delay_ms(10000);
  printf(" AT");
 
}//main

and here is the code of the second
Code:

#include <16f874.h>
#include "lcd_kbd1.c"
#include <string.h>
#fuses XT,NOWDT
#use delay(clock=4000000)    //one instruction=1us
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

static char RX[30], string1[30], string0[30], ptr ;
static int1 jj;
static int8 i;


#int_rda
void serial_isr()  {
RX[i++]=getch();
strcpy(string1,RX);
jj=1;
}


void main()   {

   enable_interrupts(GLOBAL);
   enable_interrupts(INT_RDA);
   jj=0;
   LCD_Init ( );



   if(jj==1) {

  LCD_PutCmd ( CLEAR_DISP );
   LCD_SetPosition ( LINE_16_1);
   printf(LCD_PutChar,string1);
 
  jj=0;

   }//IF


}//MAIN



thanks alot
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 05, 2006 1:59 pm     Reply with quote

Add ERRORS, NOLVP, and while(1); to your program.
See the sample program in the following thread which shows where
to put them:
http://www.ccsinfo.com/forum/viewtopic.php?t=24719&highlight=errors+nolvp+while
hadeelqasaimeh



Joined: 05 Jan 2006
Posts: 105

View user's profile Send private message

PostPosted: Sat Jan 07, 2006 10:31 am     Reply with quote

thanx alot the proplem is solved. Laughing
hadeelqasaimeh



Joined: 05 Jan 2006
Posts: 105

View user's profile Send private message

strtok
PostPosted: Sat Jan 07, 2006 10:36 am     Reply with quote

i need to print characters limited by two known char in a recieved string.
i use the same code above with some correction.
i tried to use strtok,but how to print on lcd????

please any help
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