International accounting
May 20, 2020
at risk students fact sheet for educators
May 20, 2020

Embedded Systems

Embedded Systems

Introduction
Liquid Crystal Displays(LCD) are used in many embedded systems to provide essential information to endusers. Cashpoint machines are typical examples of such systems. The PIN numbers stored in the microcontroller act as a deterrent to unauthorised access to bank accounts. These machines are normally linked to a central computer that provides PIN verification and other facilities provided by banks. Individuals can access their bank account after entering a correct PIN number via a keypad. A simplified cashpoint could be emulated in the Embedded Systems laboratory using the pushbutton switches and the LCD display of the PIC development boards.

Aim
To develop a c program to simulate a cashpoint machine and to evaluate its operation. The inputs to the system are simulated by pushbutton switches connected to PORTD of the PIC16F877A. the LCD connected to PORTB is used to facilitate entering the PIN number and display other information.

Objectives
1 To write a structured and annotated c program.
2 To provide evidence of the development of each stage of the program. This will consist of producing a report and a disc containing your source codes. Save your main program as embed1.c.
3 To demonstrate a functional (fully or partially) program to your tutor at scheduled laboratory session.
Tasks
Use the built-in peripherals of the PIC16F877A and its ports to provide the following features in the cashpoint machine.
1. Incorporate four PIN numbers of up to 6-digit each in the non-volatile memory of the PIC microcontroller.
2. Provide means to enter a PIN number from three keys attached to bits 0, 1 and 2 of PORTD. Some form of security procedure has to be incorporated in order to prevent and discourage persistent individuals from attempting to try all possible PIN number combinations.
3. Use the LCD to assist in code entry. Once the code has been successfully entered and verified, the cashpoint machine should display a menu of services provided by the bank. The menu consists of the following options:

Cash €“ to withdraw money in £5 denominations up to a maximum of £250.
Statement €“ to request a statement
Balance €“ to check the bank balance on-line

4. The cashpoint machine should have a facility to select one of the three options by scrolling through the menu displayed on the LCD. The keys used for entering the PIN number can also be used for scrolling up/down through the menu and selecting an option.

5. Each selected option provides a service that may require a further menu and user interaction. These are described in the next section.

The pushbutton switches and the LEC connected to PIC16F877A and their functions are illustrated below:
RD3 RD2 RD1 RD1 RD0 RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0
?+ ? ?

 

 

 

 

 

 

Confirm Select Down UP Used by LCD

Operation
Store the following PIN numbers and an initial balance of £250 in the PIC.
1234
12345
67890
987654
Program
1. Requesting a service

After reset display on the top line of the LCD.

Use RD0 and RD1 to enter the first digit on the second line. Press these keys repeatedly until the required number is displayed on the LCD. Press RD2 to enter the number. Move the cursor to the second digit and enter the second number. Repeat until all digits are entered. Press RD3 to confirm.
Compare the entered PIN with those stored in the microcontroller. Return the LCD to its initial menu if the entry is not verified. Allow two attempts to enter the PIN after which the account should be locked and the display should display a message such as please try later and lock the microcontroller. The service should also be suspended if the PIN number is not entered within one minute. Use timer 0 and interrupts for this purpose.
2. Selecting a service

After entering the correct PIN number the display should show the following options:

 

 

 

Use RD0 and RD1 to step through the options. The following displays show the process.

When the required service is highlighted press RD2 to select.
3. Options

Cash
Display Enter req.cash message on the first line.
Use RD0 and RD1 to enter the required cash up to £250 in multiples of £5. Press RD3 to confirm.
Display Remove cash message and turn the LED connected to RD0 on. Removal of the cash can be simulated by pressing RD2.

Statement
Display Printing statement message and turn the LED connected to RD1 for few seconds. Return to the main menu.

Balance
Display the latest balance. Assume an initial balance of £250. Any subsequent cash withdrawal should be reflected in the balance.
Note: All timed events should be use the internal PIC timer running in interrupt mode.
Assessment

1. Report 10
2. Structure of your programs 10
3. Operation 30
User interaction 3
PIN entry & verification 5
Cash withdrawal 5
Statement 2
Balance 5
PIN security 10
4. Annotations 10
5. Demonstration 15