Вы находитесь на странице: 1из 7

EXPERIMENT NUMBER-6

FLOWCODE for PIC Microcontroller AIM: 1. To learn how to use flow code for PIC Microcontroller. 2. To learn how to construct flow chart for PIC microcontroller. 3. To program PIC microcontroller 16F84 by using flowcode. APPARATUS AND MATERIAL: PC with flowcode, PIC 16F84 development board, LED etc. THEORY: A flowchart is a type of diagram that represents an algorithm or process, showing the steps as boxes of various kinds, and their order by connecting them with arrows. This diagrammatic representation solution to a given problem. Flowcharts are used in designing and documenting complex processes or programs. A typical flowchart from older basic computer science textbooks may have the following kinds of symbols: 1. Start and end symbols: Represented as circles, ovals or rounded (fillet) rectangles, usually containing the word "Start" or "End". 2. Arrows: Showing "flow of control". An arrow coming from one symbol and ending at another symbol represents that control passes to the symbol the arrow points to. The line for the arrow can be solid or dashed. The meaning of the arrow with dashed line may differ from one flowchart to another and can be defined in the legend. 3. Generic processing steps: Represented as rectangles. Examples: "Add 1 to X"; "replace identified part"; "save changes" or similar. 4. Subroutines: Represented as rectangles with double-struck vertical edges; these are used to show complex processing steps which may be detailed in a separate flowchart. 5. Input/Output: Represented as a parallelogram. Examples: Get X from the user; display X. 6. Prepare conditional: Represented as a hexagon. Shows operations which have no effect other than preparing a value for a subsequent conditional or decision step (see below).

7. Conditional or decision: Represented as a diamond (rhombus) showing where a decision is necessary, commonly a Yes/No question or True/False test. The conditional symbol is peculiar in that it has two arrows coming out of it, usually from the bottom point and right point, one corresponding to Yes or True, and one corresponding to No or False. More than two arrows can be used, but this is normally a clear indicator that a complex decision is being taken, in which case it may need to be broken-down further or replaced with "pre-defined process" symbol. 8. Junction symbol: Generally represented with a black blob, showing where multiple control flows converge in a single exit flow. A junction symbol will have more than one arrow coming into it, but only one going out. In simple cases, one may simply have an arrow point to another arrow instead. These are useful to represent an iterative process called a loop. A loop may, for example, consist of a connector where control first enters, processing steps, a conditional with one arrow exiting the loop, and one going back to the connector. For additional clarity, wherever two lines accidentally cross in the drawing, one of them may be drawn with a small semicircle over the other, showing that no junction is intended. 9. Labeled connectors: Represented by an identifying label inside a circle. Labeled connectors are used in complex or multi-sheet diagrams to substitute for arrows. For each label, the "outflow" connector must always be unique, but there may be any number of "inflow" connectors. In this case, a junction in control flow is implied. FLOWCODE: Flowcode allows us to create simple microcontroller applications by dragging and dropping icons on to a flowchart to create simple programs. These programs can control external devices attached to the microcontroller such as LED's, LCD displays etc. Once the flowchart has been designed, its behaviour can be simulated in Flowcode before the flowchart is compiled, assembled and transferred to a Chip. To achieve this using Flowcode, one has to perform the following steps: 1. Create a new flowchart, specifying the microcontroller that you wish to target. 2. Drag and drop icons from the toolbar onto the flowchart to program the application. 3. Add external devices by clicking on the buttons in the components toolbar, editing their properties, how they are connected to the microcontroller and call macros within the device. 4. Run the simulation to check that the application behaves as expected. 5. Transfer the application to the microcontroller by compiling the flowchart to C, then to assembler code and finally to object code.

CONSTRUCTING A FLOW CHART USING FLOWCODE:


1. Start a new project by selecting FILE...NEW. You will be presented with a choice of

microcontrollers that you can develop programs for. Choose the 16F84 from the list.

2. To add a variable, move your cursor to the Project explorer toolbar and right click on

Variables and then click on Add New. The name and initial value can be given to this variable.

3. To output the data at any of the ports, add the output block in the flowchart. Move your

cursor over Icon toolbar and drag the output icon to the chart and add to the point where you want to.

4. Similarly to add inputs, go to icon toolbar and add input block. 5. Loop, Calculation and Interrupt icon can also be added to the flow chart from Icon

toolbar. 6. LEDs, LCD, Graphical LCDs, etc. can also be added at the output by using Component toolbox.

7. The chip area shows the port conditions of the chip selected i.e. PIC 16F84A

In PIC 16F84A, Port A is 5-bit (RA4 is open drain) and port B is 8-bit.

USING FLOWCODE TO PROGRAM PIC: FLOWCODE has the facility to compile the flowchart into either .C file or .HEX file. .HEX file can be burned directly into chip using E-blocks in FLOWCODE software or Proteus ISIS simulator. FLOWCHARTS: 1. Flow chart for 4 bit AND, OR, EX-OR, Addition, Subtraction and Multiplication.

2. Flow chart to flash 4 LEDs connected to input output port.

3. Flow chart to implement 24 Hrs Digital clock

Output on Proteus:

CONCLUSION: Thus we have studied the construction of flowchart for PIC and programming using FLOWCODE.

Вам также может понравиться