Shop OBEX P1 Docs P2 Docs Learn Events
Getting 2 or more SX28 chips to talk to each other. Is this possible? — Parallax Forums

Getting 2 or more SX28 chips to talk to each other. Is this possible?

eagletalontimeagletalontim Posts: 1,399
edited 2009-01-11 02:42 in General Discussion
Basically what the title says. I am wanting to get 2 or more chips to send variables back an forth so they can process them according to how the code is written per chip. One of the biggest things I am wondering is can this be done without disrupting the program and causing a noticeable delay...maybe with using an Interrupt. If using an interrupt, can I run all the chips off the same frequency chip? My local radio shack has lots of frequency chips that I can choose from, but I have no idea which one to use. I have seen some that have 75.*** Mhz on them, can these be used?

I am still kind of new to this and have many more questions, but I want to try and learn as much as I can before I fry a bunch of chips or waste alot of money tinkering with them.

Comments

  • pjvpjv Posts: 1,903
    edited 2008-09-26 03:27
    Hi Tim;

    The answer to your question is an emphatic yes, but depending on what you need to do, it might be fairly easy or very difficult.

    In one project I have a few hundred talking to each other in short bursts at 10 MegaBits per second. In the end, there were a number of constraints, but a rather elegant and simple structure, yet difficult to comprehend. So my implementation is not for beginners, yet I started just like you, having a need and the desire to bash at it until I found a satisfactory answer. Took almost two years to learn enough to make it happen.

    I sell this product commercially, so unfortunately I can't go into too much detail..... but yes, it CAN be done. And as is so often the case, once you have figured it out, it's relatively easy. I just becomes a standard building block.

    Cheers,

    Peter (pjv)
  • RS_JimRS_Jim Posts: 1,773
    edited 2008-09-26 05:13
    Hi Tim,

    You might start by·reading NV 147 (Nuts and Volts column) listed in the above best of threads.· Jonny Mac describes how he networks many computers together using RS-485.· There are a number of threads with interupt driven VP's (Virtual Periferals) ·for serial data transmission. I have used one of them very successfully.

    RS_Jim
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2008-09-26 05:47
    From the Best Threads and code examples there are these links:
    SPI Slave code in SX/B ·Code from Bean for a BS2 to SX
    Parrallel Comm··Parallel Sx to Sx coms with a Serial controler code from Jon Williams
    commutation between 2 sx chips··ISR Serial driven code from Jon Williams

    Also the LCD example in the SX/B IDE is an example of BS2 to SX communication, that could be modified for an SX. Best thing about the LCD code, is that it has a wiring diagram too.

    There are more threads on the subject, under SX to SX communication and at sxlist.com·. SX list has a more complete listings of VP PDF's than the Parallax web site.



    Post Edited (Capt. Quirk) : 9/26/2008 10:51:55 PM GMT
  • eagletalontimeagletalontim Posts: 1,399
    edited 2008-09-27 14:26
    I have heard people talking about the 1 wire LCD screens, but have not been able to come across any. Is there a site that i can order small quantities of them from?
  • PJMontyPJMonty Posts: 983
    edited 2008-09-28 18:34
    Eagletalontim,

    You can't find any serial LCDs? Can you tell me what kind of searching you did?

    www.parallax.com/Store/Accessories/Displays/tabid/159/CategoryID/34/List/0/Level/a/ProductID/52/Default.aspx?SortField=ProductName%2cProductName

    Your homework assignment is to explore Google.

    Thanks,
    PeterM
  • eagletalontimeagletalontim Posts: 1,399
    edited 2008-09-28 18:36
    I thought those were 15 wire LCD's. Thanks for the link [noparse]:)[/noparse]
  • DosManDanDosManDan Posts: 179
    edited 2008-09-29 20:50
    Yes, it can be done, but you might want to read a thread I posted on this a while back. If you are using two resonators...it might cause you problems.

    http://forums.parallax.com/showthread.php?p=744915

    You can find a picture of the board here:

    http://forums.parallax.com/showthread.php?p=746315

    Dan
  • eagletalontimeagletalontim Posts: 1,399
    edited 2009-01-10 23:46
    I know this is an old thread, but I am back at it again and I have a few questions. Most of my research on communicating between 2 SX28's has referred to using interrupts. I really hate using interrupts so I am going to try and do it the old fashion way with SERIN and SEROUT. Right now, I have one chip set up to receive the information and display it on an LCD. The other chip has a loop that sends data every 500ms and one of the variables is random. When I power up both chips, the output on the LCD does not match what the other chip is sending but the variables are staying the same so something has to be working. If I only power up the display SX, it shows the pre-defined words and nothing else just like it should.

    Variables that are the same on both chips :
    Baud CON "N9600"
    SYNC CON $80

    Code on Chip 1 (Display SX)
    Main:
        FOR idx = 0 TO 2
        cmd = RX_BYTE
        IF cmd = SYNC THEN Main        ' SYNC CON $80
        in(idx) = cmd
      NEXT
      store in(0), 4, 2        ' custom sub that splits down each character to be able to display on LCD.  This works :)
      store in(1), 8, 2
      store in(2), 12, 2
      UPDATE_L2
      GOTO Main
    
    '.........
    
    FUNC RX_BYTE
      SERIN RX, Baud, __PARAM1
      ENDFUNC
    




    On chip 2 (Data SX)
    Main:
      RANDOM temp1
      SEND_BYTE "1", "2", temp1
      wait 2000
      GOTO Main
    
    '........
    
    SEND_BYTE:
      SEROUT RX, Baud, SYNC
      SEROUT RX, Baud, __PARAM1
      SEROUT RX, Baud, __PARAM2
      SEROUT RX, Baud, __PARAM3
      RETURN
    



    Both chips are running at the same frequency but are using 2 different crystals. One of the chips is on a radioshack project board and the other is on the SX-Tech board. There is a common ground between boards. I am using a 100ohm resistor to ground on the data out pin on SX # 2 (Data SX) and there is a 1K resistor between the RX pins on the SX's. The code I am using is from an old project I did awhile back for communicating from PC to SX. The project worked 100% [noparse]:)[/noparse] Hopefully I can catch on quick this time [noparse]:)[/noparse]
  • BeanBean Posts: 8,129
    edited 2009-01-11 02:03
    A protocol I like, but is not seen often is DBUS (TI-Link).
    It does not have a predefined rate, the faster the sender and receiver the faster the communication. It doesn't need precise timing either, so the SX internal oscillator works fine.

    It also doesn't matter if the communication is interrupted (with an interrupt) on either the sender or receiver.

    It is basically two wires that are pulled-up with resistors (much like I2c). I call the wires "ONE" and "ZERO".

    When one device wants to send data, it pulls one of the wires low depending on if it wants to send a 1 or a 0.

    The receiver upon noticing that one of the wires is low, stores the bit, then lowers the other wire.

    The sender upon seeing that the other wire has been pulled low, knows that the receiver got the bit, so it releases the wire that it pulled low initially.

    The receiver upon seeing that the wire that was initially pulled low, is now high, it releases the wire that it pull low.

    Now both wires are high again and the process is repeated.

    It sounds complicated, but it's not as bad as it sounds.


    Here is the original thead with the SX/B code http://forums.parallax.com/showthread.php?p=716658

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ·The next time you need a hero don't look up in the sky...Look in the mirror.




    Post Edited (Bean (Hitt Consulting)) : 1/11/2009 2:10:27 AM GMT
  • eagletalontimeagletalontim Posts: 1,399
    edited 2009-01-11 02:09
    well, after messing with it for a bit, I found that if I send the variables directly from the SEROUT command like SEROUT RX, Baud, 123 it will send the data correctly and display it correctly on the LCD.

    For some reason, I cannot get a byte variable to send though [noparse]:([/noparse]
    Example :

    temp1 VAR Byte
    ....
    RANDOM temp1
    SEROUT RX, Baud, temp1

    When it is send to the display chip, it comes out as 63 all the time. Any ideas on this?
  • VelocitVelocit Posts: 119
    edited 2009-01-11 02:29
    Numeric variables are stored in the SX and sent as binary numbers. They need to be converted to ASCII characters before the display will display them. To convert a single digit to ASCII, just do this:
    tmpB1 + "0"
    


    For numbers greater than nine, you will need to convert them to binary-coded decimals and send each digit one at a time. You can also just send the numeric value that corresponds to an ASCII character:

    en.wikipedia.org/wiki/ASCII#ASCII_printable_characters

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Paul
  • eagletalontimeagletalontim Posts: 1,399
    edited 2009-01-11 02:42
    i found my error tongue.gif I had temp1 as the variable being sent, but the variable being set was temp3. Been a long day!
Sign In or Register to comment.