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

Communicate 2 pic via serial port

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



Joined: 30 Jan 2010
Posts: 19

View user's profile Send private message

Communicate 2 pic via serial port
PostPosted: Wed Oct 20, 2010 4:33 am     Reply with quote

Dear All,

I would want to send data to another pic by serial port. My board have several peripheral that listening them. When I want to send data another pic I am able to, however in this case I can not listen to another peripheral.

On the contrary, when I want to use peripheral in this case I can not send data to another pic.

My aim is to listen to peripheral and send and receive data to another pic.

My pic 16f886 and compiler
PCH Compiler Version 4.068

Code:

#include "16f886.h"
#device *=16 ADC=10
#fuses INTRC_IO,NOWDT,NOPROTECT,NOPUT,NOLVP,NOFCMEN,NOMCLR, BROWNOUT // with internal oscillator

#use delay(clock=4000000)
#use rs232(baud=9600,uart1, parity=N, xmit=PIN_C6,rcv=PIN_C7, bits=8, errors, timeout=500, STREAM=ENCODER)

#byte PIE1      = 0x8c
#byte INTCON    = 0x8b

void main()
{
   short bResult;
   
   disable_interrupts(GLOBAL);   
   
   output_a(0b00000000); // motor pinleri A2 ve A3 1 olacak
   output_b(0b00000001); // RB0(CRD_CON), RB4(ortak uç), RB5(switch), RB6(Manuel kilit), RB7(Kapı açık kapalı)
   output_c(0b10011011); // RC7 (RX input), RC6 (TX output), RC3(SCL), RC4(SDA),  RC5(motor pin output ), RC2 Buzzer, RCO ve RC1 saat içininput
   output_e(0x00);
   
   set_tris_a(0b00000000);
   set_tris_b(0b00000001); // RB0(CRD_CON), RB4(ortak uç), RB5(switch), RB6(Manuel kilit), RB7(Kapı açık kapalı), RC2 Buzzer,
   set_tris_c(0b10011011); // RC7 (RX input), RC6 (TX output), RC3(SCL), RC4(SDA),  RC5(motor pin output ), RCO ve RC1 saat içininput
   set_tris_e(0x00);

   
   port_b_pullups(TRUE);

   setup_adc(ADC_CLOCK_INTERNAL);   
   setup_adc_ports( sAN0|VSS_VDD );
   set_adc_channel(1);   
   
   
   setup_spi(FALSE);
   
   setup_timer_1(T1_EXTERNAL|T1_CLK_OUT|T1_DIV_BY_1);   // setup interrupts
   setup_timer_2(T2_DISABLED,0,1);
   
   setup_ccp1(CCP_OFF);
   setup_ccp2(CCP_OFF);
   
   setup_oscillator(osc_4mhz);
      
   last_port_b = input_b();
   bNotSleep = 1;
   
   // Enable interrupts
   enable_interrupts(GLOBAL);
   enable_interrupts(INT_TIMER1);
   enable_interrupts(INT_RB);
   enable_interrupts(INT_RDA);
   enable_interrupts(INT_EXT);
   //enable_interrupts(GLOBAL);
      
   
   SET_TIMER1(0);
   
// My problem is here. When i was doing is enable i can sedn data to another pic
// however when i was enabling it, i can listen my peripheral but can not able to send data to another pic.

   PIE1 = 0x30; // just enable receive and transmit peripheral unit.
        INTCON = 0xC0;



What can be source of problem ?
_________________
I have been developing pic and other microcontroller. I would want to share and get experiment form this site
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