Shop OBEX P1 Docs P2 Docs Learn Events
Serial Clock out — Parallax Forums

Serial Clock out

CruxCrux Posts: 74
edited 2007-02-19 11:41 in BASIC Stamp
Hi guys,
········· Is it possible to output a seria clock from any pins of the BS2?
If it is how would I do that?I am planning to interface it with a 2 Digit
7 Segment driver IC, MAX6979. You could check it out to see the
scenario bec. I am not sure if a serial clock or a seperate oscillator
will the the job.
·

Comments

  • ZootZoot Posts: 2,227
    edited 2007-02-16 03:24
    Yes, you can do this pretty easily. See SHIFTOUT in the Pbasic Stamp manual. SHIFTOUT is perfect for this kind of serial application -- you send your bits one pin, the clock is automatically generated on a clk pin of your choice.

    Depending on the chip you are using, you will use a third pin as either a "latch" or an "enable" line. Some serial chips like a PULSOUT on the latch line to use whatever data you shiftin to the chip, some chips require you to a bring an enable line low or high, THEN shift data to the chip, THEN change the enable line back.

    I checked out the datasheet for the MAX6979 briefly -- it looks like this chip latches, so in pseudo code it would go something like this:


    setup 16 bits of data to shiftout to the LED driver
    SHIFTOUT 16 bits of data on predefined data and clock pins
    PULSOUT a short pulse on the latch pin to the MAX6979 to dump the above data into the actual LED outputs


    Check out this doc: www.parallax.com/dl/docs/prod/appkit/max7298LedDisplayDvr.pdf

    It's a different LED driver (8 digits), but the principles for sending data to the driver registers are the same.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • CruxCrux Posts: 74
    edited 2007-02-16 04:18
    Zoot or anyone:

    I am having difficulty in the SHIFTOUT command. I think it is good that I
    have a code sample and a circuit to analyze how SHIFTOUT works. I was
    hoping that pros like you could help me. I am still a newbie.tnx
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-02-16 06:15
    Cruz-

    You haven't said what kind of problem you're having. What are the symptoms of your problem?

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • ZootZoot Posts: 2,227
    edited 2007-02-16 17:38
    Bruce is right -- have you actually hooked up your LED driver and tried it? I think the AppKit notes in the PDF mentioned above will be a great start -- the two chips are very similar and the PDF above goes over wiring and some code examples that are easily applicable.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • CruxCrux Posts: 74
    edited 2007-02-17 02:37
    Yes I have tried and I guess I have a hard time to deal with SPIs. It is still my first try to this kind of experiments. I really want to learn so please help me. I have attached here some crooked diagrams but I bet you guys can understand this. Hope to hear from you soon.Thanks
    1392 x 1407 - 92K
    1600 x 1200 - 762K
  • ZootZoot Posts: 2,227
    edited 2007-02-17 02:49
    Ahhh.... it's all learning, and once you get it, it will all seem easy.

    - if you can, post the code you are using; sometimes it's hard to know if it's your wiring, or your code (or both!). Your wiring seems OK, by the way. Do you have the DP hard-wired to +5v just to make sure it's working OK?

    - I reread the datasheet, and I think there are two things that *may* be giving you trouble:

    1. the LE pin is for latching data from DIN into the driver itself, but you also need to enable actual output with the \OE pin (tie this to ground if you are not using it actively). The \OE is for switching the whole display on or off regardless of the state of the actual data within the registers.

    2. the driver includes a "safety" fail-safe feature (sorry, I didn't catch this on my first read through of the sheet). If there is no SPI activity for 1 second then the display shuts down. So just make sure that your code is constantly sending data to the driver

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • CruxCrux Posts: 74
    edited 2007-02-18 04:09
    yup. I did to show u dat· my 7 segmen works..I attaced a·short and complete code of my BS2 in the project..Its working..In the datasheet of MAX6979 should we really make a data in and out if one is lacking,will it not work?
    1600 x 1200 - 554K
  • ZootZoot Posts: 2,227
    edited 2007-02-18 14:04
    Not sure I understand your question. The data out pin is for "daisy-chaining" more chips together (the data out of one chip would go to the data in of the next chip). If you do not need this feature, you can leave that pin disconnected. Is this what you mean?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • CruxCrux Posts: 74
    edited 2007-02-19 02:13
    I have attached here a typical application putting together an microcontroller and the MAX6979..You will see in the illustration that theyre like synchronizing datas w/ each other. The Microcontroller sends data and the Max6979 sends back the data to Micro..It was my question before and will like to ask if it should really be done that way?what do you think was the purpose of that?So w/c pins should I be concerned about to make it work.tnx
    813 x 462 - 18K
  • ZootZoot Posts: 2,227
    edited 2007-02-19 05:20
    I don't see why you would need to get the data back into the micro, unless you are concerned about reading the fail-safe register. Generally the DOUT is for feeding into yet another driver:

    micro -> maxdriver -> maxdriver -> maxdriver... etc

    Also, I don't think you can do the above setup on a Stamp anyway -- you'd have to be running a SHIFTIN at the same time you are running SHIFTOUT.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • CruxCrux Posts: 74
    edited 2007-02-19 11:41
    Ah okey..
    tnx I'll get back to u after I test it.
Sign In or Register to comment.