Software: Source code

Testprograms

When taking on a fairly big assembler code project, it is recommended to write some smaller test programs first, which can test your mechanical design (p.e. your sensors) as well as your programming skills. This will certainly increase the debugging success.
We first wrote a small program that allows us to test the light sensor. This is no vain luxury. The light sensors are probably the most sensitive instrument on your robot, and even a change in surrounding light can make a difference. This small program lets you check the sensors (p.e. for a bad contact in the wiring) and allows you to adjust the sensors' sensitivity.

We wrote very similar software for the switches. When a micro switch becomes active, a led will light up on the pcb. Again this simplifies debugging and offers possibility to check for bad wiring.

The output signal of the potentiometer is not digital. We don't want the potentiometer to give us a digital signal, because that would limit the number of different possible outputs to 2. This analogue port we will use to process the signal requires a different and slightly harder approach.
Below you can find two different test programs for the potentiometer. The first program just counts binary with the help of the leds on the pcb, showing the value that the analogue port is passing through to the calculating unit of the processor. This allows us to determine some of the software parameters.
The second potentiometer program allows to test the parameters you determine using the first program, as well as the way of handling the analogue signal in the software. Depending on the parameters set (determined by the first program) a particular led lits up when the potentiometer is in a certain position.

The last of the test programs tests the engines and the 'Motor Driver chip', as well as the wiring between the chip and the microprocessor. Vertigo's engines will sequentially do a number of tasks like turning left, right, separately, together, stopping for a certain amount of time etc...

  • TestSwitchen
  • TestLichtsensoren
  • TestPot1
  • TestPot2
  • TestMotors
  • The file below contains the configuration of the PIC16F877A. You need this file to be able to compile the assembler software that has been written, or your own software.
    The compilation software, a PIC simulator and the software to load your microprocessor, can be freely downloaded. You can find it in the Links section.

  • Pic_configuratiefile
  •  

    Main Program: Vertigo

    The structure of this program was already discussed in the previous sections and widely illustrated through several flowcharts. To debug this program (which of course has already been done) and to determine the correct parameter values (p.e. length of a certain delay), a step by step tactic is recommended. Before loading the main program, you may want to go through all the test programs, to make sure there are no obvious hardware problems. Afterwards you can load the main program and start up your Vertigo.
    Below you will find the main source code of this project. The debugging has already been done, but depending on the materials you used, some parameter values may have to be revised.

  • Vertigo
  •