Summary of Embedded Knowledge for Computer Level 3 (Calculation Part)

1. Storage Unit Conversion

1 word = 2 half words = 4 bytes = 4*8 bits

TB = 2^10GB

GB = 2^10MB

MB = 2^10KB

KB = 1000Byte

Byte = 8bit

Storage Capacity V = 2^m * n (m is the number of address lines, n is the data line width) unit is bit.

Example 1: 26 address lines and 8 data lines, storage capacity is 512Mb, which is 64MB. Example 2: 20 address lines and 16 data lines, storage capacity 16Mb, which is 2MB.

2. Sound and Image Data Volume Calculation

According to Shannon’s sampling theorem, the sampling period must not be lower than 1/2, therefore the sampling frequency should be at least 2 times the highest frequency of the signal.

1)Data volume of sound files:

1s data volume of sound file (uncompressed)

Sampling frequency(HZ)*Quantization bit depth(bits)*Number of channels=1s data volume(bit)

Example: Please calculate 1 minute of stereo, 16 bit sampling depth, 44.1kHz sampling frequency sound uncompressed data volume?

Summary of Embedded Knowledge for Computer Level 3 (Calculation Part)

2)Data volume calculation of image files:

Image resolution(pixels) * Pixel depth(bits)=Data volume(bit)

Note: Pixel depth: RGB 555 means one pixel, image depth is 15 bits; true color images have RGB three components with pixel bit depth of 8 bits, image depth is 24 bits; 256 brightness levels: pixel depth 8 bits

Example: If uncompressed, how much MB of storage space is needed to store a VGA640*480 pixel array of a 256 color image?

Summary of Embedded Knowledge for Computer Level 3 (Calculation Part)

3)Data volume calculation of video files:

1s data volume of video image file (uncompressed)

Image resolution (pixels)* Color depth (bits)*Frame rate= 1s data volume (bit)

Note: PAL system (25 frames/second), NTSC (30 frames/second)

Example: 2 minutes PAL system 720*576 resolution 24 bit true color digital video uncompressed data volume?

Summary of Embedded Knowledge for Computer Level 3 (Calculation Part)

3. Register Value Calculation

1)Timer input clock frequency=PCLK/(Prescaler + 1/Divider value

2)Count constant=Timing interval/1/Timer input clock frequency)

3)Baud rate factor UBRDIVn=(int)(PCLK/(bps*16))-1;

Example: PCLK is 40MHz, if the baud rate is set to 9200, calculate the baud rate factor UBRDIVn

UBRDIVn=(int)(40000000)/(9200*16)-1=(int)(271.74)-1=270

4)Port control register initialization

Taking port E as an example: port rGPECON bits from 0-15, each bit is represented by two bits: 00 means input, 01 means output, 10 means special use, 11 reserved for use

Data bits rGPEDAT bits from 0-15, each bit is represented by 1 bit: 0 or 1

Example: In the relevant driver program, the statement to initialize GPE0 and GPE1 pin functions is: rGPECON=((rGPECON|0x00000005)&0Xfffffff5)

If GPE0 outputs “1”, it controls the LED to light up, GPE0 outputs “0”, it controls the LED to turn off, then the related driver program statements to control LED to light up and turn off can be: rGPEDAT = rGPEDAT | 0x0001; rGPEDAT = rGPEDAT & 0xFFFE;

4. Bandwidth Calculation

Bandwidth=Bus frequency*Data width/8*Number of transfers per cycle (transfers/bus cycle)

Example: In a certain system, a bus cycle contains 3 clock cycles, each bus cycle can transfer 32 bit data. If the bus clock frequency is 33MHz, what is the bus bandwidth?

Bus bandwidth=(Bus frequency/Number of clock cycles in bus cycle)×(Data volume/Bus cycle), 33/3×32/8=44Mb/s.

Leave a Comment

×