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

Malfunction in working code!!

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



Joined: 04 Nov 2012
Posts: 15

View user's profile Send private message

Malfunction in working code!!
PostPosted: Wed Jun 18, 2014 12:47 am     Reply with quote

Hi,
I am using MPLAB IDE version 8.60 and CCS compiler version 4.119 for programming of microcontroller PIC18F4520. I have working code which I am using since last 1 year. But suddenly I am facing a weird problem from couple of days. When I am reprogramming the micro controller it is not functioning as expected. The same hardware is working fine with earlier controller which were programmed couple of months back.
I am using pickit3 and MCD2 for programming micro-controller. Even changed the PC too. I really don't understand what is going wrong.

I have used MCP3208 ADC for reading 8 different values and display it on 7 segment display.
During testing I found that when I am putting fixed value (anything in between 0 to 4095) manually, everything seems working fine.
But when I am reading from actual ADC, it gives error in functioning.
I have never faced this problem before. I have not changed anything in code. I strongly feel that there is no issue in the code. Can you please tell me what are the other possibilities which may cause such problems.

Couple of months back I have re-installed the compiler because help files are not accessible due to newly installed antivirus.

Please advice.
Thanks
paddy
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Wed Jun 18, 2014 7:05 am     Reply with quote

Hi,

Well, *something* has clearly changed, either in your code, or in your hardware. These systems don't randomly change their operation over time!

The key point is that you need to troubleshoot the problem. As a start, perhaps you can elaborate on this:

Quote:

But when I am reading from actual ADC, it gives error in functioning.


What exactly does this mean? Please show the referenced code, and tell us what the error is!

If I had a dollar for every time I've heard "I have not changed anything in code", and "I strongly feel that there is no issue in the code", then I'd be relaxing on a beach somewhere.... . Very Happy

John
Ttelmah



Joined: 11 Mar 2010
Posts: 19447

View user's profile Send private message

PostPosted: Wed Jun 18, 2014 8:53 am     Reply with quote

Other obvious comment, is that re-installing MPLAB, may well have changed _it's_ settings. By default MPLAB compiles for DEBUG operation. The new install may well be doing this, which can easily prevent code from working.
paddy



Joined: 04 Nov 2012
Posts: 15

View user's profile Send private message

PostPosted: Wed Jun 18, 2014 11:15 pm     Reply with quote

Hi,

Thanks for suggestions!!

I have re installed everything (CCS compiler as well as MPLAB IDE) and it starts working again!! Surprised Surprised

Thanks a lot for your help!!
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Thu Jun 19, 2014 2:25 am     Reply with quote

Still sounds very odd to me. I mean, once your software is compiling without errors it should result in the same binary code every time you compile again. Re-installing the compiler shouldn't have effect on this unless you are doing some fancy stuff in your code that is environment dependent (conditional compiling, etc).

What I understand from your short description is that the program gets its input data from an A/D. When you feed the program manual data it works fine but using the A/D goes wrong?
If so, there can still be many things wrong but A/Ds are known to give many difficult to trace problems because they are connected to the world outside of your small PCB.

The easiest way to find these problems is using an oscilloscope on the A/D input and verify the input signal looks like what you expect. From experience on this forum I can tell you that many problems come from bad filtering or ground layer problems. Without more details this is impossible to pinpoint but it might be something silly as you neighbours air conditioning motor creating noise on the AC line. Or your project has two power supplies and a large ground current is going from one to the other; just disconnecting the ground wall socket or reversing the power plug on one of the power supplies might solve the problem.
These kind of problems will 'suddenly' pop up and disappear again without you changing any thing to your project. These can be maddening to find...
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