CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Return cursor

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

Return cursor
PostPosted: Fri Dec 17, 2004 6:57 am     Reply with quote

I am sending data through the RS232 and read it using some terminal.
When I read it as a string and send WriteByte('\n');
WriteByte('\r');
the cursor is returned to the begining of the next row.
How can I do the similar thing when reading it as HEX in the terminal?
_________________
Alex
asmallri



Joined: 12 Aug 2004
Posts: 1636
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Dec 17, 2004 7:36 am     Reply with quote

You are doing this the wrong way around. Traditional terminals send the end of line sequence <CR><LF> being carriage return and line feed respectively. Most applications expect a line to be terminated either with a <CR> or a <CR><LF> Lots of applications fail when the <LF> preceeds the <CR>

You should be doing
Code:
WriteByte('\r');  // this is the carriage return <CR>
WriteByte('\n);  // this is the line feed <LF>


Quote:
How can I do the similar thing when reading it as HEX in the terminal?


Not sure what you mean. If you mean what is the hex representation of the <CR><LF> characters then this is equivalent to above
Code:
WriteByte(0x0d);  // this is the carriage return <CR>
WriteByte(0x0a);  // this is the line feed <LF>


If you meant how do you get a terminal display that is showing the hex representation of characters to display a carriage return and line feed then the answer is you cannot because in hex mode it will desplay the hex value of these control characters
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

PostPosted: Fri Dec 17, 2004 7:41 am     Reply with quote

If you meant how do you get a terminal display that is showing the hex representation of characters to display a carriage return and line feed then the answer is you cannot because in hex mode it will desplay the hex value of these control characters[/quote]


Yes, thats what I meant.
Bad news.
Is there a terminal which allows me to do that?
I mean to see numbers in HEX but with returning the carriage after certain amount of sent bytes.
In other words to vombine the HEX view and string together
_________________
Alex
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Fri Dec 17, 2004 7:59 am     Reply with quote

Termial by Br@y can display both ASCII and Hex (and binary and decimal) simultaniously.
http://bray.velenje.cx/avr/terminal
_________________
The search for better is endless. Instead simply find very good and get the job done.
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

PostPosted: Fri Dec 17, 2004 9:21 am     Reply with quote

SherpaDoug wrote:
Termial by Br@y can display both ASCII and Hex (and binary and decimal) simultaniously.
http://bray.velenje.cx/avr/terminal



I have got it, so how can I view both string and hex?
_________________
Alex
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Fri Dec 17, 2004 9:58 am     Reply with quote

At the right side of the Receive window there are three check boxes, "Dec", "Hex", and "Bin". Check what you want to see.
Warning: I suspect that if I check them all and the serial data comes in real fast, ie. high baud rate, long strings, small inter-character spacing, on my PC I may miss an occasional character. Therefore don't display all formats if you don't need them.
This is my favorite serial comms program!
_________________
The search for better is endless. Instead simply find very good and get the job done.
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

PostPosted: Fri Dec 17, 2004 10:02 am     Reply with quote

SherpaDoug wrote:
At the right side of the Receive window there are three check boxes, "Dec", "Hex", and "Bin". Check what you want to see.
Warning: I suspect that if I check them all and the serial data comes in real fast, ie. high baud rate, long strings, small inter-character spacing, on my PC I may miss an occasional character. Therefore don't display all formats if you don't need them.
This is my favorite serial comms program!



I wanna see string and hex at the same time
I wanna return the cariage
_________________
Alex
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Fri Dec 17, 2004 10:23 am     Reply with quote

The main Receive window shows the ASCII values of the bytes, and executes the <CR> and <LF> characters. Simultaniously the Hex window shows the hexadecimal values of the bytes, executing nothing.
What else are you looking for?

P.S. I just noticed the latest version has custom baud rates! So now if your clock is 5% slow you can use 9120 baud instead of 9600. I haven't seen that in a serial program since DOS days! I'll have to test it to see what the granularity is at high baud rates.
_________________
The search for better is endless. Instead simply find very good and get the job done.
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

PostPosted: Mon Dec 20, 2004 2:54 am     Reply with quote

SherpaDoug wrote:
The main Receive window shows the ASCII values of the bytes, and executes the <CR> and <LF> characters. Simultaniously the Hex window shows the hexadecimal values of the bytes, executing nothing.
What else are you looking for?

P.S. I just noticed the latest version has custom baud rates! So now if your clock is 5% slow you can use 9120 baud instead of 9600. I haven't seen that in a serial program since DOS days! I'll have to test it to see what the granularity is at high baud rates.


I would like to see something like that:
AA AA 80 06 00 01 00 00 40 00
DD DD 12 01 10 01 00 00 00 08
AC AC
AA AA 00 05 03 00 00 00 00 00
AA AA 80 06 00 01 00 00 40 00
DD DD 12 01 10 01 00 00 00 08
AC AC
AA AA 00 05 03 00 00 00 00 00
AC AC
AA AA 80 06 00 01 00 00 12 00
DD DD 12 01 10 01 00 00 00 08
AA AA 80 06 00 01 00 00 40 00
DD DD 12 01 10 01 00 00 00 08


I would like to use the normal strings instead of the values DDDD and AAAA...
But the main thing is that I want see it in coloumn like this and not evering in one row, because its not really readable and hard to follow
_________________
Alex
asmallri



Joined: 12 Aug 2004
Posts: 1636
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Mon Dec 20, 2004 3:08 am     Reply with quote

Hi Alex,

What you are asking for does not make sense because on one hand you would like to see the hexidecimal value of a character and on the other you want the application to respond to control characters. If the application was to correctly interpret <CR> and <LF> then you would expect it to also correctly interpret cursor commands up, down, left, right, erase to EOL, erase to BOL etc. You can't have it both ways :-)
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group