Shop OBEX P1 Docs P2 Docs Learn Events
Slave Master SXB question — Parallax Forums

Slave Master SXB question

T&E EngineerT&E Engineer Posts: 1,396
edited 2008-12-22 16:26 in General Discussion
I have a program that has a master SX48 (also works on SX28) that uses a 4x4 keypad and serial LCD to enter and display data. It then allows the user to select which 1 of 8 SX28 slaves they want to send that data too. Each slave has a set of 4 (7 segment displays - like on the professional development board) and an EEPROM. The 4 digit data (or numbers entered) from the master is sent to the appropriate slave and displayed on the quad 7 segment display. However, here is my problem:

Sometimes when entering in a number on the master, the·number gets sent to the correct slave display but also gets copied over to another slave display. It's almost a random occurance as sometimes its fine and other times not. I don't have any pullup or pulldown resistors between the master and slaves but thinking this might be the issue. Does this sound right? In other examples, I don't think I have seen the need for resistors.

Let me know what you think.

Post Edited (T&E Engineer) : 12/22/2008 4:30:11 PM GMT

Comments

  • BeanBean Posts: 8,129
    edited 2008-12-19 15:33
    In both of your program, the SERIN and SEROUT timing will get corrupted by the interrupts.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    "The welfare of the people in particular has always been the alibi of tyrants." ~ Camus
    www.iElectronicDesigns.com

    ·
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-12-19 15:50
    Bean,

    Thanks for the quick analysis! I supose then there is not much we can do about that. I like the idea of being able to press the C or D buttons on the keypad at anytime to get either an all slave reset or a master reset. Ok,·I may have to eliminate that option. Does this sound right?

    Thanks.
  • JonnyMacJonnyMac Posts: 9,214
    edited 2008-12-19 17:47
    Have a look at the listing that's attached -- it will show you how to receive a serial byte and multiplex (using your 2ms digit timing) a 7-segment display using an interrupt (the ISR will not affect I2C). These are tested modules that I've used in personal projects and products I've designed for EFX-TEK. You might start with this as a base and then [noparse][[/noparse]carefully] migrate your operational code into it.

    Post Edited (JonnyMac) : 12/19/2008 8:37:23 PM GMT
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-12-19 18:34
    I very much appreciate the code JonnyMac! I will take a look at this over the weekend and see if this can be incorporated into the next version of the software. Can you explain how this is used? (e.g. what it expects to see as RX and what it displays?). Any hardware schematics to exemplify?

    From what I would guess is that it·RX any digit from 0-9,A-F and displays it on a quad 7 segment display. How is the EEPROM used as I don't see it in your interrupt and there is no MAIN: program?

    Thanks.


    Post Edited (T&E Engineer) : 12/19/2008 6:44:51 PM GMT
  • JonnyMacJonnyMac Posts: 9,214
    edited 2008-12-19 18:48
    When you download it you'll see that I "wired" it to your code so it should be easy to follow.

    There's no need to explain it -- I've just replaced SERIN with ISR code and used assembly for the display multiplexing to keep the ISR cleaner; in the end it's doing what you want but you don't have an ISR/SERIN conflict any more. The nice thing about using ISR serial is that you can check the rxReady flag in the foreground and only call RX_BYTE when you have something waiting, otherwise RX_BYTE waits on something to show up (just like SERIN).
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-12-19 19:03
    OK - I will try it out this weekend.
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-12-22 16:26
    I was able to rewrite some of my original code and get all of it to work flawlessly even with the interrupts. No more corruption. Hmm. When I send data from the master to the slaves, I send data only to the slave device currently needing the data. Before I sent it out to all of the slaves and let the slaves decide whether to use the data or not. Thanks for the help.
Sign In or Register to comment.