Monday, January 3, 2011

Using MPLAB IDE to draw Flowchart

One of the usual task given to me when I was an undergraduate student is to transform the program into a flowchart. According to my supervisor, the main reason for flowchart is so that other people can refer to the flowchart and make a program using other language. Also it makes non-technical people understand what we are doing.

The key to retrieve a flowchart from a given program is to recognize the flow and the pattern.

Okay, now let say we have a program written in assembly languange. This is how to get a rough idea of the program flow.
  1. To get the flow, trace the program step by step. Usually any simulator or IDE will show the next line to be executed. In microcontroller case, it represent program counter (PC). Trace it a few times until the tracing reach the end of the program.
  2. Try to map the flow with any IF.. ELSE , WHILE..DO , DO..WHILE structure. Usually a program will be in the combination of the program structure. In this case take the outer loop first.
  3. To see the process and result, try to monitor any variable,memory location and register used in the program.
  4. Try to interpret the program block by block instead of line by line during tracing.
  5. Draw your flowchart based on your understanding of the program.
When we are drawing a flowchart try to be as human as possible. Use short word , or you can use mathematical equation.

I think that's all about drawing flowchart.

1 comment: