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

Can i use this line in CCS C compiler.

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







Can i use this line in CCS C compiler.
PostPosted: Tue Mar 02, 2004 6:53 am     Reply with quote

Can i use this line in CCS C compiler.
==============================
unsigned char Key_Schedule[16][48];
==============================
This line is must use in DES Algorithm.
Compiler warning
How i use it? Or i Can't.
Felix Althaus



Joined: 09 Sep 2003
Posts: 67
Location: Winterthur, Switzerland

View user's profile Send private message

PostPosted: Tue Mar 02, 2004 7:04 am     Reply with quote

Hello

I think it should be possible if yo use a PIC which has 16*48 = 768 bytes of ROM empty for the array.

What warning do you get?

Felix
Guest








a
PostPosted: Tue Mar 02, 2004 7:07 am     Reply with quote

Compiler warning.
Not enough RAM for all variables.
mpfj



Joined: 09 Sep 2003
Posts: 95
Location: UK

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Mar 02, 2004 7:07 am     Reply with quote

I don't see why not. Are you claiming that we get an error message ? If so, what ?

Of course, your choice of PIC may be of influence !! You're creating an array that contains 768 bytes of data, and (a) not all PICs have that much RAM and (b) I don't think all PICs support large tables.
Ttelmah
Guest







Re: Can i use this line in CCS C compiler.
PostPosted: Tue Mar 02, 2004 11:07 am     Reply with quote

a wrote:
Can i use this line in CCS C compiler.
==============================
unsigned char Key_Schedule[16][48];
==============================
This line is must use in DES Algorithm.
Compiler warning
How i use it? Or i Can't.

Only in an 18 family chip.
On all the other chips, the maximum array size is limited by the RAM banksize available.

Best Wishes
Guest








PostPosted: Tue Mar 02, 2004 1:31 pm     Reply with quote

Sorry for my fault post. because i rectify this line from
unsigned char Key_Schedule[16][48];
to
unsigned char Key_Schedule[128];
I'am so Sorry For my fault.
Compiler Show :
===============================================
Error[45] C:\Micropro\SourceCode_Picc\DES.c 7 : Subscript out of range
===============================================
And how i solve my problem. Please tell me.

Below is all my sourcecode that i test.
===============================================

#include "C:\Micropro\SourceCode_Picc\DES.h"

#include<string.h>
#define DES_ENCRYPT 1
#define DES_DNCRYPT 0

unsigned char Key_Schedule[16][48]; <--This line i am fault post; Sorry Confused

//static const unsigned char LS[17]={1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1};

//unsigned char PC1[56]={57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4};


void main()
{

setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);

while(1)
{
delay_ms(100);
}

}
===============================================
Guest








a
PostPosted: Tue Mar 02, 2004 1:59 pm     Reply with quote

Now i change from Pic16f877 to Pic18f458 in my sourcecode everything is OK. But if i want use it int Pic16f877. Can i do it . Because i will write this sourcecode in SmartCard (Silvercard -->Pic16f87+24LC64). Thank you for all post . Please tell me if u have any idea. Or Anyone have sourcecode Des Algorithm or other Encryption/Decryption in C language.
I will use Silvercard (Pic16f877+24LC64).
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