hi raphel,

   the code segment works as you said.
 
thank you
Sunil

Sorry Raphel,
This is the first time i am using this online help for sdcc. that is why i am not specific at all.
 
here is the code segment. here i am using the USART module PIC 16f877.
i want store the values to be send in array. then later i have to send it through USART. 

#include<p16f877.h>
void init()
{
    SPBRG=0x26;
    TXSTA=0x24;
    RCSTA=0x90;
}
void trans(int v)
{
        TXREG=v;
        while(!TRMT);
}
void main()
{
    int val[10],i;
    init();
    for(i=0;i<10;i++)
        val[i]=0x41+i;
    for(i=0;i<10;i++)
        trans(val[i]);
}<
/div>
 
but the assembler(GPASM) gives error like this
 
test.asm:202:Error [113] Symbol not previously defined (_main_val_1_1).
test.asm:204:Error [113] Symbol not previously defined (_main_val_1_1).
test.asm:259:Error [113] Symbol not previously defined (_main_val_1_1).
test.asm:261:Error [113] Symbol not previously defined (_main_val_1_1).
Processor: 16f877
 
can u help me soon
 
Sunil







Jiyo cricket on Yahoo! India cricket

Yahoo! Messenger Mobile Stay in touch with your buddies all the time.
--0-800156673-1143569058=:81659--


Date: Wed, 29 Mar 2006 00:36:50 +0200
From: Raphael Neider
To: sdcc-user@lists.sourceforge.net
Subject: Re: [Sdcc-user] Problem with arryas in PIC14 port
Reply-To: sdcc-user@lists.sourceforge.net

Hi,

> void main()
> {
> int val[10],i;
> for(i=0;i<10;i++)
> val[i]=0x41+i;
> }

[sample code reduced to required parts]

OK, local arrays do not work yet. This is a bug.
As a workaround, you can use a static global array:

static int arr[10];
void main( void )
{
int i; // unsigned int will be more efficient
for (i=0; i<10; i++)
val[i] = 0x41+i;
}

Regards,
Raphael Neider






Jiyo cricket on Yahoo! India cricket
Yahoo! Messenger Mobile Stay in touch with your buddies all the time.