Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 62446

Forum Post: RE: Default I/O setting on unprogrammed MSP430

$
0
0
"Yes you are right that clarification of "Reset" in register initial state tables will not hurt definitely." Well, if there is no dynamically attained value, the number should be give. If a register is initialized to 0x00, there is no way of misunderstanding this. However, the semantical section of my brain aches when someone 'resets' bits to actually being set, so for me it is clear that reset is the opposite of set when it comes to bits or switches or other binary things. Same for 'setting' bits to 0. The advantage of writing 'reset' is that the one reigster that is initialized to a non-zero value (P2SEL) sticks out. " such a figure would make clear that the IO port registers are 8-bit bytes, and some are at odd addresses, sharing a word with another byte register." Actually, P1 and P2 registers join to PA registers (P3+P4=PB etc.) on some families. However, on 1x family and vast parts of 2x family (if not all), the port IO peripheral registers are 8 bit access only (and P1 and P2 registers are not interleaved), and using 16bit instructions to access two with one instruction will fail. So depending on the actual MSP, "8 bit", "odd address" and "sharing a word" are three independent things. (on 5x family, you'll find that the DMA controller registers are 16bit access only: you cannot access the high.byte with a byte isntruction, and writing to the low byte -or high byte, since the lowest address bit is a don't care- with a byte instruciton will write to the low byte and clear the high byte. "Thus bad code could write a word to some registers and write a register that was not intended" Well, bad code can do anything :) It's the responsibility of the coder to write code that does the right things. After all, there is no redundancy in the bits and addresses. That's why clearing the UCRXIFG bit in the UCA0IE register won't throw an error - but also won't do what was intended. :)

Viewing all articles
Browse latest Browse all 62446

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>