Shop OBEX P1 Docs P2 Docs Learn Events
Using SHIFTIN with external clock — Parallax Forums

Using SHIFTIN with external clock

aekloaeklo Posts: 20
edited 2005-06-29 19:09 in BASIC Stamp
I want to read a datastream from an synchrounous external device, but from the BS2 documentation I can see that the SHIFTIN-command reads bits and outputs clock pulses...
As far as I have understood the device I want to "decode" (a LCD character generator ment for a LCD driver), the device sends out a clock pulse which the recieving part needs to sync to.
This is opposite of what I understand the SHIFTIN does.

Does anyone have some tips on this? Thanks! smile.gif

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-06-29 01:50
    Hello,

    ·· It might help to provide a link to the device datasheet, or at least a part number for the device in question.· Please post more information on this part for us to help you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • aekloaeklo Posts: 20
    edited 2005-06-29 03:07
    Certainly!
    The data "sender" is a Robertson AP1000 Autopilot for boats, and I have very few details on this except that it uses a National Semiconductor MM5452 LCD driver to display its course (which is what I need to extract).

    Since I could get a hold of the MM5452's datasheet, I figured I have to emulate the drivers functions in order to get a hold of the data.
    The driver receives a clock signal and a serial data signal.

    MM5452 Datasheet: www.national.com/ds.cgi/MM/MM5452.pdf
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-06-29 04:09
    Hello,

    ·· I haven't studied the datasheet in detail, but the clock line is shown as an input, not an output.· It appears you should be able to use the SHIFTOUT command, as it appears the device is an output device only.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • aekloaeklo Posts: 20
    edited 2005-06-29 04:33
    The datasheet shows the LCD driver, which is not what I want to control.
    I want to grab the data being sent to the LCD controller, and as you mention, the LCD controller has a clock input.
    Therefore I would need to sync to that same clock signal when trying to input the data in the BS2.

    That is where I'm kind of stuck. As far as I can see, the BS2 only sends clock signals and cannot receive.
    Or could this it be "tricked" into using this external clock by inputing on another pin?

    /Anders
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-06-29 04:42
    No, the instruction cycle is just not fast enough to make the BS2 a synchronous slave. If you really need to do that, you might consider the SX and SX/B.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • aekloaeklo Posts: 20
    edited 2005-06-29 13:44
    I am using the BS2p, isn't that one faster than the SX?

    If not, is there any ICs perhaps that would do the job of syncing the data into an asynchronous flow, thus making it accessible for the BS?
    I don't know what to search for on this, so any tips would be appreciated smile.gif
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-06-29 13:51
    I was referring to the core SX micro, not the BS2sx. The trouble you have with an BASIC Stamp in this application is the instruction load/decode cycle -- it's probably longer than the timing between clock pulses from your other device. Again, using a straight SX micro, you could use SX/B (very PBASIC-like) to do this as you have the full speed of assembly langauge (after SX/B is compiled).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • aekloaeklo Posts: 20
    edited 2005-06-29 13:53
    OK, thanks for putting me on the right track. I'll be looking into the SX micro to solve this smile.gif
  • DonDon Posts: 34
    edited 2005-06-29 19:09
    You could also use an external shift register like the 74HC164 to capture the data and then load it into the Stamp.· The '164 presents its data in parallel which you could read directly or add another shift register (e.g. 74HC165 or '166) to read the data in serially.· You'd have to devise a strategy to synchronize whole words being captured but that shouldn't be too difficult.

    Don


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don Kinzer

    ·
Sign In or Register to comment.