Mädchen Machen Technik using pic-microcontroller

The “Mädchen Machen Technik” workshop is designed to give high school students an introduction to microcontrollers. The students will build a flashing light pattern and/or a counter-timer. In the process of building this project, the students will learn about microcontrollers and digital electronics. Here is the parts list for the projects.

Introduction to some circuit elements
  1. The students will learn how to measure DC voltage and resistance using a multi-meter. They will measure the voltage of batteries connected in series and in parallel.
  2. The students are given the task to determine, using a voltmeter and wires, how the holes on a breadboard are connected. The students sketch the hole connections on a picture of the breadboard.
  3. Next, the students will be given several Light Emitting Diodes (LEDs), with an explanation on how they work. They are to connect the LED(s) to the breadboard so that one LED lights up, then two light up, etc. Do not put more than 3 Volts across an LED.

Mädchen Machen Technik

Blinking Lights Project
As a first project on the breadboard, we will program the microcontroller to produce a blinking pattern of up to five LED’s. We will start with one of the simplest microcontrollers: PIC12F629. First, we build the circuit on the breadboard, then we will program the PIC12F629 chip.

Building the Circuit

A schematic of the circuit is shown below:

 

  • he PIC12F629 has only 8 pins. Pin 8 is the ground pin, and Pin 1 is the positive voltage pin. In our applications, we will use two AA batteries in series which will give around 3 volts for Pin 1.
  • The other six pins (2-7) will be used as digital input/output. Pins 2, 3, 5, 6, and 7 will be output pins connected to LEDs. Pin 4 can only be set as an input pin. We will not connect an LED to pin 4. In the picture below, one can see the 5 LEDs connected to the appropriate pins.

Building the Programmer
After setting up the “blinking lights project” on the breadboard, we program the chip. To program the microcontroller, we will need to constuct a programmer circuit on a bread board. Each group of three students will use the same programmer, a pickit2. The programmer circuit is shown below

he programmer has 6 pins in a row. The ground on the programmer, pin 3, is connected to the ground of the chip (pin 8). The voltage (5V) of the programmer, pin 2, is connected to pin 1 of the chip. The other programmer pins are connected to the chip as shown in the two figures below:

The pickit2 is connected to a personal computer through a usb port. In the picture below, one can see where the microcontroller chip is connected in the programmer:

Finally, we program the microcontroller using the MPlab software from microchip.

Programming the Microcontroller

Mädchen Machen Technik

  1. The assembly code we will start with is the code: test12.asm. The only lines of the code the students need to modify for their desired blinking pattern are:loop
    movlw b’00100101′
    movwf GPIO
    call delay1
    movlw b’00010010′
    movwf GPIO
    call delay1
    goto loop
  2. First, the binary number ‘00100101’ is placed in the working register. Then this number in the working register is transfered into the register GPIO. The GPIO register is directly connected to the pins of the chip. A “1” will put 3 volts on a pin, and a “0” will put zero volts on the pin. The last 6 bits are connected to pins 2, 3, 4, 5, 6, and 7 respecively. The number ‘00100101’ in register GPIO will result in 3 volts for pins 2, 5, and 7, and zero volts for pins 3 and 6. Pin 4 is not affected, it is only an input pin. The subroutine delay1 causes a delay of around 1/4 second.

 

for more detail: Mädchen Machen Technik

 

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter