- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To get nios2 to print a line and start a new at left boarder I find it necessary to do
printf(" Hello world \n\r"); \n alone only advances the line. \r gives the carriage return. In the hello_world examples \n is used, not \n\r. Have you seen the same? Why is this so? All the windows programs I have encountered needed only \n. I have tried it in the nios Eclipse debug console for serial IO and in the Hyper Terminal. My system is running in internal initialized ram and with "Small C library" and "Reduced device drivers". thanks,Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
\n means different things depending on the OS. In linux you don't get the carriage return when you use \n so if you don't have that then you'll end up on a new line but spaced over to where the last line stopped. So the \r makes it return to the beginning of the line and \n does the actual line feed (think of a typewritter where you turn the knob and pull the lever to start the next line).
And if I got everything completely backwards I'm sorry (I haven't program much in linux I just remember this being a formatting issue I ran into a while back). The reason why the hello world program probably didn't have them was it was probably intended to be received on a Windows machine, if you try to receive the data in Cygwin or any other linux type system then you will not get the data formatted properly depending on the system used. Cheers- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you're using Hyperterminal ... ugghh! ;-) Try:
File->properties, Settings tab, ASCII setup button: check "Append line feeds to incoming line ends" box. --Scott- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hyperterminal is a pretty old and generic program so it was created assuming the same format as linux (back in the old days even on an intel machine you had to do LF and CR when outputting).
Don't worry about the \r being in there, windows won't mind (it'll either ignore it or do it twice but you'll still be at the right spot).- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tried, but it doesn´t work.
Since Hyperterminal comes with Windows (...), and is suggested also by Altera docs to start playing with UART, if someone has a workaround to obtain the carriage return would be very appreciated. Thanks --- Quote Start --- originally posted by smcnutt@Sep 20 2004, 09:29 PM if you're using hyperterminal ... ugghh! ;-) try:
file->properties, settings tab, ascii setup button:
check "append line feeds to incoming line ends" box.
--scott
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=1675)
--- quote end ---
--- Quote End ---
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try using nios2-terminal with the -U option. I'm not sure which Altera docs you're referring to, but there's a solution which recommends against using Hyperterminal, so I'd tend to agree with that.
There are a lot of other serial comm applications for Windows....any of them would be better than Hyperterminal. Cheers, - slacker
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page