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

PCWHD v5.073, string format under "Watches" tab

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



Joined: 03 Nov 2017
Posts: 10

View user's profile Send private message

PCWHD v5.073, string format under "Watches" tab
PostPosted: Tue Jul 24, 2018 7:19 pm     Reply with quote

Hi,
Just found the string and char format displays are not working in PCWHD v5.073 "Watches" tab. I didn't see this issue in previous PCWHD version.

Anyone saw the same issue?

Thanks
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Wed Jul 25, 2018 2:00 am     Reply with quote

Seems to be working for me.
Just went back to 5.073 to see if there was an issue.
However I did have problems in the last few weeks, not caused by the CCS update, but the latest Windows update to 1803. I had to close all the tabs in the debug window and re-open them all before they started to work correctly. Wonder if you are seeing the same issue?. It was causing things to display erratically with memory cells not refreshing, and values not being shown correctly.
5.073, came out last year, so I think there would have been some more comments here if something so fundamental had problems.
mxie1234



Joined: 03 Nov 2017
Posts: 10

View user's profile Send private message

PostPosted: Thu Jul 26, 2018 12:57 am     Reply with quote

Hi, Ttelmah,

I found the variable type matters. If defined as "char", seems OK to be displayed as char or string. But if defined as "int", it won't be converted to char or string to show correctly even if the value is in the ASCII range.

I used old version before, any type can be displayed as char or string as long as the value is making sense.

Can you confirm this ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Thu Jul 26, 2018 1:32 am     Reply with quote

What processor type are you using?. (PIC16, 18, 24, 30 etc..). Obviously under PCD, an 'int' is 16bit so it won't work. I tend now to be working with the larger PIC's quite often now so have got into the habit now of using char's, or explicit int8's. I'll have to dig around in my bits bin to find a PIC18 board to try this on.
mxie1234



Joined: 03 Nov 2017
Posts: 10

View user's profile Send private message

PostPosted: Thu Jul 26, 2018 12:03 pm     Reply with quote

I am using PIC24 now.
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Thu Jul 26, 2018 12:07 pm     Reply with quote

An 'int' in PCD, is a signed int16. No wonder it won't work if you are storing strings into an array formatted like this. An array for normal text characters needs to be declared as char, unsigned int8, or byte.
mxie1234



Joined: 03 Nov 2017
Posts: 10

View user's profile Send private message

PostPosted: Thu Jul 26, 2018 12:42 pm     Reply with quote

Hi,
You are right.
I am converting a PIC18 code to PIC24. "int" gets lots of trouble. I have to replace all "int" with "int8" to make the data representation correct.
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Thu Jul 26, 2018 12:52 pm     Reply with quote

Explains the problem. Smile
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Thu Jul 26, 2018 5:49 pm     Reply with quote

mxie1234 wrote:
Hi,
You are right.
I am converting a PIC18 code to PIC24. "int" gets lots of trouble. I have to replace all "int" with "int8" to make the data representation correct.


Afraid you're only half done. With the PCD compiler only, all types are signed by default. With every other version of the compiler, all types are unsigned by default.
mxie1234



Joined: 03 Nov 2017
Posts: 10

View user's profile Send private message

PostPosted: Thu Jul 26, 2018 9:51 pm     Reply with quote

Noticed that, "unsigned" was also added for all "int8".
Thanks.
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Fri Jul 27, 2018 1:14 am     Reply with quote

The 'reason' here is fairly fundamental.

Historically (in K&R) the default 'int' was meant to be the native standard basic maths type supported by the processor core. ANSI changed this and instead went 16bit signed as the default (a pity in terms of optimising performance, but a 'good thing' in terms of standardisation). On the PIC 16/18, CCS (as they predated ANSI), kept to the original K&R usage, but later offered an 'ANSI' setting. On the PIC24/30/33, the processor core works with 16bit values as it's default, having single cycle signed int16 addition, multiplication and division, and with the basic memory fetch being of a 16bit word, so this was made the default.
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