SDCC model large problem

Aug 19, 2006 0 Replies

hi, Currently I am using C8051F345 chip , Silicon IDE (2.72) version and SDCC (2.6). I have problem in declaring global variables more than 171 bytes. The memory model currently used is model large.



I have initialized the controller and the UART . I am just transferring data from the controller in my program. When I increase the array size of a varible more than 171 bytes the code is not working. Is this a problem with SDCC(2.6) version or any problem related with hardware.


I have given the code below , I need some help on this memeory model problem /**********************************************************************************************************************/ //This program is to configure both uarts for variable baud rates /**********************************************************************************************************************/ #include #include "c8051F345.h" #include



xdata unsigned char memChk[171]; // this is the array whose size i want to change



void UART0_ISR (void) interrupt 4 { EA = 0;



if((SCON0 & 0x02) == 2) { SCON0 &= 0xFD; }



if((SCON0 & 0x01) == 1) { SCON0 &= 0xFE;



} EA = 1; }



void Uart0Init() { SCON0 = 0x10; //Receive is Enabled TMOD = 0x20; // Timer 1 is configured in MODE 2 as 8 bit auto reload mode CKCON = 0x01; // The SYSCLK/4 is selected as source for the timer operation TH1 = 0x64; //For the baud rate 9600, at SYSCLK 12MHZ. TR1 = 1; //The timer Run bit is enabled. } void SysInit() { EA = 1; // Enable all interrupts P0SKIP = 0x01; //This is used to skip P0.0 and to use P0.1 as TX1 and P0.2 as RX1 EIE1 = 0x80; // timer 3 enabled EIE2 = 0x02; // UART1 enabled ES0 = 1; //UART0 enabled PCA0MD = 0x00; // watch dog timer disable XBR0 |= 0x01;//UART0 TX0, RX0 routed to Port pins P0.4 and P0.5. XBR1 |= 0x40; //Weak Pull-ups enabled and Crossbar enabled. XBR2 |= 0x01; //UART1 TX1, RX1 routed to Port pins. OSCICN = 0x83; //Internal H-F Oscillator Enabled. and SYSCLK derived from Internal H-F Oscillator divided by 1. OSCICL = 0x1F; //The internal Oscillator is configured to slowest speed which is 12 MHZ in this controller CLKSEL = 0x70; //Internal Oscillator (as determined by the IFCN bits in register OSCICN)



P0MDIN = 0xFF; P0MDOUT = 0xFB; P1MDOUT = 0xFF; P4MDOUT = 0xFF;



}

void main() { SysInit(); Uart0Init(); P0MDIN = 0xFF; P0MDOUT = 0xFB; P1MDOUT = 0xFF; P4MDOUT = 0xFF;



while(1)



{ SBUF0 = 'T'; }



}

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required