Shop OBEX P1 Docs P2 Docs Learn Events
Bluetooth to RS232 — Parallax Forums

Bluetooth to RS232

ArchiverArchiver Posts: 46,084
edited 2003-10-14 20:33 in General Discussion
On 10/15/03 3:07 AM, "Jon Williams" <jwilliams@p...> wrote:

> Thanks for the catch, Tracy. I should have left well-enough alone....
>
> -- Jon
>
>
Original Message
> From: Tracy Allen [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=YuVsBF-ekEYiZhpDIoPaI7RUPK7NZ3shhycSDPImAAS73ItpJekgBKN-olYq2J4owlL4V1hMFoQFKYMSc1E]tracy@e...[/url
> Sent: Tuesday, October 14, 2003 12:58 PM
> To: basicstamps@yahoogroups.com
> Subject: RE: [noparse][[/noparse]basicstamps] Timing in a BS2 app
>
>
> Hi Jon,
>
> just a minor correction to the follow up, which would be,
>
> counter1 = (counter1 + C1in) & -C1in
>
> C1in is a bit and counter1 is probably a word or a byte. -1=$ffff is
> the mask to maintain the counter and 0 will reset it. (Note: unary
> "-" takes precedence over binary "&" in PBASIC)
>
> While in machine language execution time, negation-followed-by-AND
> would be far faster than full multiplication, on the Stamp BS2, each
> math operator takes about 140 microseconds of interpreter
> fetch+execute time, so the two operator sequence &- might be slower
> than the single *.
>
> -- Tracy
>
>
>> Just a follow-up:
>>
>> When using the input update or clear thing that I describe below, it's
>> probably faster to do it with the & operator:
>>
>> counter1 = (counter1 + C1in) & C1in
>>
>> -- Jon Williams
>> -- Parallax
>>
>>
>>
Original Message
>> From: Jon Williams
>> Sent: Tuesday, October 14, 2003 8:33 AM
>> To: basicstamps@yahoogroups.com
>> Subject: RE: [noparse][[/noparse]basicstamps] Timing in a BS2 app
>>
>>
>> Back in the "dark days" [noparse][[/noparse]being facetious] before everyone become so
>> enamored with interrupts, programmers used to trace their code paths,
>> counting cycles and could do accurate timing and measuring. I used to
>> work in the irrigation industry building sprinkler timers, and this
>> process is still used on small (four-bit processor!) models.
>>
>> Can it be done in the BASIC Stamp? Yes, in a way -- I did it for a
>> product that I developed for my previous employer. Of course, you
> can't
>> count cycles. What I did is use a spare pin as an indicator and a
> scope
>> to measure the paths through my code. I was able to the 0.1 sec
>> accuracy on a four-channel alarm device. In the micro world, 100
>> milliseconds is forever, but in the *real* world it far exceeded the
>> requirements of that application.
>>
>> PBASIC is designed well for state-machine applications. The framework
>> for most of my apps looks like this:
>>
>> Main:
>> DO
>> GOSUB Real_Important_Task
>> ON state GOSUB Task1, Task2, Task3
>> LOOP
>>
>> In my alarm application I padded the routines such that any state would
>> cause the "Main" loop to run at 100 milliseconds. My "Real Important
>> Task" was monitoring inputs -- I simply added the value of the input,
>> then multiplied, like this...
>>
>> counter1 = (counter1 + C1in) * C1in
>>
>> If the input was one the counter was incremented; if zero the counter
>> was cleared. The next step in my system checked counts and directed
> the
>> proper task (by setting the variable state).
>>
>> I hope that some of this helps you with your application.
>>
>> -- Jon Williams
>> -- Applications Engineer, Parallax
>> -- Dallas Office
>>
>>
>>
>>
Original Message
>> From: Tim McDonough [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=gA0CetGYHMEylQjbrrtWWaEb9f3FX8GbyMRG-ahuo5hWcXTilKrBmSH-fGr5fRabc-Oyk_Eb0g]tim@m...[/url
>> Sent: Monday, October 13, 2003 6:59 PM
>> To: basicstamps@yahoogroups.com
>> Subject: [noparse][[/noparse]basicstamps] Timing in a BS2 app
>>
>>
>> I'm involved in a project where we know there will be a lot of
>> experimentation and "on the fly" changes. Except for a few applications
>> with a BS1 I'd consider myself pretty new to PBASIC.
>>
>> I have a BOE and a Stamp Modem board. The project involves taking some
>> ADC readings and watching how often a motor is run. Essentially what
>> happens is I need to count how many seconds the motor runs. This value
>> is accumulated until the temperature exceeds a certain value. Once that
>> happens the modem board is used to call a PC and transfer the data.
>>
>> I come from a microcontroller background so all the ADC stuff, modem
>> dialing, etc. seems pretty straight forward. I'm sitting here this
>> evening wondering how to accumulate the motor run time?
>>
>> There's an opto device that gives me a logic high when there's 120 VAC
>> on the input. I essentially need to poll this input to the Stamp and
>> count the number of seconds it's active. Too many years having timer
>> interrupts and lack of experience with PBASIC have me puzzled. At this
>> point high resolution timing isn't critical. If the motor runs for 78
>> seconds and I report it ran from 75 to 80 that's perfectly acceptable
>> for proof of concept.
>>
>> Suggestions?
>>
>> Thanks,
>>
>> Tim
>>
>>
>>
>> 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/
>>
>>
>>
>>
>> This message has been scanned by WebShield. Please report SPAM to
>> abuse@p....
>>
>>
>> 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/
>>
>>
>>
>>
>> This message has been scanned by WebShield. Please report SPAM to
>> abuse@p....
>>
>>
>> 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/
Hi,

I want to make a robot that behave according to what my PC analysis, so I
need a serial port to bluetooth transmitter to transmit my program to the
stamp, so I need a bluetooth receiver to serial port to connect to the
stamp, is there anyone know anything about that?

Thanks

Annie

>
>
> 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/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p....
>
>
> 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.