Soumit 0 Posted January 23, 2018 Share Posted January 23, 2018 Hello, I wrote a code for calculating VCO frequency and divider values for a PLL from the given output frequencies. For now I am printing the values in the console to debug my code and it is working properly. But now I want to move the values from stack to registers available in MSP430f5529. In the image below you can see that freq_VCO value is stored in stack memory location 0x04382. How do I move this value in one of the registers? Pleas help! Quote Link to post Share on other sites
NurseBob 111 Posted January 23, 2018 Share Posted January 23, 2018 The '5529 is a 16-bit device, with 16-bit registers, so it's not possible to use a single register to store a 64-bit value. Perhaps storing the address of the 64-bit value? But I don't see any real rationale for doing that... Others, far smarter than I, may offer better suggestions. Quote Link to post Share on other sites
Soumit 0 Posted January 24, 2018 Author Share Posted January 24, 2018 Thank you for your reply. Perhaps yes, it is not possible to store a 64-bit value in 1 register. But I can store in split registers i guess. I just don't know how to do such a thing. If any ideas please help. Quote Link to post Share on other sites
agaelema 39 Posted January 24, 2018 Share Posted January 24, 2018 You can use a pointer of uint16_t to receive the address of the 64bit variable. After, it's just read the value inside the address pointed by the pointer and increment it, repeating the process to read all addresses. Soumit 1 Quote Link to post Share on other sites
jazz 209 Posted January 24, 2018 Share Posted January 24, 2018 22 hours ago, NurseBob said: The '5529 is a 16-bit device, with 16-bit registers, so it's not possible to use a single register to store a 64-bit value. Perhaps storing the address of the 64-bit value? But I don't see any real rationale for doing that... Others, far smarter than I, may offer better suggestions. No, 5529 is not 16-bit device. It is with CPUvX2 that have 20-bit registers and 20-bit assembler instructions. Some of this instructions (so called address instructions) can be executed in one cycle. BTW, also, all FRAM devices are with 20-bit registers and 20-bit assembler instructions. Quote Link to post Share on other sites
NurseBob 111 Posted January 28, 2018 Share Posted January 28, 2018 > No, 5529 is not 16-bit device. I stand corrected. Though there still no way to store a 64-bit value in a single register, as the OP seemed to desire. FWIW, When I look at TI's marketing for the device: "16-Bit Ultra-Low-Power Microcontroller" Quote Link to post Share on other sites
agaelema 39 Posted January 28, 2018 Share Posted January 28, 2018 Although the MSP430X has 20 bit address capability, it still a 16bit uC because data bus still 16-bit. The increase of bits in address bus allow to access more memory, from 64kB to 1MB. http://ninova.itu.edu.tr/tr/dersler/bilgisayar-bilisim-fakultesi/4142/blg-351/ekkaynaklar?g867878 Quote Link to post Share on other sites
terjeio 134 Posted January 29, 2018 Share Posted January 29, 2018 From assembler it can be seen as 16 or 20bit depending on the instruction set used - MSP430 or MSP430X, it has a 16/20bit ALU. I would guess a C-compiler will mix 16/20bit style instructions for speed if memory requirement is > 64K. The OP never mentioned if using C or assembler and what the value is needed for - printing? a calculation? store somewhere else (in a "variable")?. To load a 64bit value from consecutive words in memory into registers from assembler code register indirect adressing mode with auto increment is the easiest. Move the stack pointer into a register and add (or subtract?) the offset needed to reach the data and use it as the base (assuming the data lives in a stack frame with a fixed offset from the current stack pointer value). From C code use the * dereference operator to read from an address into a variable. It may be possible to read the data into separate registers from C as 16 bit values, but then you are at the mercy of the compiler. I have not looked into how to get at the stack pointer from C, doable? Use a global variable instead of picking it off the stack? A final note: I do not understand why loading into register(s) is required... Quote Link to post Share on other sites
Soumit 0 Posted January 30, 2018 Author Share Posted January 30, 2018 Thank you all for your responses!! @ Terjeio, I am using C and the value I need to store in split registers so that when I connect a synthesizer I can feed the value to it for further actions. I am not sure if the value is stored in stack memory will I be able to retrieve it later as the compiler stores at random address?? Therefore i thought of storing it in registers of the MSP430 so that i can access the value for later purpose. As #Agaelema mentioned I used a pointer to receive the address of the 64bit variable and increment it to read all the address. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.