This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR5972: MSP430FR5972

Part Number: MSP430FR5972
Other Parts Discussed in Thread: MSP430FR5969

I realise most will think this an odd question, but can anyone show me skeleton State Machine code in Assembler?

Many decades ago I designed a telephone answering machine using an 8051 using a State Machine to control everything. It was messy crossing page boundaries (an 8-bit machine) and I think it should be easier using an MSP430. But, since I got a complete remote controlled, voice synthesis answering machine in 1kB of code (8048 version of 8051), using Assembler, I would like to try to see how compact an MSP430 Assembler State Machine could be.

The State Machine comprised nested Master and Sub States and was extremely simple to change and fault-find since all functions could be isolated and tested separately.

Unfortunately, there is a dearth of information on Assembly programming for the MSP430s so if anyone could help, I would appreciate it - mainly, I guess, how do I do conditional Jumps, and are there page limitations on how far I can Jump?

Cheers - John

  • Hi John,

    Thanks for using MSP430 devices. 

    You could follow the MSP430X CPU (CPUX) Introduction guide to create your assembly code on MSP430 device. The instruction could be found in Chapter 4 CPUX of the device User's Guide.

    You could also find the Peripherals Examples codes in assembly, which are examples for MSP430FR5969 (the same CPUX with MSP430FR5972)for your reference.

  • Hello Wei

    Thanks for your prompt reply.

    However, whilst your links went to general examples of MSP430FR58xx code, there was nothing at all regarding State Machines.

    One clarification from my side - my inquiry was for MSP430 Assembler code in general, not specifically for the MSP430FR5972. Unfortunately, I couldn't work out how to just enter MSP430 in the title field of my post - the system demanded a specific micro, sorry if that confused matters.

    So, it is the State Machine aspect that I am specifically interested in, implemented in Assembler on any MSP430 device. I guess I am looking for how to implement a Case or Switch statement in Assembler, since that is the heart of a State Machine.

    I look forward to more comments.

    Thank you - John

  • Hi John,

    It is a general question for how to "implement switch case in assembly", which you could get a lot of answers on Google.com. I would suggest you go through the examples and then you could porting the code by MSP430 CPUX instructions, which could be similar with the instructions in the examples.

    Another way to learn the assembly code for switch...case statement is that you could use the disassembly tool in CCS for a running C source project with switch...case. Clicking the View-->Disassembly on CCS menu could show you the disassembly code for your C source code.

**Attention** This is a public forum