How to make your own PIC network


Closed Thread
Results 1 to 20 of 20
  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default How to make your own PIC network

    Hi everybody,

    Since a few time, i see some request or project that involve some kind of PIC network.

    It seems to be still obscure for some. So i decide to give a hand on that.

    The package include code and schematic for MASTER and SLAVE. I choose the PIC16F628. To do the serial communication, i choose to use SEROUT and SERIN2.

    WHY? The reason is simple. Many question on those statement are still asked AND some user will use some PIC without any internal USART. Like the Ralph's favourite PIC16F84. Sorry Ralph

    Yep, it's only a really simple example but, i think, i hope, it will be handy for somebody on this earth.

    Have fun!
    Attached Files Attached Files
    Steve

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

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default

    Just the sample I was looking for.

    Merci!

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default

    Is there a maximum to how many slaves we can address?

    I've been reading so much in the last few days, I know I read it somewhere but I can't remember which forum, thread, tutorial or document...

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

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


    Did you find this post helpful? Yes | No

    Default

    If you remove the dipswitch stuff and you're using a WORD sized variable instead, it "should" work... so a max of 65536 Slaves wich is not so bad.

    In this case you'll have to send this variable in two bytes

    MASTER:
    ----------
    SlaveSelect var word

    serout serialoutput, t2400, ["SLAVE",SlaveSelect.lowbyte,SlaveSelect.highbyte,D ATATOSEND]

    SLAVES:
    ----------
    SlaveSelect var WORD

    serin2 serialinput,t2400,[WAIT ("SLAVE",slaveselect.lowbyte,slaveselect.highbyte) ,datatodisplay]



    --------------
    Should work

    BtW Everything is in the header... IMO there's no limit...
    Last edited by mister_e; - 5th February 2005 at 02:52.
    Steve

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

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default

    Get to work you bum! You're late!

    Thanks Mr. E, excellent news on the lack of slave limit.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  6. #6
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Hi Steve,

    great initiative!

    I think this is something worth to be discussed.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  7. #7
    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

  8. #8
    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

  9. #9
    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...

  10. #10
    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

  11. #11
    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.

  12. #12
    Join Date
    Oct 2006
    Posts
    11


    Did you find this post helpful? Yes | No

    Default Til81

    hi all

    i need a help. i m using til81(phototransistor) in the receiver side,and an led r IRled or LED55 n the transmitter side.if the light intensity frm the transmitter s varied the output of the til81 should vary.but for me,i m using ordinary led,but the output s not varying if i provide any obstacle.plz any one help me to get the datasheet for til81plz help me

    Sakthi

  13. #13
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sakthi View Post
    hi all

    i need a help. i m using til81(phototransistor) in the receiver side,and an led r IRled or LED55 n the transmitter side.if the light intensity frm the transmitter s varied the output of the til81 should vary.but for me,i m using ordinary led,but the output s not varying if i provide any obstacle.plz any one help me to get the datasheet for til81plz help me

    Sakthi
    And you want to program it in C right?

  14. #14
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    And you want to program it in C right?
    Not sure why but I have stange feeling of Deja Vu
    Keith

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

  15. #15
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by keithdoxey View Post
    Not sure why but I have stange feeling of Deja Vu
    In these cases, I get 'Vu Ja De'... (Voo Zya Day, not Day Zya Voo)
    ya know, that feeling that you've never been there in a situation nothing like that before

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


    Did you find this post helpful? Yes | No

    Default

    Not sure of this 'Vu Ja De' expression... more than likely it's 'Déja Vue'. It's a french expression wich mean 'Already seen' not much.
    Last edited by mister_e; - 10th January 2007 at 17:18.
    Steve

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

  17. #17
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Not sure of this 'Vu Ja De' expression... more than likely it's 'Déja Vue'. It's a french expression wich mean 'Already seen' not much.
    In PBP...

    Vu Ja De = ~ ( Deja Vue )

  18. #18
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sakthi View Post
    hi all

    the datasheet for til81plz help me

    Sakthi
    here : http://www.datasheetarchive.com/data...rticle=3723931

    Alain

    PS ... think to remove dust from that chip, I've some here dating from the 70's.
    May be your range problems come from that ???
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  19. #19
    Join Date
    Feb 2007
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Dmx adress

    dear mister_e;

    i see that you dont use "rx" or "tx" pin for receive?

    how can i make your master for dmx 512 decode and your slave to receive for 512adress i know i have tome add 9 dipsw on it and i will use it only for 3 leds no more 3 chanel is ok for me can you help?

    slave for 512dmx adres receive and 3 output in 250000baudrate ?
    Last edited by programmer07; - 27th February 2007 at 20:08.

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


    Did you find this post helpful? Yes | No

    Default

    What you need to do is not as this simple for a first school project.

    DO you at least readed some info about DMX and their timing charts?
    anyway, 512 channel will need 9 dip switch indeed. so at least one 8bit pot + another elsewhere.

    DMX VAR WORD

    DMX.LowByte=PORTB
    DMX.8=PORTA.0

    The above give you the switch setting, now you just need to be in synch with the DMX break... then count untill you reach the right channel. How to? I know how AND i know my name will NEVER appear on your school report... so try few things, understand how serial communication works at least... then once you have understand it and read ALL links i already sent on various post... we can talk about a little bit more help.

    Google have tons of DMX example... even using the most stupid controller in whole world.. 16F84. Ok it was good 10 years ago....

    http://www.dmx512-online.com
    http://www.erwinrol.com/index.php?stagecraft/dmx.php
    Last edited by mister_e; - 27th February 2007 at 22:56.
    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, 09:54
  2. Serial VB 2005 pic 16f877a problems
    By Snap in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 8th July 2013, 00:52
  3. PIC network over AC 220V
    By boban in forum Schematics
    Replies: 9
    Last Post: - 6th June 2007, 10:31
  4. Pic driven digital audio delay
    By skimask in forum Off Topic
    Replies: 12
    Last Post: - 19th April 2007, 20:42
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23: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