Dear Sirs! I would like to observe data in Memory window. For example this line of code was build from the compiler: 000002F4 F2F50AA2 MOV R5,DPP2:0x220A Where content of DPP2 is '3'. Does DPP2:0x220A means ( 3 <<14) | 0x220A ? Result would be 0xE20A ?? F2F50AA2 says to me the Address 0xA20A will be read...(0x220A - 0x8000 = 0xA20A???) in the memory window of the Debugger the contents of these addresses are just 0x00!? How can I take a look at the right addresses? Please write an answer to my Question! hannes
Real address is 10 bit DPP2 value + 14 bit offset.
DPP2=0x03 OFFSET=0x220A 1100'0000'00 10'0010'0000'1010 that results in 1100'0000'0010'0010'0000'1010 3 0 ' 2 2 0 A h = 30'220Ah
Thanks! ...but can You explain why the address in disassembly window (also in HEX-File) is 0xA20A (..0AA2..)?? hannes
Hi Stefan, I'm sorry, but there is something wrong in your calculations: Hannes said Does DPP2:0x220A means ( 3 <<14) | 0x220A ? Result would be 0xE20A ?? and Where content of DPP2 is 3 This is correct, address is 0xE20A. In fact the correct formula would be ((DPP2 & 0x03FF) << 14) | (0x220A & 0x3FFF) you will obtain 0x30220A only if you set DDP2 to 0x00C0. Ciao Bruno
Bruno, you are absolut right. If I said 10 bit value, I did the wrong shifting. Hannes, Sorry for confusion, that was my mistake. PageOffset(14bit).....xx10 0010 0000 1010 DPP2 = 10b.............1010 0010 0000 1010 (10bit) DPP2value=3h =>.....xxxx xx00 0000 0011 Address: 00 0000 0011 xx xxxx xxxx xxxx xx .xxxx xx10 10 0010 0000 1010 ------------------------------- 00 0000 0011 10 0010 0000 1010 = 00'E20Ah Stefan
Hi Bruno, that's me again. Now I am confused. Assuming the DPP2 value is 5=101b. PageOffset from Hannes is 0x220Ah. For DPP2= 10b I got with my calculating:
00 0000 0101 00 0000 0000 0000 00 0000 0010 10 0010 0000 1010 --------------------------------------- 00 0000 0111 10 0010 0000 1010 = 01'E20Ah
00 0000 0101 00 0000 0000 0000 00 0000 0000 10 0010 0000 1010 because mask --------------------------------------- 00 0000 0101 10 0010 0000 1010 = 01'620Ah
Hello Stefan, the C167 hardware compose the 24 bit address using the formula I gave you, but this does not mean that it really makes the shift and mask operations written into the formula; operations are just done into a dedicated part of the C167 hardware. Bits 14 and 15 of the PageOffset just select the DPPx register to be used to compose the full 24 bit address. Imagine the C167 hardware that composes the 24 bit address: it should be very similar to this schematic diagram
4 to 1 Multiplexer +-------+ DPP0 ---> | | | DPP1 ---> \ | | o-- >----+ DPP2 ---> | | | | | DPP3 ---> | | +---^---+ | | | | | 2 bit selector | +--> Address bits 14..24 Bits 14 and 15 >--+ +--> Address bits 0.13 from PageOffset | | | Bits 0..13 from PageOffset >-+
<--DPPx----> <---PageOffset--> 00 0000 0101 00 0000 0000 0000 00 0000 0000 10 0010 0000 1010 --------------------------------------- 00 0000 0101 10 0010 0000 1010 = 01'620Ah
Hi Bruno, hi Hannes, I am shamed, but enlighted. Bruno, no doubt anymore. It is all correct. I read with your explanation the users manual very carefully again. (I misinterpreted the fig.4-14 in the systems users manual XC167CI V1.1 2002 page 4-34 ..... page 4-36, where bits 14 and 15 are shown separated) Correct formula by Bruno is ((DPP2 & 0x03FF) << 14) | (0x220A & 0x3FFF) ;-) BTW: Thanks for invest time and make a nice graphic, which make it clear to me. Stefan
((DPP2 & 0x03FF) << 14) | (0x220A & 0x3FFF)
View all questions in Keil forum