processor overhead using conversion formatters
Archiver
Posts: 46,084
Group:
I'm using the serout command to send data from a BS2 to a
transceiver. The transceiver stipulates the maximum allowable
gap between transmitted bytes, which is a function of the baud
rate. I'm working at 19,200 bps, and I think I'm seeing a
problem when I include a conversion formatter in the serout data.
For example, the following line works:
serout 2\1,32,10,timed_out,[noparse][[/noparse]CR,"hello - ","5"]
but the following line does not:
serout 2\1,32,10,timed_out,[noparse][[/noparse]CR,"hello - ",dec 5]
The result of the first line is that the receiver displays
"hello - 5"
The result of the second line is that the receiver displays
"hello - " and nothing else.
I realize one should expect this kind of trouble with serin,
but I'm surprised to see it with serout. I have two questions:
1) Do I seem correct in suspecting that byte gaps are the
problem, or am I doing something boneheaded in my syntax?
2) Is there a way to convert a number to the ascii character
string prior to entering the serout command? Please realize
that the number to be converted is a variable. I tried the
following syntax but got an error at the line where I attempt
the formatting (second to last line).
test_number var byte ' my example number
test_string var byte(3) ' string to hold the characters that form
test_number
test_number = 100 ' set the variable equal to something
test_string = dec3 test_number ' attempt to break the number into
a byte array
debug test_string\3
Sorry if this is a bit long winded. Any help would sure be
appreciated. Thanks.
Clark Hughes
--
I'm using the serout command to send data from a BS2 to a
transceiver. The transceiver stipulates the maximum allowable
gap between transmitted bytes, which is a function of the baud
rate. I'm working at 19,200 bps, and I think I'm seeing a
problem when I include a conversion formatter in the serout data.
For example, the following line works:
serout 2\1,32,10,timed_out,[noparse][[/noparse]CR,"hello - ","5"]
but the following line does not:
serout 2\1,32,10,timed_out,[noparse][[/noparse]CR,"hello - ",dec 5]
The result of the first line is that the receiver displays
"hello - 5"
The result of the second line is that the receiver displays
"hello - " and nothing else.
I realize one should expect this kind of trouble with serin,
but I'm surprised to see it with serout. I have two questions:
1) Do I seem correct in suspecting that byte gaps are the
problem, or am I doing something boneheaded in my syntax?
2) Is there a way to convert a number to the ascii character
string prior to entering the serout command? Please realize
that the number to be converted is a variable. I tried the
following syntax but got an error at the line where I attempt
the formatting (second to last line).
test_number var byte ' my example number
test_string var byte(3) ' string to hold the characters that form
test_number
test_number = 100 ' set the variable equal to something
test_string = dec3 test_number ' attempt to break the number into
a byte array
debug test_string\3
Sorry if this is a bit long winded. Any help would sure be
appreciated. Thanks.
Clark Hughes
--
Comments
jchughes@a... writes:
> 2) Is there a way to convert a number to the ascii character
> string prior to entering the serout command? Please realize
> that the number to be converted is a variable. I tried the
> following syntax but got an error at the line where I attempt
>
Here's a simple routine that should work for you:
myNum VAR Byte
strNum VAR Byte(3)
x VAR Nib
myNum = 123
FOR x = 0 TO 2
strNum(2 - x) = (myNum DIG x) + 48 ' convert digit to ASCII
NEXT
DEBUG "My number is: ", STR strNum\3
END
-- Jon Williams
-- Parallax
[noparse][[/noparse]Non-text portions of this message have been removed]
operator, though I've now looked it up in the index and read
up on it. Thanks so much.
Clark
jonwms@a... wrote:
> In a message dated 2/5/02 8:45:13 AM Central Standard Time,
> jchughes@a... writes:
>
> > 2) Is there a way to convert a number to the ascii character
> > string prior to entering the serout command? Please realize
> > that the number to be converted is a variable. I tried the
> > following syntax but got an error at the line where I attempt
> >
>
> Here's a simple routine that should work for you:
>
> myNum VAR Byte
> strNum VAR Byte(3)
> x VAR Nib
>
> myNum = 123
>
> FOR x = 0 TO 2
> strNum(2 - x) = (myNum DIG x) + 48 ' convert digit to ASCII
> NEXT
>
> DEBUG "My number is: ", STR strNum\3
> END
>
> -- Jon Williams
> -- Parallax
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>
> 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/
--
J. Clark Hughes
Applied Research Laboratories
The University of Texas
Austin, Texas
>gap between transmitted bytes, which is a function of the baud
>rate. I'm working at 19,200 bps, and I think I'm seeing a
>problem when I include a conversion formatter in the serout data.
>For example, the following line works:
>
> serout 2\1,32,10,timed_out,[noparse][[/noparse]CR,"hello - ","5"]
>
>but the following line does not:
>
> serout 2\1,32,10,timed_out,[noparse][[/noparse]CR,"hello - ",dec 5]
It's true that the modifiers add a lot of processing time. For example,
serout 14\15,$54,[noparse][[/noparse]x]
takes 480 microseconds to get from ready to the actual transmission
of the start bit. On the other hand,
serout 14\15,$54,[noparse][[/noparse]dec x]
with the dec modifier takes a whopping 3500 microseconds to get to
the first start bit. Forms like dec3 are somewhat faster than the
generic dec.
The hex modifiers are faster than the dec modifiers. For example,
serout 14\15,$54,[noparse][[/noparse]hex3 x]
gets to the first start bit in 1100 microseconds.
Fastest of all is the str x\n modifier, which gets to the first start
bit in about 500 microseconds.
-- Tracy
Thanks for all that information. That will be valuable to those
needing to understand serout timing subtleties, especially in
applications where byte gap timing is critical. The delays you
quote are for the first transmitted bit - I suppose the delays are
similar when the formatter is mid-stream in the data, such as:
serout 2,32,[noparse][[/noparse]CR,"hello - ",dec 5]
which is the source of my troubles. The note from Jon laid out
a good workaround for me, though. Thanks again.
Clark
Tracy Allen wrote:
> > The transceiver stipulates the maximum allowable
> >gap between transmitted bytes, which is a function of the baud
> >rate. I'm working at 19,200 bps, and I think I'm seeing a
> >problem when I include a conversion formatter in the serout data.
> >For example, the following line works:
> >
> > serout 2\1,32,10,timed_out,[noparse][[/noparse]CR,"hello - ","5"]
> >
> >but the following line does not:
> >
> > serout 2\1,32,10,timed_out,[noparse][[/noparse]CR,"hello - ",dec 5]
>
> It's true that the modifiers add a lot of processing time. For example,
> serout 14\15,$54,[noparse][[/noparse]x]
> takes 480 microseconds to get from ready to the actual transmission
> of the start bit. On the other hand,
> serout 14\15,$54,[noparse][[/noparse]dec x]
> with the dec modifier takes a whopping 3500 microseconds to get to
> the first start bit. Forms like dec3 are somewhat faster than the
> generic dec.
>
> The hex modifiers are faster than the dec modifiers. For example,
> serout 14\15,$54,[noparse][[/noparse]hex3 x]
> gets to the first start bit in 1100 microseconds.
>
> Fastest of all is the str x\n modifier, which gets to the first start
> bit in about 500 microseconds.
>
> -- Tracy
>
> 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/
--
J. Clark Hughes
Applied Research Laboratories
The University of Texas
Austin, Texas
When using flow control, I'm finding that the time from the
flow control pin changing state until the first data bit is
transmitted from the BS2 is about 18 microseconds (10E-6).
I don't think that's in conflict with what Tracy writes, but I
just want anyone who cares to know that these delays
quoted below appear to be measured from the issuance of
the command, not from the flow control pin changing state.
Clark
Tracy Allen wrote:
> > The transceiver stipulates the maximum allowable
> >gap between transmitted bytes, which is a function of the baud
> >rate. I'm working at 19,200 bps, and I think I'm seeing a
> >problem when I include a conversion formatter in the serout data.
> >For example, the following line works:
> >
> > serout 2\1,32,10,timed_out,[noparse][[/noparse]CR,"hello - ","5"]
> >
> >but the following line does not:
> >
> > serout 2\1,32,10,timed_out,[noparse][[/noparse]CR,"hello - ",dec 5]
>
> It's true that the modifiers add a lot of processing time. For example,
> serout 14\15,$54,[noparse][[/noparse]x]
> takes 480 microseconds to get from ready to the actual transmission
> of the start bit. On the other hand,
> serout 14\15,$54,[noparse][[/noparse]dec x]
> with the dec modifier takes a whopping 3500 microseconds to get to
> the first start bit. Forms like dec3 are somewhat faster than the
> generic dec.
>
> The hex modifiers are faster than the dec modifiers. For example,
> serout 14\15,$54,[noparse][[/noparse]hex3 x]
> gets to the first start bit in 1100 microseconds.
>
> Fastest of all is the str x\n modifier, which gets to the first start
> bit in about 500 microseconds.
>
> -- Tracy
>
> 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/
--
J. Clark Hughes
Applied Research Laboratories
The University of Texas
Austin, Texas