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 support@ccsinfo.com

Microchip Stack CCS Version (Telnet Function)

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



Joined: 14 Sep 2003
Posts: 96
Location: Toronto, Ontario, Canada

View user's profile Send private message

Microchip Stack CCS Version (Telnet Function)
PostPosted: Mon Jun 29, 2015 3:23 pm     Reply with quote

I am using the latest version of the compiler 5.048
18F97j60 Dev Board.

I have compiled sample program that uses the Microchip stack with CCS modifications.

The Telnet test code is working and I am connecting and logging into dev. board. The problem is the screen is showing invalid characters. This is a sample of the code that is compiled to show.

Code:

// Demo title string
static ROM BYTE strTitle[]         = "\x1b[2J"   // 2J is clear screen
                             "Microchip Telnet Server 1.1\r\n"   // 0m is clear all attributes
                             "(for this demo, type 'admin' for the login and 'microchip' for the password.)\r\n"
                               "Login: ";
// Demo password
static ROM BYTE strPassword[]      = "Password: \xff\xfd\x2d";   // DO Suppress Local Echo (stop telnet client from printing typed characters)
// Access denied message
static ROM BYTE strAccessDenied[]   = "\r\nAccess denied\r\n\r\n";
// Successful authentication message
static ROM BYTE strAuthenticated[]   = "\r\nLogged in successfully\r\n\r\n"
                             "\r\nPress 'q' to quit\r\n";
// Demo output string
static ROM BYTE strDisplay[]      = "\r\nSNTP Time:    (disabled)"
                             "\r\nAnalog:             1023"
                             "\r\nButtons:         3 2 1 0"
                             "\r\nLEDs:    7 6 5 4 3 2 1 0";
// String with extra spaces, for Demo
static ROM BYTE strSpaces[]         = "          ";
// Demo disconnection message
static ROM BYTE strGoodBye[]      = "\r\n\r\nGoodbye!\r\n";


The Telnet screen below as per code above.

How can I paste an image in this post. I have seen it done in other postings. I put a link to dropbox to show the telnet screen.

https://photos-1.dropbox.com/t/2/AAAl4tD5om92Q93l3f8XdeV1VABLsVOeYBrU5AT6jH__gw/12/61484629/png/32x32/1/1435640400/0/2/Telnet.PNG/CNXcqB0gASACIAMgBCAFIAYgBygBKAI/mph2p-f6MCPBhc6PakXjsLX77c1BX6Vy1RoNn81xcjw?size=1600x1200&size_mode=2

It appears that the strings are not saved in the ROM Byte Variable declaration.

Any Ideas?? Question

Thanks for any help.

Jerry[url]
Ttelmah



Joined: 11 Mar 2010
Posts: 19467

View user's profile Send private message

PostPosted: Tue Jun 30, 2015 12:19 am     Reply with quote

Does your code have #DEVICE PASS_STRINGS=IN_RAM?.

It's difficult to know without seeing the environment in which this code is actually being used, but generally CCS 'ROM' or 'const' statements put data genuinely in ROM. Microchip instead treats this data as 'unchangeable' but stored in RAM. The PASS_STRINGS setup, makes CCS behave _as if_ the data was stored in RAM, automatically passing it through a RAM buffer as needed.

You can't paste images into the forum, but if you have an external link, and include it in 'Img' tags (button at the top of the posting page), then if it is a direct link to the picture, the picture gets displayed inline.
Jerry I



Joined: 14 Sep 2003
Posts: 96
Location: Toronto, Ontario, Canada

View user's profile Send private message

PostPosted: Tue Jun 30, 2015 9:00 pm     Reply with quote

Thanks Ttelmah for your suggestion.

I found that storage in ROM is not the problem, I used printf to display the strings as shown and it displays fine.

printf("%s\r\n", strDisplay);

I now have to check the function that output the Telnet string.

Thanks for help.

Jerry
Ttelmah



Joined: 11 Mar 2010
Posts: 19467

View user's profile Send private message

PostPosted: Wed Jul 01, 2015 1:01 am     Reply with quote

Beware.

Some of the CCS functions are effectively 'overloaded', so they will accept things that other functions don't.
I'd be verifying with a bit of code that actually accesses the variables exactly the way they are used in the Telnet functions, before being 'sure' the declarations are working as expected.
Just a warning (this has caught me in the past...).
Jerry I



Joined: 14 Sep 2003
Posts: 96
Location: Toronto, Ontario, Canada

View user's profile Send private message

PostPosted: Wed Jul 01, 2015 5:21 pm     Reply with quote

Hi Again

I have found that of the any ROM BYTE declaration as below
greater than 16 bytes is corrupted.

Prints fine if I use printf.

Code:

static ROM BYTE strAuthenticated[]   = "\r\nLogged in successfully\r\n\r\n"
                                                         "\r\nPress 'q' to quit\r\n";

static ROM BYTE strTitle[]         =  "Login: ";

static ROM BYTE strTitle[]         =  "Login:Login:Login:Login: ";


In the telnet screen the first example of the word 'Login: ' Prints fine
'Login: '

The second example of the repeated login string prints
'Login:Login:Logi '

Any more ideas?.

Thanks for any help.

Jerry
Ttelmah



Joined: 11 Mar 2010
Posts: 19467

View user's profile Send private message

PostPosted: Thu Jul 02, 2015 1:22 am     Reply with quote

I'd change the declarations to be CCS compatible.

Just use 'const char', instead of 'static ROM BYTE', and ensure you have the pass strings in RAM option enabled. The const strings should then work just as if they are declared in RAM, except for being 'constant'.
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