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

serial communication continued

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







serial communication continued
PostPosted: Mon Jan 05, 2009 11:49 pm     Reply with quote

Thank you very much for your reply. I think i am confused when i am writing to the forum my code will be like this (coma and comb will reverse)
Code:
Code:

#include "16F877A.H"
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6,rcv=PIN_C7,stream=coma)
#use rs232(baud=9600, xmit=PIN_B2,rcv=PIN_B3,stream=comb)

 void main()
{
char c;
align=0;

while(TRUE){
 
  if(align==0){
     fprintf(comb,"sending search signal");
     putc('~',coma);
     align=0;
  }

  if(kbhit(coma)){
     fprintf(comb,"received something");
     c=getc(coma);
     if(c=='~')
       {
        fprintf(comb,"received search signal");
       }
     else {
        putc(c,comb);
      }
   }
}


I am using isis professional also for this code and for the other code that i wrote before it gives what i want.But in real world i cant make the same thing.i also abandoned writing sending search signal received something and received search signal.I just wrote the following code
Code:

#include "16F877A.H"
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6,rcv=PIN_C7,stream=coma,ERRORS)
#use rs232(baud=9600, xmit=PIN_B2,rcv=PIN_B3,stream=comb)

 void main()
{
char c;
align=0;

while(TRUE){
 
  if(align==0){
     
     putc('a',coma);
     align=0;
  }

  if(kbhit(coma)){
   
     c=getc(coma);
     if(c=='~')
       {
        fprintf(comb,"received search signal");
       }
     else {
        putc(c,comb);
      }
   }
}

What i am trying to do is
I have both tx/rx in two side so nodes will send '~' or 'a' for search signal if a node gets search signal it responds back hey i got something and if he gets '~' he will say i got search signal.
I will try to send just '~' not comments at all but in future that will not help because i have to set some flags and preambles for the protocols. So if pic16f877a have hardware limitations to do this i will use another pic what you prefer me?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jan 06, 2009 1:43 pm     Reply with quote

Please don't start a new thread every day on the same topic. Make a
new post in your existing thread, here:
http://www.ccsinfo.com/forum/viewtopic.php?t=37252

When you do so, the thread will be "bumped" to the top of the list.
Also, forum members that are logged in will see a yellow box to the
side of your thread, indicating a new post. You don't see that as a
guest. We will all see your new post.
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