1 / 20

Swipe Card Reader w/ Liquid Crystal Display

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

kaitlyn
Download Presentation

Swipe Card Reader w/ Liquid Crystal Display

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Swipe Card Reader w/ Liquid Crystal Display Embedded Systems Interfacing Laboratory

  2. 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

  3. Financial Transaction Swipe Card

  4. Magnetic Stripe Encoding

  5. Track 2 Data Format

  6. Track 2 Character Set

  7. 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

  8. Task 1 -- Entire Swipe

  9. 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).

  10. Task 1 -- End Sentinel 1 2 4 8 P 1 2 4 8 P 1 2 4 8 P No Ones CHAR LRC ‘F’

  11. Task 1 -- Encoded Data 6221100…52

  12. 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; }

  13. Task 2 -- initSwipe • Card detect as input • Data as input • INTCON2bits.INT1EP=? • IFS1bits.INT1IF=0 • IEC1bits.INT1IE=1 • Optional IPL • _IPL < _INT1IP

  14. Task 3 -- Capture Data ERROR LEAD- ING First One CHARAC- TER CD default “00000” NEW STROBE Conversion Complete TRAIL- ING DECODE

  15. 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];

  16. Task 3 -- Switch Statement ••••• switch(state){ case NEW: ••••• break; case LEADING: ••••••• default: state = ERROR; } You write CHARACTER state code

  17. 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

  18. Track 2 Character Set

  19. 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…”

  20. 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.

More Related