For Programmers: Free Programming Magazines  


Home > Archive > Tcl > October 2005 > Serial Commands









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Serial Commands
biby

2005-10-27, 7:02 pm

Hi,

I'm new to TCL. I was trying to send some strings through the Serial
port and look it up on the scope. Although I am getting the binary of
the string that I send to it, I am also getting some extra data with
that. I wanted to know if there is a command to remove that, or if
someone know what the remaining code means.

eg. The commands that I am sending are:
set serial [open com3 w]
fconfigure $serial -trnaslation binary -eofchar {} -mode 9600,n,8,1
-buffering no
puts $serial A

The response I am getting is
0100000101001010000

Thanks,
Bibin

Mark Hobley

2005-10-27, 7:02 pm

biby <bibyjohn@gmail.com> wrote:
> puts $serial A
>
> The response I am getting is
> 0100000101001010000
>


What is the output of the following ?

puts $serial HELLO

I need to see where the extra characters appear, are they between each letter
or at the end of each letter, or what ?

Please post the raw output from the scope.

What type of scope are you using ?

I count 19 bits in your output above.

Regards,

Mark.

--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE

Telephone: (0121) 247 1596
International: 0044 121 247 1596

Email: markhobley at hotpop dot donottypethisbit com

http://markhobley.yi.org/

Himesh P.

2005-10-27, 7:02 pm

Looks like you're transmitting a capital A, followed by J. Weird.
With binary translation you should have just the start bit, A, and stop
bit.

Ulrich Schöbel

2005-10-27, 7:02 pm

Hi Biby,

puts $serial A

should output an 'A' and a 'LF' (0x0a) character.
I don't know why it's so weird, but looks like you
have to read the bits backwards, but the characters
forwards:

start-bit
stop-bit | stop-bit
| | |
0 1000010 1 0 01010000
<------ | <-------
A 'LF'
------------------->

I know, it looks crazy, but it's the only way it
makes sense.

Best regards

Ulrich


In article <1130442594.097566.137600@z14g2000cwz.googlegroups.com>,
"biby" <bibyjohn@gmail.com> writes:
> Hi,
>
> I'm new to TCL. I was trying to send some strings through the Serial
> port and look it up on the scope. Although I am getting the binary of
> the string that I send to it, I am also getting some extra data with
> that. I wanted to know if there is a command to remove that, or if
> someone know what the remaining code means.
>
> eg. The commands that I am sending are:
> set serial [open com3 w]
> fconfigure $serial -trnaslation binary -eofchar {} -mode 9600,n,8,1
> -buffering no
> puts $serial A
>
> The response I am getting is
> 0100000101001010000
>
> Thanks,
> Bibin
>

Alan Anderson

2005-10-27, 7:02 pm

"biby" <bibyjohn@gmail.com> wrote:

> puts $serial A


Remember that [puts] includes a newline at the end unless you
specifically tell it not to.

> The response I am getting is
> 0100000101001010000


Standard UAR/T serial communication transmits the least significant bit
of the data first, with a leading zero as a start bit and a trailing one
as a stop bit for synchronization. What you're getting looks just fine,
if I assume you left off just before the second character's stop bit.

0 - start bit
10000010 - 41 - ASCII "A"
1 - stop bit
0 - start bit
01010000 - 0A - ASCII LF
1 - stop bit (assumed)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com