How to make your own PIC network


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Oct 2006
    Posts
    11


    Did you find this post helpful? Yes | No

    Default PIC to PIC via spi

    hi all

    i m also doing the same pic to pic comm via spi.i m using 16f877a.
    i have written the code in C.soma junk value is displayed n the receiver side lcd.but my opinion is there s no communication between two pic,if i switch off the transmitter pic then also the lcd s displaying the same junk value.

    void transmit(char *str)
    {
    int i;
    char dum;
    SSPBUF=0;
    for(i=0;i<6;i++)
    {
    SSPBUF=str[i];
    //delay();
    dum=SSPBUF;
    delay();
    }
    }
    void init_spi()
    {
    STATUS.f6=0;
    STATUS.f5=1;
    TRISC=0;
    TRISB.f1=0;
    TRISE.f2=0;
    STATUS.f5=0;
    PORTC=0;
    TRISC.f5=0;
    TRISC.f3=0;
    TRISC.f4=1;
    STATUS.f5=1;
    SSPSTAT.f7=0;
    SSPSTAT.f6=0;
    STATUS.f5=0;
    //SSPCON&=0xf0;
    SSPCON.f5=1;
    SSPCON.f4=0 ;
    SSPCON.f0=0 ;
    SSPCON.f1=0 ;
    SSPCON.f2=0 ;
    SSPCON.f3=0 ;
    }
    void main()
    {
    init_spi();
    transmit("sakthi");
    }

    the above code s for transmitting side.i have used two seperate pic board.



    void receive()
    {
    int i;
    char rx[10];
    STATUS.f5=0;
    STATUS.f6=0;
    PIR1.f3=0;
    SSPBUF=0;
    for(i=0;i<6;i++)
    {
    while(SSPSTAT.f0==0)
    {}
    while(PIR1.f3==0)
    {}
    rx[i]=SSPBUF;
    //delay();
    toggle();
    SSPBUF=0;
    SSPSTAT.f0=0;
    PIR1.f3=0;

    }
    }
    void init_spi()
    {
    STATUS.f6=0;
    STATUS.f5=1;
    TRISC.f4=1;
    TRISC.f5=0;
    TRISC.f3=1;
    STATUS.f5=1;
    TRISA.f5=0;
    SSPSTAT.f7=0;
    SSPSTAT.f6=1;
    STATUS.f5=0;
    SSPCON.f5=1;
    SSPCON.f4=1 ;
    SSPCON.f0=0 ;
    SSPCON.f1=1 ;
    SSPCON.f2=0 ;
    SSPCON.f3=0 ;
    }
    void main()
    {
    STATUS.f5=1;
    STATUs.f6=0;
    SSPCON.f5=0;
    init_spi();
    receive();
    init_lcd();
    display(rx);
    }


    the above code s for reception .plz any one help me to solve the problem.i have the doubt in the register enabling.plzzzzzzzzzzzzz help me

  2. #2
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default Is it me ????

    Quote Originally Posted by sakthi View Post
    i have written the code in C.
    plz any one help me to solve the problem.
    plzzzzzzzzzzzzz help me
    .... I just dont get it. Maybe its my crappy eyesight but I see the name of this forum as

    MELabs PICBASIC Forum

    I am obviously overdue for a sight test as others see it as

    MELabs PICBASIC Forum
    Keith

    www.diyha.co.uk
    www.kat5.tv

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by keithdoxey View Post
    .... I just dont get it. Maybe its my crappy eyesight but I see the name of this forum as

    MELabs PICBASIC Forum

    I am obviously overdue for a sight test as others see it as

    MELabs PICBASIC Forum


    Ya, no kidding. Have you seen this guy's other posts around here?

    Refer to Post #6 in http://www.picbasic.co.uk/forum/showthread.php?t=2570

    It's always the same thing, they always end with... CANYOU HELP ME PLZZZZZZZZZZZZZZZZZZZZZZZ... or maybe PLZ...whatever...

  4. #4
    cosmomen's Avatar
    cosmomen Guest


    Did you find this post helpful? Yes | No

    Default

    Hi there!

    I'm working on a project where I need to interconnect a few PIC's
    I need bi-directional communication with a master PIC. the best solution would be the onewire but i vould accept i2C or any other good idea. Could please somebudy help me with a short example? I have no problems to communicate with I2C or OW devices but I don't know how to create a slave unit.

    Many thanks in advance

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    You could still use some PIC with the MSSP mosule built in and work around this... it's not going to be really easy but doable.

    Simple RS232 comm with a busy line is still the easiest way.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Presetting Configuration Fuses (PIC Defines) into your Program
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 82
    Last Post: - 15th December 2013, 10:54
  2. Serial VB 2005 pic 16f877a problems
    By Snap in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 8th July 2013, 01:52
  3. PIC network over AC 220V
    By boban in forum Schematics
    Replies: 9
    Last Post: - 6th June 2007, 11:31
  4. Pic driven digital audio delay
    By skimask in forum Off Topic
    Replies: 12
    Last Post: - 19th April 2007, 21:42
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th March 2005, 00:14

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts