We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Dear sir,i use uVision IDE for 8051 ver 6.20c. I used AT89C81. My problem is, i want to store 25 integer value in an array called melody. When i tried to write code in following way, i get error "adress space overflow". -############################
int rit[] = {6, 12, 12, 6, 12, 24, 24, 18, 18, 18, 12, 12, 6, 12, 8, 8, 8, 12, 6, 12, 12, 6};
-############################ Then i used XDATA memory to save my integer values. In order to do that i wrote following code segment instead of previous one. -############################
unsigned long int xdata rit[25] = {6, 12, 12, 6, 12, 24, 24, 18, 18, 18,12, 12, 6, 12, 8, 8, 8, 12, 6, 12,12, 6, 6, 6, 12};
-############################
Compiler seems happy because i got no error*1, moreover as far as i understand those values is stored in XDATA memory.However, when 8051 try to access those value, simulation does not works fine because 8051 could not get those values which is stored in XDATA.
The code below shows how i try to get those integer values.
-############################ int i; for ( i=0; i<24; i++) { int tempo = rit[i]; -############################
Any help would be appreciated. Mert Özbek
*1:
Rebuild target 'Target 1' compiling Sound_Motor.c... linking... Program Size: data=31.0 xdata=200 code=909 creating hex file from "ServoSound"... "ServoSound" - 0 Error(s), 0 Warning(s).
.
why int, why long int?
all values fit in char
Sir there is no external RAM chip. Should i use one of them. I just thought that 8051 has already RAM. Moreover i am new at this field. I am going to try char.
I used AT89C81 Atmel makes no such chip Google can not find such chip
That was my fault, AT89C51 is the correct name sir.
there is no external RAM chip. Should i use one of them if you want to; however that will eat most of your I/O pins. Rather use a different chip
I just thought that 8051 has already RAM. RAM is NOT XRAM read the datasheet for the chip, where do you find XDATA?
did you miss reading "the bible" www.8052.com/.../120112 ?
you did not answer "why int, why long int?"
Erik
First if these are the numbers us unsigned char, it takes less space. Second if the melody does not change store it in ROM
First if these are the numbers us unsigned char, it takes less space. and process a whole lot faster
Clarification Second if the melody does not change store it in ROM Second if THIS melody does not change store it in ROM, if you have multiple melodies, you will still store them in ROM