Shop OBEX P1 Docs P2 Docs Learn Events
Bus? — Parallax Forums

Bus?

jmspaggijmspaggi Posts: 629
edited 2008-08-20 14:13 in General Discussion
Hi,

In D1302 javadoc, there is this comment:

" * The clock routines whenever called check the timer t1. If t1 has elapsed, a
* time request to the DS1302 chip is made otherwise the time values from hour,
* minute, second... are used. This makes processing faster and keeps the clock
* and data lines free for any other chips on the "bus". The timer is adjusted
* via: <code>UPDATE_PERIOD</code>.
"

What "bus" mean? Does it mean there is a way to put the DS1302 with other C.I. like DS1620 or SHT11? How can we do that?

Can I connect all the Vcc pins to some DC-16 output, then select the C.I. I want to activate by selecting it from the DC-16?

Because I would like to connect 8 DS1620, 3 SHT11, 1 DS1302 and 4 DC-16 to my Javelin...

Thanks for your help,

JM

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-08-20 07:34
    The DS1302 has three pins: data, clock and enable. The data and clock can be shared
    with other devices. Each device must have its own enable pin (either selected directly
    with an I/O pin or via some output latch like a shiftregister).
    The comment about leaving data and clock lines free is not really relevant because
    the code to access the ds1302 is all foreground code and each subroutine that
    accesses the ds1302 starts by asserting the enable line and exits with the
    enable line disasserted. So when such a routine exits the data and clock lines
    are free.

    regards peter
  • jmspaggijmspaggi Posts: 629
    edited 2008-08-20 13:22
    Hi Peter,

    Thanks for your reply.

    So I will put all the data pins together, and all the clock pins together, but I still have some questions regarding the enable pin.

    I just reed from google what a (expletive)Register is ( http://www.eelab.usyd.edu.au/digital_tutorial/part2/register01.html ) and I think I understand how to use is.

    My concern is, since I already have 4 DC-16 (64 outputs), do you think I can command the enable pin using a DC-16 output? DC-16 usually put low the output when you activate it, so is there a simple way to put it high when it's not activated? So I might be able to reuse them?

    Thanks for your help,

    Jean-Marc
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-08-20 13:33
    You can use the DC-16 outputs by adding a pullup resistor to each
    DC-16 output that you want to use as enable line. Most SPI devices have
    an active low enable (sometimes called CS = chipselect). Those that have
    an active high enable (like the Parallax Datalogger module)·are better
    controlled via an I/O pin or shiftregister, or add an inverter (=transistor) to the DC-16 output.
    Note that you must adapt the DS1302 class to support the enable line
    via the DC-16. Best to copy that class and rename it DS1302_DC16
    and adjust the code that controls the enable line.

    regards peter
  • jmspaggijmspaggi Posts: 629
    edited 2008-08-20 13:53
    Hi Peter,

    Thanks again. I think I will go this way. Even if I really would like to "play" with the ShiftRegister. Google was again able to explain me how to us a "Pull-Up resistor" ( http://www.seattlerobotics.org/encoder/mar97/basics.html ). So I think this might work.

    I will provide the DS1302_DC16 and the DS1620_DC16 to the forum if I'm able to make it clean.

    Regards,

    JM
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-08-20 14:01
    Please post any class, even if they are not working. Gives us the chance
    to look into them and provide assistance if you need it.
    Here is a tip:
    create a seperate DC16 class, if you do not have one already, with
    simple functions to turn a DC16 output on or off. Import the DC16 class
    into your DS1302_DC16 class and you will only need to change a line like
    CPU.writePin(EnablePin,false) into myDC16.setOutput(pin,false).

    regards peter
  • jmspaggijmspaggi Posts: 629
    edited 2008-08-20 14:13
    Thanks for the hints. So I will post my results here.

    Jean-Marc
Sign In or Register to comment.