PULSIN & DEBUGIN Conflict
Archiver
Posts: 46,084
Board: BS2
PBasic: v2.5
I am having this problem having PULSIN & DEBUGIN in the same loop.
DEBUGIN kind of dominates over PULSIN. Here is my code:
counts VAR Words
pulse VAR Words
stpkey VAR Byte
pulse = 0
DO
start:
PULSIN 0,1, counts
IF counts = 0 THEN start
pulse = pulse + 1
DEBUG DEC pulse, CR
DEBUGIN stpkey
LOOP UNTIL stpkey = "0"
It won't even DEBUG. If I disable DEBUGIN, PULSIN works and also DEBUG
- Johari
PBasic: v2.5
I am having this problem having PULSIN & DEBUGIN in the same loop.
DEBUGIN kind of dominates over PULSIN. Here is my code:
counts VAR Words
pulse VAR Words
stpkey VAR Byte
pulse = 0
DO
start:
PULSIN 0,1, counts
IF counts = 0 THEN start
pulse = pulse + 1
DEBUG DEC pulse, CR
DEBUGIN stpkey
LOOP UNTIL stpkey = "0"
It won't even DEBUG. If I disable DEBUGIN, PULSIN works and also DEBUG
- Johari
Comments
>Board: BS2
>PBasic: v2.5
>
>I am having this problem having PULSIN & DEBUGIN in the same loop.
>DEBUGIN kind of dominates over PULSIN. Here is my code:
>
>counts VAR Words
>pulse VAR Words
>stpkey VAR Byte
>
>pulse = 0
>
>DO
>start:
>PULSIN 0,1, counts
>IF counts = 0 THEN start
>pulse = pulse + 1
>DEBUG DEC pulse, CR
>DEBUGIN stpkey
>LOOP UNTIL stpkey = "0"
>
>It won't even DEBUG. If I disable DEBUGIN, PULSIN works and also DEBUG
>
>- Johari
Johari -
Are you sure you wanted to use Pulsin, or did you mean to use Count ?
Count determines the NUMBER of transitions, and Pulsin determines the time
frame.
Bruce Bates
frame is indefinite that means I want stop the motor at anytime I
choose and record the turns of the encoder. That's why I chose PULSIN
and not COUNT. I use COUNT for definite timing like a tachometer. Like
the following:
start:
COUNT 0, 1000, counts
RPM = counts + 6
DEBUG "RPM = ", DEC RPM,CR
GOTO start
I also use IN0 but still the DEBUGIN overides the INPUT. I think it
just sitting there waiting for me to type something on the keyboard
before moving on to the next step.
- Johari
--- In basicstamps@yahoogroups.com, Bruce Bates <bvbates@u...> wrote:
> At 11:46 AM 8/20/03 +0000, Johari Aziz wrote:
> >Board: BS2
> >PBasic: v2.5
> >
> >I am having this problem having PULSIN & DEBUGIN in the same loop.
> >DEBUGIN kind of dominates over PULSIN. Here is my code:
> >
> >counts VAR Words
> >pulse VAR Words
> >stpkey VAR Byte
> >
> >pulse = 0
> >
> >DO
> >start:
> >PULSIN 0,1, counts
> >IF counts = 0 THEN start
> >pulse = pulse + 1
> >DEBUG DEC pulse, CR
> >DEBUGIN stpkey
> >LOOP UNTIL stpkey = "0"
> >
> >It won't even DEBUG. If I disable DEBUGIN, PULSIN works and also DEBUG
> >
> >- Johari
>
> Johari -
>
> Are you sure you wanted to use Pulsin, or did you mean to use Count ?
> Count determines the NUMBER of transitions, and Pulsin determines
the time
> frame.
>
> Bruce Bates
>choose and record the turns of the encoder.
>I also use IN0 but still the DEBUGIN overides the INPUT. I think it
>just sitting there waiting for me to type something on the keyboard
>before moving on to the next step.
>- Johari
Yes, that is the way debugin works. It waits for input. The stamp
does not have a serial input buffer, so it cannot receive other
characters and queue them up wile doing other things.
-- One possible workaround is to use an external chip that does have
a serial buffer. There are several of them available.
-- Or a different workaround: Put a switch on another stamp input
pin that will allow you to break into the counting process. The
input to that extra pin could even come from the serial line, from
either tx (BREAK) or dtr.
-- regards,
Tracy
have an alternate inputting in that loop. I'm getting there. It seems
PULSIN is working because it display on DEBUG and also the ASCII
character that I press. But that IF statement still don't work. That
is if I press character "0" I want it to break the loop and jump to a
label. Do you have any suggestion to make SERIN works better?
--- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
> >The time frame is indefinite that means I want stop the motor at
anytime I
> >choose and record the turns of the encoder.
>
>
>
> >I also use IN0 but still the DEBUGIN overides the INPUT. I think it
> >just sitting there waiting for me to type something on the keyboard
> >before moving on to the next step.
> >- Johari
>
> Yes, that is the way debugin works. It waits for input. The stamp
> does not have a serial input buffer, so it cannot receive other
> characters and queue them up wile doing other things.
>
> -- One possible workaround is to use an external chip that does have
> a serial buffer. There are several of them available.
>
> -- Or a different workaround: Put a switch on another stamp input
> pin that will allow you to break into the counting process. The
> input to that extra pin could even come from the serial line, from
> either tx (BREAK) or dtr.
>
> -- regards,
> Tracy