Shop OBEX P1 Docs P2 Docs Learn Events
Ref: <a href= — Parallax Forums

Ref: <a href=

ArchiverArchiver Posts: 46,084
edited 2002-11-14 21:32 in General Discussion
Your email message, with the subject of "[noparse][[/noparse]basicstamps]_Digest_Number_1481"
is currently being held pending verification because your email address
isn't recognized.

To have your message forwarded to me, please click here:

http://www.spambar.com/release.php?id=4308490&c=&s=basicstamps@yahoogroups.c
om

--- Enclosed is a copy of your message:

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.


There are 12 messages in this issue.

Topics in this digest:

1. Re: Re: Battery Backup Question
From: Jim Higgins <HigginsJ@s...>
2. Re: Raising to a power
From: Tracy Allen <tracy@e...>
3. Re: Help on ins and outs please...
From: Tracy Allen <tracy@e...>
4. Re: Re: Help on ins and outs please...
From: smartdim@a...
5. Re: Raising to a power
From: Tracy Allen <tracy@e...>
6. Re: Raising to a power
From: "ve3crx" <ve3crx@r...>
7. Re: Help on ins and outs please...
From: "rossfree" <rfreeman@w...>
8. Re: Using reset pin
From: plasmastamp@a...
9. rs-232 interface
From: Matt Lorenz <mklorenz@c...>
10. Re: rs-232 interface
From: "Martin Hebel" <martin@s...>
11. programming the sound app module
From: "silver17audiocraft" <averycording@h...>
12. the gripper
From: "cliopatra22" <raceratstreet@h...>


________________________________________________________________________
________________________________________________________________________

Message: 1
Date: Tue, 12 Nov 2002 10:52:28 -0500
From: Jim Higgins <HigginsJ@s...>
Subject: Re: Re: Battery Backup Question

At 20:13 11/11/02, Tracy Allen wrote:
>Yes, there is leakage back into the battery from the diode.
>
>A 1N4001 diode back biased will have a leakage current at room
>temperature of about 10 nanoamps. That increases to maybe 100
>nanoamps at the highest ambient temperatures you would encounter.
>
>I have always heard that alkaline cells are safe for "leakage
>charging" at that level, that is, the leakage is less than the
>self-discharge rate of the battery.
>
>To put this in perspective, if you are worried, then you could
>install a 22 megaohm resistor in parallel with your reserve battery
>pack. The resistor would draw a current constantly, 12 volts/22
>megaohms = 55 nanoamps. Don't worry too much about the extra load.
>Your 8 AA cells are rated at over one amp-hour, and it would take
>almost 2 million hours, over 200 years, for the batteries to
>discharge through the 22 megaohms. (They would self-discharge long
>before that!!!). The resistor would sink the excess charging
>current. But my point really is, you don't even need the resistor.
>
>Schottky diodes are _muc_h more leaky in reverse, maybe 10 microamps
>at room temperature. That might argue against a Schottky.
>
>The best diode, the lowest leakage, would actually be the
>base-collector junction of a transistor. The collector base junction
>of NPN transistor will have a leakage of orders of magnitude lower
>than the 1N4001. For example, I just pulled a 2N3904 NPN transistor
>out of the drawer, and measured a reverse leakage at room
>temperature, 10 volts reverse bias, of about 90 picoamps. I also
>measured a big 2N3055 in a TO220 case, and that was low too, only 270
>picoamps, 0.27 nanoamp.
>
> D1
> power
>|---;
> |
> C E |
> battery
\ />----o--o----load
>
|
> |B | NPN transistor
> `
' base connected to emitter
> Vcbo > 20 volts
> Ic ample for the load
>
>
>I do not know exactly what level of reverse current would tolerable
>for an alkaline battery. You could always add the parallel resistor
>to absorb the current. Jim Higgins on this list is more of a battery
>expert, and I would defer to his suggestions, if he happens to check
>in on this one.
>
>The need for diode D1 in your circuit will depend on the level of
>leakage back into the power supply when the power is turned off.
>Don't assume that it will be zero!

I've been reading and I see very good advice being given.

I think I saw something questioning the reverse recovery time of a 1N4001.
Remembering, it will switch as soon as the voltage of the supply drops
below the voltage of the battery - about 12 volts - and that both will
still be well above the voltage the regulator needs to maintain regulation,
I don't think a 2 microsecond recovery time is a problem. That's a lot of
head room in my book.


Jim H



________________________________________________________________________
________________________________________________________________________

Message: 2
Date: Tue, 12 Nov 2002 11:40:34 -0800
From: Tracy Allen <tracy@e...>
Subject: Re: Raising to a power

>I need to raise a word (in the range 0:1023) to the power n, where n
>will be < 1, for example:
>
>y = x**.23
>
>
>I've read Tracy's math stuff, but didn't see anything there that was
>directly applicable. Other than table lookup, anyone got any good
>ideas?
>
>Thanks
>
>Larry


If n is a variable, too, then a table lookup/interpolation is not feasible.

I would approach it as
lg y = n * lg x
where lg is log base 2. There is a an iterative algorithm for that
on my web site. Having that, you can multiply (n * lg x) using the
** operator, and the result will be an integer part (characteristic)
and a fractional part (mantissa) equal to lg y. The characteristic
brackets the possible values of y between two integer powers of two.
Then to narrow it down it would not be hard to put lg y in a loop and
converge quickly on the solution. By quickly, I mean 10s of
milliseconds altogether!

I have not done the Stamp antilog explicitly (maybe someday).


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





________________________________________________________________________
________________________________________________________________________

Message: 3
Date: Tue, 12 Nov 2002 11:41:58 -0800
From: Tracy Allen <tracy@e...>
Subject: Re: Help on ins and outs please...

>Thanks for getting back...
>
>I need to write a more compacted code. Spelling it out line by line
>would eat the five hundred max lines I have available on the BS2.
>
>Ross
>
>--- In basicstamps@y..., PM <pmeloy@s...> wrote:
>> Are you sure you need real parallel? If you just did
>>
>> high 1
>> low 2
>> low 3
>> high 4
>> high 5
>> high 6
>>
>> It would happen serially but so flippin fast you'd never be able to
>tell it
>> wasn't parallel.
>>
Original Message
>> From: "rossfree" <rfreeman@w...>
>> To: <basicstamps@y...>
>> Sent: Tuesday, November 12, 2002 5:34 AM
>> Subject: [noparse][[/noparse]basicstamps] Help on ins and outs please...
>>
>>
>> > I'm going through a refresher on pbasic. It's been a while. I am
>> > trying to write a program that will control several sets of
>christmas
>> > lights to "dance" in intricate patterns with a 9 minute musical
>piece.
>> >
>> > The music, as it is playing, will be run through a VU type
>circuit,
>> > two lines of which will be tied to two input pins of the stamp.
>Using
>> > a high and low threshold on those two lines, I will be able to
>pick
>> > up occasional synchronous beats from the music to re-synchronize
>the
>> > program to the music and simplify programming in chunks... to be
>put
>> > together at a later date.
>> >
>> > I'm working with a BS2 at present and may have to go to the SX for
>> > more space.
>> >
>> > Anyway... I don't remember how to output a set of 1's and 0's to a
>> > bank of output pins simultaneously. I would like to connect
>circuitry
>> > to six output pins which will drive six individual lines of
>christmas
>> > lights. I need parallel communication out. I just don't remember
>how!
>> >
>> > I would like to display a six bit patterns on their respective
>pins,
>> > turning on individual or multiple strands of lights.
>> >
>> > Can anyone slap me around a bit here and jog my memory on how to
>do
>> > this please?!
>> >
>> > Thank you!
>> >
>> > Ross
>> >
>> >
>> > To UNSUBSCRIBE, just send mail to:
>> > basicstamps-unsubscribe@y...
>> > 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/
>> >
>> >
>
>
>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/



________________________________________________________________________
________________________________________________________________________

Message: 4
Date: Tue, 12 Nov 2002 15:05:33 EST
From: smartdim@a...
Subject: Re: Re: Help on ins and outs please...

OUTL = %11110000· ;makes pins 0 ~ 3 low and 4 ~ 7 high
OUTH·· = %11110000 ;makes pins 8 ~ 11 low and 12 ~ 16 high
OUTA = %1111·· ;makes pins - ~ 3 high
OUTB will address pins 4 ~ 7
OUTC will address pins 8 ~ 11
OUTD will address pins 12 ~ 16

This will allow you to send out one command and adress 4, 8 or even 16 pins
(uses OUTS to address all 16 pins of the BS2, but then there are no pins
left
for input).

This is less typing and faster code than addressing each pin individually.

I hope this helps.
AND
After reading your message again, to send out a parrallel set of bits, (see
my other posting on what the commands are) you can only address a bank of 4,
8 or 16 pins at a time.
A possible solution is to do the following:
Suppose your 12 outputs are pins 0 through 11 with the first bank of LED
pins
0 ~ 5, and the second bank of leds pins 6 ~ 11.

If the first two leds on the second bank (pins 6 & 7 ) are currently low and
you want to keep them that way, and alter pins 0 ~ 5, you can send the
command
OUTSL = %00xxxxxx· ;where the x's are the bits you want to change (pins 0 ~
5, set to 1 or 0) and bits 6 & 7 (the leds from the second bank you don't
want to change) will remain low.
Write back if you need more clarification

smartdim@a...


[noparse][[/noparse]Non-text portions of this message have been removed]



________________________________________________________________________
________________________________________________________________________

Message: 5
Date: Tue, 12 Nov 2002 12:53:49 -0800
From: Tracy Allen <tracy@e...>
Subject: Re: Raising to a power

Hi again Larry,

Another thought on this,
y = x**.23
computed using lg (log base 2)
lg y = .23 * lg x
y = 2 to the power (.23 * lg x)

if you need more speed and not so much accuracy (??), you could use
the bitlog and its inverse (2 to the power of..) from
http://www.emesys.com/BS2math3.htm#bitlog
Bitlog is a very fast interpolation scheme to find logs and antilogs.

-- Tracy


>>I need to raise a word (in the range 0:1023) to the power n, where n
>>will be < 1, for example:
>>
>>y = x**.23
>>
>>
>>I've read Tracy's math stuff, but didn't see anything there that was
>>directly applicable. Other than table lookup, anyone got any good
>>ideas?
>>
>>Thanks
>>
>>Larry
>
>
>If n is a variable, too, then a table lookup/interpolation is not feasible.
>
>I would approach it as
> lg y = n * lg x
>where lg is log base 2. There is a an iterative algorithm for that
>on my web site. Having that, you can multiply (n * lg x) using the
>** operator, and the result will be an integer part (characteristic)
>and a fractional part (mantissa) equal to lg y. The characteristic
>brackets the possible values of y between two integer powers of two.
>Then to narrow it down it would not be hard to put lg y in a loop
>and converge quickly on the solution. By quickly, I mean 10s of
>milliseconds altogether!
>
>I have not done the Stamp antilog explicitly (maybe someday).
>
>
> -- best regards
> Tracy Allen
> electronically monitored ecosystems
> http://www.emesystems.com
> mailto:tracy@e...
>
>
>


________________________________________________________________________
________________________________________________________________________

Message: 6
Date: Tue, 12 Nov 2002 21:18:30 -0000
From: "ve3crx" <ve3crx@r...>
Subject: Re: Raising to a power

Tracy (and Al)

The power is a constant within a given system (It is an amp-hour
meter for my sailboat; the available power in a battery depends on
the actual current drain raised to a power; the number is a constant
for a particular brand of battery.

A general method would of course be best; then I can just change the
constant for different batteries.

Actually, the real version of this is going to be built using a PIC
16F877 rather than a STAMP. The stamp is real nice for playing around
with concepts. The real device will probably be programmed using
PicBasic Pro.

I'll look at the web site again for your log stuff, Tracy.

Thanks

Larry



________________________________________________________________________
________________________________________________________________________

Message: 7
Date: Tue, 12 Nov 2002 21:35:10 -0000
From: "rossfree" <rfreeman@w...>
Subject: Re: Help on ins and outs please...

All good feedback... and I truly appreciate it.

Let me tell what I am trying to do and see if this jives with those
that know how to do it.

I have a nine minute musical piece. I intend to write a program that
will flash christmas lights in various patterns, each assigned to a
different segment of the musical piece.

The main trunk of the program will establish a tempo and then call
subroutines one at a time... each subroutine will produce a pattern
of flashing lights that may last from a couple of seconds to thirty
seconds or so.

It is important that the subroutine loops back to the main trunk
where a it will track through one or two IF statements. Then it will
go back to the subroutine and continue to loop.

The IF statements might suggest a total number of loops before it
progresses to the next section of the trunk, varying the tempo as
needed and then calling a new subroutine (following the next section
of the music).

If I store my lighting patterns in the subroutines, I can easily call
them later if desired without much fuss.

I intended to write the program something like this:

x var nib
y var word
z var byte
tempo var byte
loops var byte
dirH = %11111100 'only output the six most significant digits

loops = 0 'number of beats being counted
tempo = 200 'adjustable as needed for program loop time

MAIN:
gosub PATTERN1
if loops = 16 then goto SECTION2
goto main

SECTION2:
end

PATTERN1:
lookup x,[noparse][[/noparse]127,191,223,239,247,251]y
outl = y
z = z + 1
if z = tempo then x = x + 1 and z = 0 and loops = loops + 1
if x = 6 then x = 0
return

In the "lookup" statement above, I call decimal numbers which when
converted to binary will drive low one of the outputs on I/O pins 10
thru 15. I think the least significant didgets will be truncated
because they fall on I/O pins 8 and 9 which are stated as inputs. The
lookup numbers above would pattern the lights to 'chase'.

The beauty (if there is something that can be called beautiful here)
is that each of the subroutines will look very much alike except that
the lookup statements will change to drive the lights in different
patterns. This should make writing the code fairly straight forward.

Of course I do what to add in a few bells and whistles like fading
and re-synchronizing to the beat(one of my inputs). But I think I can
do it.

I don't know if I can use all of those "and's" in the "if z"
statement above.

Ok all... nail me for my mistakes. I can take it!

Ross




--- In basicstamps@y..., smartdim@a... wrote:
> OUTL = %11110000· ;makes pins 0 ~ 3 low and 4 ~ 7 high
> OUTH·· = %11110000 ;makes pins 8 ~ 11 low and 12 ~ 16 high
> OUTA = %1111·· ;makes pins - ~ 3 high
> OUTB will address pins 4 ~ 7
> OUTC will address pins 8 ~ 11
> OUTD will address pins 12 ~ 16
>
> This will allow you to send out one command and adress 4, 8 or even
16 pins
> (uses OUTS to address all 16 pins of the BS2, but then there are no
pins left
> for input).
>
> This is less typing and faster code than addressing each pin
individually.
>
> I hope this helps.
> AND
> After reading your message again, to send out a parrallel set of
bits, (see
> my other posting on what the commands are) you can only address a
bank of 4,
> 8 or 16 pins at a time.
> A possible solution is to do the following:
> Suppose your 12 outputs are pins 0 through 11 with the first bank
of LED pins
> 0 ~ 5, and the second bank of leds pins 6 ~ 11.
>
> If the first two leds on the second bank (pins 6 & 7 ) are
currently low and
> you want to keep them that way, and alter pins 0 ~ 5, you can send
the
> command
> OUTSL = %00xxxxxx· ;where the x's are the bits you want to change
(pins 0 ~
> 5, set to 1 or 0) and bits 6 & 7 (the leds from the second bank you
don't
> want to change) will remain low.
> Write back if you need more clarification
>
> smartdim@a...
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]



________________________________________________________________________
________________________________________________________________________

Message: 8
Date: Tue, 12 Nov 2002 20:56:44 EST
From: plasmastamp@a...
Subject: Re: Using reset pin

A better way is to have an input look at the E-Stop switch. Then under
software control you can deactivate the outputs under a controlled manner.
I use this approach on my industrial controls. Another way is to have the
E-Stop circuit kill all power to the Output circuitry. That way you can
leave
the stamp running but kill everything operational. I use this approach when
the E-Stop operation is protecting humans and/or expensive machinery.
I would not trust the reset circuitry for an important mission as this. It
is
like replacing the seatbelts in your car with strings.

Alan Bradford
Plasma Technologies


[noparse][[/noparse]Non-text portions of this message have been removed]



________________________________________________________________________
________________________________________________________________________

Message: 9
Date: Tue, 12 Nov 2002 21:27:03 -0600
From: Matt Lorenz <mklorenz@c...>
Subject: rs-232 interface

I am learning on a nx-1000 board.

It has seperate 9 pin connectors: One for programming and another for Serial
Communication with a PC (or other device i imagine).

When I go to build my circuit on a regular bs2 carrier board or using bs2
eom, does the 9 pin programming connector double as a Serial Communications
port or how does that work?

matt


[noparse][[/noparse]Non-text portions of this message have been removed]



________________________________________________________________________
________________________________________________________________________

Message: 10
Date: Wed, 13 Nov 2002 04:32:02 -0000
From: "Martin Hebel" <martin@s...>
Subject: Re: rs-232 interface

Matt,
Any of the BS2 I/O pins can act as serial data ports, using the
SEROUT and SERIN instructions. If you are communicating to another
Stamp, it's pretty quick and dirty.

If you are going to communicate to a PC that requires an inverted
signal, you MAY need some additional hardware.

The NX-1000 has some signal conditioning on that connection to invert
the data and make it ready for a PC's COM port.

You may also send and receive data using the programming port (which
is a normal method many times on other versions). The programming
port is refered to as P16.
SEROUT 16,baud,[noparse][[/noparse]data]

Not sure that cleared it up, but it's an involved question depending
on what you want to do.

-Martin



--- In basicstamps@y..., Matt Lorenz <mklorenz@c...> wrote:
> I am learning on a nx-1000 board.
>
> It has seperate 9 pin connectors: One for programming and another
for Serial Communication with a PC (or other device i imagine).
>
> When I go to build my circuit on a regular bs2 carrier board or
using bs2 eom, does the 9 pin programming connector double as a
Serial Communications port or how does that work?
>
> matt
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]



________________________________________________________________________
________________________________________________________________________

Message: 11
Date: Wed, 13 Nov 2002 04:36:38 -0000
From: "silver17audiocraft" <averycording@h...>
Subject: programming the sound app module

Anyone got any experience working with a sound module appmod-revB?

I'm having trouble with my programming code. I am working with a
piezo electric sensor connected to pin3 of a BS2 (board of education.
When the sensor is pressed the sound module should play a recorded
message. I started off recording three messages on the sound module
with this code:
x var byte
Init: pause 500
serout 4, 84+$8000,[noparse][[/noparse]"!SM0N"]
pause 500
Start: for x=0 to 3
serout 4,84+$8000,[noparse][[/noparse]"!SM0R",(x*5)]
pause 2000
serout 4,84+$8000,[noparse][[/noparse]"!SM0E"]
pause 1000
serout 4,84+$8000,[noparse][[/noparse]"!SM0P",(x*5)]
pause 2000
next
for x=0 to 3
serout 4,84+$8000,[noparse][[/noparse]"!SM0P",(x*5)]
pause 2000
next

serout 4,84+$8000,[noparse][[/noparse]"!SM0D"]
end

so now there are three messages stored in the sound app's memory.
then i ran the code to program the sound module to react to the
sensor being pressed:
Input 3 'constant
Output 4 'constant
LOOP:
if In3=0 then PLAYAUDIO
GOTO LOOP:

PLAYAUDIO:

serout 4,188+$8000,[noparse][[/noparse]"!SM0P",0]
debug "sensor is pressed"
GOTO LOOP:
end

However, there is no audio playback when i press the sensor
but "sensor is pressed" does appear in the debug window. Any good
programmers out there know how to make the audio playback?
Thanks for any and all help!!



________________________________________________________________________
________________________________________________________________________

Message: 12
Date: Wed, 13 Nov 2002 09:19:18 -0000
From: "cliopatra22" <raceratstreet@h...>
Subject: the gripper

hello everybody,there is a gripper special made for the boe-bot, who
has more information about it? because I can't find anything about
it....

greetz CLIOpatra



________________________________________________________________________
________________________________________________________________________



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Sign In or Register to comment.