Shop OBEX P1 Docs P2 Docs Learn Events
BS1 to BS2 code conversion — Parallax Forums

BS1 to BS2 code conversion

ArchiverArchiver Posts: 46,084
edited 2001-11-20 19:32 in General Discussion
Dave-

Try using the DEC modifier with your DEBUG statements:

> debug DEC temp:debug DEC RH

The DEBUG screen will treat everything it receives as ASCII stuff.
If you send it hexadecimal data, it may clear the screen or do some
other goofy stuff you don't mean to be done.

Also, this statement seems odd:

> if 1 = 1 then ReadRH

1 will always equal 1. Do you mean "IF IN1 = 1"?


Regards,

Steve

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-11-16 20:51
    Hello Stampers,

    For quite awhile I have wanted to complete the project in the Basic Stamp
    Programming Manual 1.9 dealing with the humidity sensor.........
    does anyone remember that one?

    I have gathered all the components and now am struggling with the original BS1
    code ( I am using a BS2 and do not want to change )

    here is what I have so far, ( I took the supplied code and went through it to
    make it more "BS2ish" ) Note* I have removed the parts dealing with the temp
    reading ( the LM334Z ) I would rather have a RH only board if possible. I
    tried several simple programs before resorting to trying to duplicate what
    was in the manual.

    this code currently debugs nothing to the screen, even though there are
    variables that have value in them.

    'humidity experiment

    temp var word
    RH var word

    Loop:
    input 0:input2: output 3
    low 2: low3
    temp = 500

    ReadTemp:
    output 1: low1
    pause 1
    input 1
    pulsout 2,temp
    if 1 = 1 then ReadRH
    temp = temp +1
    goto ReadRH

    ReadRH:
    high 3
    pause 500
    pulsin 0,1,RH
    low 3
    debug temp:debug RH
    goto Loop


    Any suggestions would be helpful, ( except to get a BS1 )


    Dave




    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-18 23:46
    Hi Dave,

    You can simplify your program a lot, because the BS2 has a more
    powerful instruction set than the BS1.

    For humidity, all you need to test it is:

    ' tie the RH enable to p3
    ' tie RH to 4024 to stamp p0
    ' don't forget +5 and ground to the RH module
    ' skip temperature for now
    RH var word
    high 3 ' enable RH operation
    loop:
    pulsin 0,1,RH
    debug dec RH,CR
    pause 1000
    goto loop

    Note the "dec" modifier in the debug statement. That is a big
    difference from the BS1.

    Really, you can eliminate the 4024 counter, because the BS2 has
    better time resolution than the BS1. (2 microseconds for the BS2 vs
    10 for the BS1). Another option you have on the BS2 is the COUNT
    command, which is not available on the BS1.

    If you do decide that you want the temperature too, it is much easier
    on the BS2 than on the BS1, because the of the BS2's RCtime command.

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com


    >Hello Stampers,
    >
    >For quite awhile I have wanted to complete the project in the Basic
    >Stamp Programming Manual 1.9 dealing with the humidity
    >sensor.........
    >does anyone remember that one?
    >
    >I have gathered all the components and now am struggling with the
    >original BS1 code ( I am using a BS2 and do not want to change )
    >
    >here is what I have so far, ( I took the supplied code and went
    >through it to make it more "BS2ish" ) Note* I have removed the
    >parts dealing with the temp reading ( the LM334Z ) I would rather
    >have a RH only board if possible. I tried several simple programs
    >before resorting to trying to duplicate what was in the manual.
    >
    >this code currently debugs nothing to the screen, even though
    >there are variables that have value in them.
    >
    >'humidity experiment
    >
    >temp var word
    >RH var word
    >
    >Loop:
    > input 0:input2: output 3
    > low 2: low3
    > temp = 500
    >
    >ReadTemp:
    > output 1: low1
    > pause 1
    > input 1
    > pulsout 2,temp
    > if 1 = 1 then ReadRH
    > temp = temp +1
    > goto ReadRH
    >
    >ReadRH:
    > high 3
    > pause 500
    > pulsin 0,1,RH
    > low 3
    > debug temp:debug RH
    > goto Loop
    >
    >
    >Any suggestions would be helpful, ( except to get a BS1 )
    >
    >
    >Dave
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-20 19:32
    Thanks Tracy, that code worked first try......

    Dave

    Original Message
    From: Tracy Allen <tracy@e...>
    To: <basicstamps@yahoogroups.com>
    Sent: Sunday, November 18, 2001 5:46 PM
    Subject: Re: [noparse][[/noparse]basicstamps] BS1 to BS2 code conversion


    > Hi Dave,
    >
    > You can simplify your program a lot, because the BS2 has a more
    > powerful instruction set than the BS1.
    >
    > For humidity, all you need to test it is:
    >
    > ' tie the RH enable to p3
    > ' tie RH to 4024 to stamp p0
    > ' don't forget +5 and ground to the RH module
    > ' skip temperature for now
    > RH var word
    > high 3 ' enable RH operation
    > loop:
    > pulsin 0,1,RH
    > debug dec RH,CR
    > pause 1000
    > goto loop
    >
    > Note the "dec" modifier in the debug statement. That is a big
    > difference from the BS1.
    >
    > Really, you can eliminate the 4024 counter, because the BS2 has
    > better time resolution than the BS1. (2 microseconds for the BS2 vs
    > 10 for the BS1). Another option you have on the BS2 is the COUNT
    > command, which is not available on the BS1.
    >
    > If you do decide that you want the temperature too, it is much easier
    > on the BS2 than on the BS1, because the of the BS2's RCtime command.
    >
    > -- regards,
    > Tracy Allen
    > electronically monitored ecosystems
    > mailto:tracy@e...
    > http://www.emesystems.com
    >
    >
    > >Hello Stampers,
    > >
    > >For quite awhile I have wanted to complete the project in the Basic
    > >Stamp Programming Manual 1.9 dealing with the humidity
    > >sensor.........
    > >does anyone remember that one?
    > >
    > >I have gathered all the components and now am struggling with the
    > >original BS1 code ( I am using a BS2 and do not want to change )
    > >
    > >here is what I have so far, ( I took the supplied code and went
    > >through it to make it more "BS2ish" ) Note* I have removed the
    > >parts dealing with the temp reading ( the LM334Z ) I would rather
    > >have a RH only board if possible. I tried several simple programs
    > >before resorting to trying to duplicate what was in the manual.
    > >
    > >this code currently debugs nothing to the screen, even though
    > >there are variables that have value in them.
    > >
    > >'humidity experiment
    > >
    > >temp var word
    > >RH var word
    > >
    > >Loop:
    > > input 0:input2: output 3
    > > low 2: low3
    > > temp = 500
    > >
    > >ReadTemp:
    > > output 1: low1
    > > pause 1
    > > input 1
    > > pulsout 2,temp
    > > if 1 = 1 then ReadRH
    > > temp = temp +1
    > > goto ReadRH
    > >
    > >ReadRH:
    > > high 3
    > > pause 500
    > > pulsin 0,1,RH
    > > low 3
    > > debug temp:debug RH
    > > goto Loop
    > >
    > >
    > >Any suggestions would be helpful, ( except to get a BS1 )
    > >
    > >
    > >Dave
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
Sign In or Register to comment.