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

List index out of bounds [Solved]

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



Joined: 23 Mar 2017
Posts: 27

View user's profile Send private message

List index out of bounds [Solved]
PostPosted: Fri Mar 24, 2017 10:37 am     Reply with quote

I get this message when I try to add my struct variable to the watch window.

I'm trying to look at anything in the sample_data struct. I've tried sample_data and sample_data.temp. The watch window doesn't like my struct but the compiler sees no problem.

Thanks in advance.

I'm using the PIC16F1825 Development Kit.

My code is as follows:

Code:
#include <ADC.h>
#define ANALOG PIN_A4

struct data_struct
{
   unsigned int16 current;
   unsigned int16 max_current;
   unsigned int16 temp;
   unsigned int16 max_temp;
} sample_data;



void main()
{

   setup_adc_ports(sAN3);
   setup_adc(ADC_CLOCK_INTERNAL);
   
   while(TRUE)
   {
// Will change channels in the final product. 
      set_adc_channel(3);
      delay_ms (1);
      sample_data.temp = read_adc();
      delay_ms (1);
      set_adc_channel(3);
      delay_ms (1);
      sample_data.current = read_adc();
     
      if (sample_data.temp > sample_data.max_temp)
      {
         sample_data.max_temp = sample_data.temp;
      }

      if (sample_data.current > sample_data.max_current)
      {
         sample_data.max_current = sample_data.current;
      }
      //TODO: User Code
   }

}
Aileyus



Joined: 23 Mar 2017
Posts: 27

View user's profile Send private message

PostPosted: Fri Mar 24, 2017 12:19 pm     Reply with quote

Never mind. I found it. It turned out to be some hangup between Windows 10 and/or CCS Compiler. I shut down and restarted and I can now use the watch window.
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