I have an exercice that I couldn't resolve it, I have 3 memory range :
First @ Last @
range1: FD00 0000 to FDFF FFFF
range2 : D000 0000 to DFFF FFFF
range3 : FA00 0000 to FBFF FFFF
the question is :give the size of the memory for each range (Mega byte)?
what I know is that I should calculate size of the range = last address - first address so the result for the first range is : 00FF FFFF . Is this right? then what should I do? I have searched on the internet I didn't found an example
Please help
Step 1: calculate the length of the address in bits (n bits) Step 2: calculate the number of memory locations 2^n(bits) Step 3: take the number of memory locations and multiply it by the Byte size of the memory cells.
The atmega16 data sheet says that it has 16KB on-chip flash program memory, but the memory map for flash memory ranges from 0x0000 to 0x1FFF(8192, i.e, 8KB) only, which gives a range of only 8KB flash memory. Also the program counter is only 13 bits wide, which can access only 8KB of memory.
Press Ctrl + Shift + Esc to launch Task Manager. Or, right-click the Taskbar and select Task Manager. Select the Performance tab and click Memory in the left panel. The Memory window lets you see your current RAM usage, check RAM speed, and view other memory hardware specifications.
Each address identifies a single byte (eight bits) of storage. Data larger than a single byte may be stored in a sequence of consecutive addresses.
In your example for Range 1, you are correct. That is the size of the memory, stated in hexidecimal, in bytes.
You may gain the most insight by first converting 00FF FFFF to a decimal number, then converting that number of bytes into megabytes.
To convert from bytes to megabytes use the relationship
1 MB = 1 Megabyte = 1024 * 1 KB = 1,048,576 bytes.
There are tons of online Hex to Decimal converters. The calculator built in to Windows can also do the conversion.
For the other ranges, you again want to do subtraction to determine the size of the range, and then apply the steps above, e.g.
FBFF FFFF
-
FA00 0000
---------
01FF FFFF
Having gone through those steps to better grasp what is happening, the following relationship will allow you to answer such questions faster:
0010 0000 = 1,048,576
So 1MB is the same as 0010 0000 (sometimes called 0x100000).
Simple analogy, what is amount range (address) from 0 - 9? The answer is 10, not 9 because range/address 0 is counted.
So, Capacity = Last Address - First Address + 1.
Capacity for range1: FD00 0000 to FDFF FFFF will be FDFF FFFF - FD00 000 + 1 = FF FFFF + 1 = 100 0000 in hex Or 16777216 in dec (16MB).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With