Swipe card reader w liquid crystal display
Download
1 / 20

Swipe Card Reader w/ Liquid Crystal Display - PowerPoint PPT Presentation


  • 122 Views
  • Uploaded on

Swipe Card Reader w/ Liquid Crystal Display. Embedded Systems Interfacing Laboratory. Overview. Background Task 0 – Clean Up Motor Feedback Lab Task 1 -- Understand Data Stream w/ MSO Task 2 -- Basic ISR w/ Strobe Count and Ones Count Task 3 -- Capture Data with ISR

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Swipe Card Reader w/ Liquid Crystal Display' - talisa


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Swipe card reader w liquid crystal display

Swipe Card Reader w/ Liquid Crystal Display

Embedded Systems Interfacing Laboratory


Overview
Overview

  • Background

  • Task 0 – Clean Up Motor Feedback Lab

  • Task 1 -- Understand Data Stream w/ MSO

  • Task 2 -- Basic ISR w/ Strobe Count and Ones Count

  • Task 3 -- Capture Data with ISR

  • Task 4 -- Decode, check, and display data/errors






Mcr 175 1r swipe card reader
MCR-175-1R Swipe Card Reader

Color Signal Explorer-16

BLACK GROUND Vss

RED +5V Vdd

YELLOW /CARD DETECT RD14

BLUE /DATA RE9

GREEN /STROBE RE8



Task 1 start sentinel
Task 1 -- Start Sentinel

RTZ

Encoding

1 2 4 8 P 1 2 4 8 P 1 2 4 8 P 1 2 4 8 P 1 2 4 8 P

1

2

‘6’

2

‘B’

Remember data comes in one bit at a time (per interrupt).


Task 1 end sentinel
Task 1 -- End Sentinel

1 2 4 8 P 1 2 4 8 P 1 2 4 8 P

No Ones

CHAR

LRC

‘F’



Task 2 basic interrupt service routine template
Task 2 -- Basic Interrupt Service Routine Template

void __attribute__((interrupt,no_auto_psv)) _INT1Interrupt(void) {

  INT1IF=0;

// insert code here

}

void main(void){

//Initialize ports & interrupt enable bits

endless:

// Process

// Display stb_cnt on bargraph;

goto endless;

}


Task 2 initswipe
Task 2 -- initSwipe

  • Card detect as input

  • Data as input

  • INTCON2bits.INT1EP=?

  • IFS1bits.INT1IF=0

  • IEC1bits.INT1IE=1

  • Optional IPL

    • _IPL < _INT1IP


Task 3 capture data
Task 3 -- Capture Data

ERROR

LEAD-

ING

First One

CHARAC-

TER

CD

default

“00000”

NEW

STROBE

Conversion

Complete

TRAIL-

ING

DECODE


Task 3 state type
Task 3 – STATE_TYPE

enum STATE_TYPE {NEW,LEADING,CHARACTER,TRAILING,DECODE,ERROR};

enum STATE_TYPE state=NEW;

unsigned char bit_cnt=0;

unsigned char char_cnt=0;

unsigned char one_cnt=0;

unsigned char character;

unsigned char buffer[40];


Task 3 switch statement
Task 3 -- Switch Statement

•••••

switch(state){

case NEW: •••••

break;

case LEADING: •••••••

default:

state = ERROR;

}

You write CHARACTER state code


Task 4 parity lrc
Task 4 -- Parity & LRC

Hex Binay

Value Value

WithoutWithout

P 8 4 2 1 Parity Parity



Start Sentinel: B 0 1 0 1 1 B  1 0 1 1

1 0 0 0 0 1 1  0 0 0 1

2 0 0 0 1 0 2  0 0 1 0

3 1 0 0 1 1 3  0 0 1 1

End Sentinel: F 1 1 1 1 1F 1 1 1 1

LRC 4 0 0 1 0 0 4 0 1 0 0

0 0 0 0 0

Odd Parity

Even

Parity

Easier yet bitwise “exclusive-or” all including LRC = 0



Task 4 mainline
Task 4 -- Mainline

  • Display the message “Swipe card…” on first line of LCD

  • Wait for state to go to DECODE.

  • Clear display

  • Display data buffer on first and second line of LCD

  • Display one of the following on the bargraph

    • “No errors…”

    • “Start error…”

    • “Parity error…”


Task 4 mainline continued
Task 4 -- Mainline Continued

  • “Stop error…”

  • “LRC error…”

  • Prepare for next card swipe by setting state to NEW.

  • You can do the four error checks in main or the interrupt service routine.


  • ad