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

2 (or 3) PICs communicating?

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



Joined: 17 May 2005
Posts: 213

View user's profile Send private message

2 (or 3) PICs communicating?
PostPosted: Fri Sep 08, 2006 8:45 am     Reply with quote

Hi

I have the 16F84A on which I would like to
printf("AAA");

and I would like a 16F873A to pick up this string.

Can someone please tell me how to do this?

(I have tried to connect the specified XMIT pin on the 84A to the specified UART RCV pin on the 873A with no luck).

Thank you
a.
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Sep 08, 2006 9:11 am     Reply with quote

Check you have setup the baud rates correctly. Add the errors statement to the 87x.

Post some code so we don't have to practice black magic.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
arrow



Joined: 17 May 2005
Posts: 213

View user's profile Send private message

PostPosted: Fri Sep 08, 2006 9:25 am     Reply with quote

Hi Asmallri

I have connected PIN A3 on the 84A to PIN C7 on the 863.

The code on the 84A side is:

Code:

#include <16F84A>
#fuses   XT,PROTECT,NOWDT, PUT
//=============================
//***Define Pins
#define START_STOP         PIN_B0

//***Define Debounce time in ms
#define DEBOUNCE_TIME      10
//------------------------------------------------
#use delay(clock=4000000)
#use rs232(baud=19200, xmit=PIN_A3, rcv=PIN_A2, ERRORS)
//=============================
main() {
   int1 start=false;
   int8 time[3];
   int  i=0;
   //---------------------------
   time[0]=1;
   time[1]=2;
   time[2]=9;
   while(true){
      //***Check to see if START_STOP Button hit
      if(input(START_STOP)){
         delay_ms(DEBOUNCE_TIME);           //***Debounce
         if(input(START_STOP)){
            start = !start;
            if(start)
               printf("sssssssssssss");
            else
               printf("ttttttttttttt");
               
            while(input(START_STOP)){
            }
         }
      }
     
   }
}



The code on the 873 side:
Code:

#include <16F873>

#fuses   HS,NOPROTECT,NOWDT, NOLVP, NOBROWNOUT

#use delay(clock=20000000)
#use rs232(baud=19200, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
//=============================
//***RS232 interrupt
#int_rda
void RS232(){
   bbb[counter] = getc();
   //***Check if command character has just been sent
//+++"s" = START TIMER
   if(bbb[counter]==115){
      counter = 0;
      bbb[0] = 115;
   }
//-----------------------
   counter++;

     if(counter>=12)
      counter=0;
   }
}
//==================================================
main(){
...
}


Could you please tell me why the 873 is not receiving?

Thank you
a.
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Sep 08, 2006 9:50 am     Reply with quote

The 84A does not have a UART so the Errors is meaningless for this device.

For the 87x you have showed the ISR code but not how you have enbled receive interrupts.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
arrow



Joined: 17 May 2005
Posts: 213

View user's profile Send private message

PostPosted: Fri Sep 08, 2006 9:57 am     Reply with quote

Hi Asmallri

I have found a work around (I think) which will most probably be simpler than having 2 PICs communicating.

Thank you for your help.
a.
domdom



Joined: 06 Sep 2006
Posts: 29

View user's profile Send private message

PostPosted: Mon Mar 19, 2007 12:44 am     Reply with quote

How you get it works? Any modification you have done in your code?
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