The deadline for handing in your 4 class projects is 05/05/11
This date is after the Easter holidays so I suggest that you do as much as possible before the holidays so that you can come back and ask me questions. We will use the work you do here next year as one of your practical NABS. The more work and effort you put into this now, the easier you will pass this unit. It is also very imporant that you can problem solve following these steps so that you are properly prepared for any question in the exam.
I feel that some people are a little confused by what you need to include so hopefully this more thorough guide will help. I am going to use question 14 from the homework as my example.
Project Brief:
This is the question that you are trying to answer. You should copy it out so that I know which project you are doing and so that you can start thinking about it properly.
The layout of a new restaurant is quite spread out, with the kitchen quite far away from the restaurant. Design a system which could transport food quickly along a track between the two rooms.
System Diagram:
This is to help you work out the inputs and outputs that you are going to need to solve your project brief. Remember that if you use a motor, you may need to know where the output is i.e. a barrier lifting, or curtains closing, so you will need to add some sensors in. As these feed information into the microprocessor, they are also inputs.
In my example the buggy needs to stop when it gets to each location so I need two sensors. I also need another two buttons to "call" the buggy between rooms.
Flow Chart:
The flowchart is the planning stage to the program. This is where you work out the sequence you want to test inputs and switch on/off outputs. It should be completely in English, so use the terminology you have used in the system diagram, or words that explain what you are controlling easily.
Input/Output Table - Pin Diagram:
This is to decide which inputs and outputs you would like to connect to which pins. Remember that if you would like to use input switches you have to use 0,1,2 or 3 as these are the connections on the STAMP board. If you are using a motor which has to go both forwards and backwards, you need to use either pins 4&5 or 6&7.
PBASIC Program:
Now you have decided which pins you are going to use for which purpose, and you have decided on the sequence that you need to test inputs and switch on/off outputs in (flowchart). You need to convert each box of your flowchart into the PBASIC command required. You may find it useful to note in pencil next to each box of your flowchart the PBASIC command before writing the program completely.
init: let dirs = %11110000 'sets pins 7-4 as outputs
main: if pin1 = 0 then main 'waits for the restaurant call button to be pressed
rest: high 6 'switch on motor forwards
if pin3 = 0 then rest 'wait until buggy reaches the restaurant
low 6 'switch off motor
kit: if pin0 = 0 then kit 'waits for the kitchen call button to be pressed
to_kit: high 7 'switch on motor backwards
if pin2 = 0 then to_kit 'wait until buggy reaches the kitchen
low 7 'switch off motor
goto main 'loop back to start
You need to use white space comments (the text following the ' ) to explain what each line of the program means in English. In doing this you can also check back to your flowchart to make sure that your program follows the correct sequence.
No comments:
Post a Comment