View previous topic :: View next topic |
Author |
Message |
mxie1234
Joined: 03 Nov 2017 Posts: 10
|
PCWHD v5.073, string format under "Watches" tab |
Posted: Tue Jul 24, 2018 7:19 pm |
|
|
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
|
|
Posted: Wed Jul 25, 2018 2:00 am |
|
|
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
|
|
Posted: Thu Jul 26, 2018 12:57 am |
|
|
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
|
|
Posted: Thu Jul 26, 2018 1:32 am |
|
|
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
|
|
Posted: Thu Jul 26, 2018 12:03 pm |
|
|
I am using PIC24 now. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Thu Jul 26, 2018 12:07 pm |
|
|
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
|
|
Posted: Thu Jul 26, 2018 12:42 pm |
|
|
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
|
|
Posted: Thu Jul 26, 2018 12:52 pm |
|
|
Explains the problem. |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1909
|
|
Posted: Thu Jul 26, 2018 5:49 pm |
|
|
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
|
|
Posted: Thu Jul 26, 2018 9:51 pm |
|
|
Noticed that, "unsigned" was also added for all "int8".
Thanks. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Fri Jul 27, 2018 1:14 am |
|
|
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. |
|
|
|