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

long int test

 
Post new topic   Reply to topic    CCS Forum Index -> CCS ICD / Mach X / Load-n-Go
View previous topic :: View next topic  
Author Message
david
Guest







long int test
PostPosted: Mon Nov 01, 2004 9:38 am     Reply with quote

When I do a test like

if(x == 0x3456)

where x is an unsigned long int I find this test is true when x == 0x0056.

The upper byte is a don't care. How do I do the test such that the entire value is tested?
rnielsen



Joined: 23 Sep 2003
Posts: 846
Location: Utah

View user's profile Send private message

PostPosted: Mon Nov 01, 2004 9:58 am     Reply with quote

Well, if you are declaring x as

int x;

then x will be able to hold a value of 0 - 255. The declaration 'int' is the same as declaring int8, or an eight bit variable. By doing this:

int16 x;

this will make it an unsigned 16 bit integer that can now hold a value of 0 - 65535. These default to unsigned variables. If you want to make it so you can store negative numbers then you need to declare it like;

signed int8 x;
signed int16 x;

See if that will make a difference.

Ronald
david
Guest







problem was a bug
PostPosted: Tue Nov 02, 2004 2:13 pm     Reply with quote

I've tried everything to typecast and make this if statement test the entire 16 bit value to no avail. The problem appears only when I run the design in the mplab simulator. When I run the design in hardware it works fine. I expect an hour delay and the hardware does it. In the simulator the lower 8 bits are tested only and I get a 14 minute delay. I had another problem with timer0 which showed up in the simulator but not in the hardware. Now I'm concerned that CCS and the mplab simulator is full of bugs and can't be trusted. I like to do developement on a laptop and run the simulator. I really like what CCS has to offer but I may be forced to go with C18. Any opinions from the experienced please? Thanks,
drh



Joined: 12 Jul 2004
Posts: 189
Location: Hemet, California USA

View user's profile Send private message

PostPosted: Tue Nov 02, 2004 4:05 pm     Reply with quote

Get on the Microchip forum and post this problem.
_________________
David
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Tue Nov 02, 2004 6:58 pm     Reply with quote

Look at the lst file and see what is going on. Also, step through the code to gain more insight.
david
Guest







mplab is the problem
PostPosted: Wed Nov 03, 2004 2:01 pm     Reply with quote

just talked with a C18 developer and was told he sees the same bug so MPLAB is the culprit.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> CCS ICD / Mach X / Load-n-Go 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