Shop OBEX P1 Docs P2 Docs Learn Events
Help please - Problem reading Serial pulses with clock pulses — Parallax Forums

Help please - Problem reading Serial pulses with clock pulses

ArchiverArchiver Posts: 46,084
edited 2000-09-18 04:17 in General Discussion
I wonder if anyone could offer any advice with a problem I am having using a
BS2 to read data from a thermometer, please?

The thermometer device measures the temperature every 10 Seconds and outputs
the data as serial data as 13 pulses on two pins as follows:


Thermometer Pin 9 (Data out):
|
16 mSeconds
|
_____________________________________________________
| D01 |D02|D03|D04|D05|D06|D07|D08|D09|D10|D11|D12|D13|
_____|_____|___|___|___|___|___|___|___|___|___|___|___|___|______

Thermometer Pin 10 (Clock Pulses Out):
____ _ _ _ _ _ _ _ _ _ _ _ _
| | | | | | | | | | | | | | | | | | | | | | | | | |
_____| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |________

|1mS |

With the exception of the first clock pulse (which has a duration of 1mSec),
the clock pulses occur 0.125 mSec after the start of the data pulse and last
for 0.125 mSec.

The data bits have the following significance:
D01 - Degrees Celcius Polarity
D02 - 80
D03 - 40
D04 - 20
D05 - 10
D06 - 8
D07 - 4
D08 - 2
D09 - 1
D10 - 0.8
D11 - 0.4
D12 - 0.2
D13 - 0.1

I originally planned to read the data using Shiftin, but I have not been
able to get this to work and I believe the problem is due to the device
generating it's own clock pulses and not accepting clock pulses from the BS2
while the BS2 expects to be generating the clock pulses.

Does anyone have an idea as to how I can use the BS2 to read this data?

A secondary question is whether the BS2 could read the data electrically
inverted (i.e. 0=5V and 1=0V)? I am currently adding inverter circuitry but
would like to eliminate this circuitry if it can be done in software.

I would greatly appreciate any assistance.

Thank you

Regards
Richard Norman

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-09-16 22:07
    Hi Richard,

    The clock for the Stamp's shiftin command must come from the stamp itself,
    not from the external device. The only way to get the stamp to receive this
    data would be by means of a program loop, and the stamp2 is simply too slow
    to react to 125 microsecond clock pulses. It is just on the borderline for
    the data stream as a whole. It looks like each data bit sticks around for
    over 1.2 milliseconds. The Stamp2sx is faster, and could, I think, keep up
    with the data in a program loop. The polarity at the input would not
    matter.


    An alternative would be an external shift register, set up so that the
    thermometer clocks its own data in, and then after that the stamp clocks in
    the data with shiftin at its own speed.

    I'm curious, what thermometer is this? There are several digital
    thermometers available that are more stamp-friendly.

    -- Tracy Allen
    Electronically Monitored Ecosystems
    http://www.emesystems.com



    ---original message--->
    The thermometer device measures the temperature every 10 Seconds and
    outputs
    the data as serial data as 13 pulses on two pins as follows:


    Thermometer Pin 9 (Data out):
    |
    16 mSeconds
    |
    _____________________________________________________
    | D01 |D02|D03|D04|D05|D06|D07|D08|D09|D10|D11|D12|D13|
    _____|_____|___|___|___|___|___|___|___|___|___|___|___|___|______

    Thermometer Pin 10 (Clock Pulses Out):
    ____ _ _ _ _ _ _ _ _ _ _ _ _
    | | | | | | | | | | | | | | | | | | | | | | | | | |
    _____| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |________

    |1mS |

    With the exception of the first clock pulse (which has a duration of
    1mSec),
    the clock pulses occur 0.125 mSec after the start of the data pulse and
    last
    for 0.125 mSec.

    The data bits have the following significance:
    D01 - Degrees Celcius Polarity
    D02 - 80
    D03 - 40
    D04 - 20
    D05 - 10
    D06 - 8
    D07 - 4
    D08 - 2
    D09 - 1
    D10 - 0.8
    D11 - 0.4
    D12 - 0.2
    D13 - 0.1

    I originally planned to read the data using Shiftin, but I have not been
    able to get this to work and I believe the problem is due to the device
    generating it's own clock pulses and not accepting clock pulses from the
    BS2
    while the BS2 expects to be generating the clock pulses.

    Does anyone have an idea as to how I can use the BS2 to read this data?

    A secondary question is whether the BS2 could read the data electrically
    inverted (i.e. 0=5V and 1=0V)? I am currently adding inverter circuitry but
    would like to eliminate this circuitry if it can be done in software.
  • ArchiverArchiver Posts: 46,084
    edited 2000-09-16 22:37
    Thanks, Tracy, for the reply.

    It looks like the shift register is the way I should go and I will probably
    pursue this option - do you have any recommendations about which devices
    would be best for this - bearing in mind the 13 bits it will need to store
    and the speed?

    In answer to your question, the device I am using is supplied by Maplin in
    the UK as part (Maplin code) number FE33L - you can find the device on their
    site at www.maplin.co.uk. It has the following information printed on it
    'MB-TMB880CF-1 and 016-808440-111.

    The feature I find most attractive about this device is that it has a LCD
    dsiplay but it also has minimum and maximum temperature alarms etc. so it
    should be very useful if I can just interface it to the stamp.

    Thanks again!

    Regards
    Richard


    Original Message
    From: "Tracy Allen" <emesys@c...>
    To: <basicstamps@egroups.com>
    Sent: Saturday, September 16, 2000 10:07 PM
    Subject: [noparse][[/noparse]basicstamps] Help please - Problem reading Serial pulses with
    clock pulses


    > Hi Richard,
    >
    > The clock for the Stamp's shiftin command must come from the stamp itself,
    > not from the external device. The only way to get the stamp to receive
    this
    > data would be by means of a program loop, and the stamp2 is simply too
    slow
    > to react to 125 microsecond clock pulses. It is just on the borderline
    for
    > the data stream as a whole. It looks like each data bit sticks around for
    > over 1.2 milliseconds. The Stamp2sx is faster, and could, I think, keep
    up
    > with the data in a program loop. The polarity at the input would not
    > matter.
    >
    >
    > An alternative would be an external shift register, set up so that the
    > thermometer clocks its own data in, and then after that the stamp clocks
    in
    > the data with shiftin at its own speed.
    >
    > I'm curious, what thermometer is this? There are several digital
    > thermometers available that are more stamp-friendly.
    >
    > -- Tracy Allen
    > Electronically Monitored Ecosystems
    > http://www.emesystems.com
    >
    >
    >
    > ---original message--->
    > The thermometer device measures the temperature every 10 Seconds and
    > outputs
    > the data as serial data as 13 pulses on two pins as follows:
    >
    >
    > Thermometer Pin 9 (Data out):
    > |
    16 mSeconds
    |
    > _____________________________________________________
    > | D01 |D02|D03|D04|D05|D06|D07|D08|D09|D10|D11|D12|D13|
    > _____|_____|___|___|___|___|___|___|___|___|___|___|___|___|______
    >
    > Thermometer Pin 10 (Clock Pulses Out):
    > ____ _ _ _ _ _ _ _ _ _ _ _ _
    > | | | | | | | | | | | | | | | | | | | | | | | | | |
    > _____| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |________
    >
    > |1mS |
    >
    > With the exception of the first clock pulse (which has a duration of
    > 1mSec),
    > the clock pulses occur 0.125 mSec after the start of the data pulse and
    > last
    > for 0.125 mSec.
    >
    > The data bits have the following significance:
    > D01 - Degrees Celcius Polarity
    > D02 - 80
    > D03 - 40
    > D04 - 20
    > D05 - 10
    > D06 - 8
    > D07 - 4
    > D08 - 2
    > D09 - 1
    > D10 - 0.8
    > D11 - 0.4
    > D12 - 0.2
    > D13 - 0.1
    >
    > I originally planned to read the data using Shiftin, but I have not been
    > able to get this to work and I believe the problem is due to the device
    > generating it's own clock pulses and not accepting clock pulses from the
    > BS2
    > while the BS2 expects to be generating the clock pulses.
    >
    > Does anyone have an idea as to how I can use the BS2 to read this data?
    >
    > A secondary question is whether the BS2 could read the data electrically
    > inverted (i.e. 0=5V and 1=0V)? I am currently adding inverter circuitry
    but
    > would like to eliminate this circuitry if it can be done in software.
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-09-18 04:17
    > It looks like the shift register is the way I should go and I will
    probably
    > pursue this option - do you have any recommendations about which devices
    > would be best for this - bearing in mind the 13 bits it will need to
    store
    > and the speed?

    Hi Richard,

    Since don't need parallel in or out, a straight through shift register like
    the CD4006 could do the trick. It has up to 18 stages, and I think it can
    be configured for 13 stages.

    http://www.ti.com/sc/docs/products/logic/cd4006b.html

    I'm not sure if the part is still in production. It is clocked on the
    falling edge. The circuit would also need to allow clocking from both the
    outside source and from the stamp in turn, using a gate or some MML (Micky
    Mouse Logic).

    You could also use something like the 74HC595, but since it has 8 stages
    you would need to cascade two of them to get your 13 bits.

    The most elegant solution would be an 8-PIN PIC, programmed as a shift
    register.

    regards,
    -- Tracy Allen
    electronically monitored ecosystems
    http://www.emesystems.com
Sign In or Register to comment.