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

Bit Array unsupported!

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
John A.D.M



Joined: 30 Mar 2010
Posts: 2

View user's profile Send private message

Bit Array unsupported!
PostPosted: Tue Mar 30, 2010 12:08 pm     Reply with quote

Good Evening,

I am trying to employ a bit array but am experiencing in-compatibility.

Code:


#include <16F887.h>
#fuses NOLVP, RC, NOWDT, NOPROTECT, NOCPD //#fuses HS, NOWDT, NOLVP, BROWNOUT, NOPROTECT, PUT
#use delay(clock=4000000) // 4MHz

boolean bool[4];
int i=0;

void main(void)
{
   /*
   This will create an array of bits, and initialize their values
   */
   int1 flags[]={TRUE, TRUE, TRUE, FALSE, FALSE, FALSE};
   
   /*
   Some usages:
   */
   bool[2] = flags[1];
   
   if ( flags[2] ) { /* do something */ }
   
   flags[i++] = FALSE;
}


This example was adopted from the CCS website.
It does not seem to function on the PIC16F887 and MPLAB Sim report the bit array as an "unsupported structure".
All help is appreciated....

MPLAB Version: 8.46.00.00
CCS PCWH (PCM,PCB, PCH, IDE) 4.087

Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Mar 30, 2010 12:36 pm     Reply with quote

You didn't make a test program that displayed the results, so I made one
for you. I installed vs. 4.087 and ran the program below and got these
results, which are correct:
Quote:

bool[2] = 1
flags[2] = 1
flags[0] = 0


Quote:

MPLAB Sim report the bit array as an "unsupported structure".

CCS and Microchip are two different companies. There is no requirement
that Microchip support CCS constructs, such as bit arrays.

Code:

#include <16F887.h>
#fuses XT, NOLVP, NOWDT, NOPROTECT, NOCPD
#use delay(clock=4000000) 
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

boolean bool[4];
int i=0;

void main(void)
{
   /*
   This will create an array of bits, and initialize their values
   */
   int1 flags[]={TRUE, TRUE, TRUE, FALSE, FALSE, FALSE};
   
   /*
   Some usages:
   */
   bool[2] = flags[1];
   
   printf("bool[2] = %u\r", bool[2]);

 
   if(flags[2])
     {
      /* do something */
      printf("flags[2] = %u\r", flags[2]);
     }
   
   flags[i++] = FALSE;

   printf("flags[0] = %u\r", flags[0]);


  while(1);
}
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