A simple MC68CH11 program

Design a microprocessor based system that calculates the number of people entering a premise using a motion sensor. The output would be connected to two seven segment display which displays the number of people entering the premise. The display would display up to number 10 after which the number would reset to zero.

Introduction:
In this project assignment I used the THRSim11. THRSim11 is a Windows-based simulator that lets you edit, assemble, simulate, and debug programs for the Motorola 68HC11 microcontroller. THRSim11 simulates the CPU, ROM, RAM, and all memory-mapped I/O ports, and on board peripherals, such as the timer (including pulse accumulator), analog-to-digital (A/D) converter, parallel port, serial port, and I/O pins (analog and interrupts). Furthermore, a number of simulated external components can be connected to the pins of the simulated 68HC11 while debugging, including LEDs, switches, analog sliders (with variable voltage potential), and serial transmitters/receivers. There is also a 4x20 LCD character display mapped in the address space of the 68HC11.  THRSim11's user interface lets you view and control every register (CPU registers and I/O registers), memory location (data, program, and stack), and pin of the simulated microcontroller while debugging. You can also stop the simulation at any combination of events.

Flow Chart:
Input à Motion sensor à Count à Microprocessor à Counter modulo 11 program à Output à Seven segment display

Project Scope:
i.              Count pulse of motion sensor at input.
ii.            A modulo-10 counter is used as it will reset after 10 people entered the premises.
iii.           To display two BCD numbers (count up to 10) means we need to use two 7-segment displays. 

Code:


*MC68HC11
*Port E for motion sensor
*Port B for Byte 7 segment display
*by fareed jamaluddin
*KEW070017

            org       $C000 
PORTB           EQU    $1004

* Initialize

MAIN   clra     
            staa PORTB
           
*  Loop to count passenger          

SCAN ldab     $100a    ;read input at Port E (A/D converters, a motion sensor in our case)
            andb    #$01     ;mask off 7 msbs
            beq      SCAN     ;If no person walk in, keep scanning.
            adda    #$01     ;person detected start count
        ldab    #$11
        cba          #11
        beq          MAIN   ;If ten person walk in then reset counter.
            clrb 
            daa                   ;adjust for bcd           
            staa     PORTB    ;display to Dual or Byte 7-segment display
            jmp      SCAN     ;loop



Tags:
MC6800
MC68HC11
Microprocessor
Microcontroller
Assembly
Lab  experiment
Design example

Matlab Simple Train Image Classification

              In this assignment of image processing I was given a task in programming a MATLAB script from a list of function in image processing toolbox. In computer vision, image analysis comprises of feature extraction where it involve on process of acquiring higher level info and pattern classification using the higher level information and identify objects in the image.

In simple order manner it would be like this
image - preprocessing - data reduction - feature analysis


ASSUMPTION:
i.                    Image must be exact front view side for better result.
ii.                  No other entity should be in the image such as the train driver, passenger, traffic lamp, buildings and so on.
iii.                The distance of the train image taken must not be too far.
iv.                 The picture quality must be in uniform brightness and contrast.
v.                   It is best to not include shadows in the picture.
vi.                 The focused image should only be the train, not merged with surroundings.
vii.               Unique colors of the body part are helpful too.

Here is the result of my test script:
Result is read from left to right then follows down to final picture showing the results.
i.                    Original image
ii.                  Grayscale image +( imadjust increases the contrast of the image by mapping the values of the input intensity image to new values such that, by default, 1% of the data is saturated at low and high intensities of the input data) + median filter where it remove noise but preserve edges.
iii.                Edge detection of sobel operator + dilation(linear gaps will disappear if the Sobel image is dilated using linear structuring elements)
iv.                 The dilated gradient mask shows the outline of the cell quite nicely, but there are still holes in the interior of the cell. To fill these holes we use the imfill function.
v.                   Using morphology functions, remove pixels which do not belong to the objects of interest.
vi.                 Estimate each object's area and perimeter. Use these results to form a simple metric indicating the roundness of an object. When the thinness ratio 0.9 less than metric less than 1 we classify it as locomotive train.


Refer to step i. to v. But for our final result the thinness ratio is 0.70 less than metric less than 0.76(Square like shape often to have this range of values). Which we classify it as a KTM Malaysia.


Refer to step i. to v. But for our final result the thinness ratio is 0.76 less than metric less than 0.81(Square and circle  like shape often to have this range of values). Which we classify it as a Singapore MRT.

5 April 2011
fareed

readers