View previous topic :: View next topic |
Author |
Message |
arrow
Joined: 17 May 2005 Posts: 213
|
2 (or 3) PICs communicating? |
Posted: Fri Sep 08, 2006 8:45 am |
|
|
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
|
|
Posted: Fri Sep 08, 2006 9:11 am |
|
|
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
|
|
Posted: Fri Sep 08, 2006 9:25 am |
|
|
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
|
|
Posted: Fri Sep 08, 2006 9:50 am |
|
|
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
|
|
Posted: Fri Sep 08, 2006 9:57 am |
|
|
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
|
|
Posted: Mon Mar 19, 2007 12:44 am |
|
|
How you get it works? Any modification you have done in your code? |
|
|
|