Answered step by step
Verified Expert Solution
Question
1 Approved Answer
/ * * * RFID.c * COMP 5 5 1 LAB 1 1 RFID Module * PIC 1 8 F 4 5 8 Microchip MPLAB
RFID.c
COMP LAB RFID Module
PICF Microchip MPLAB C
Lakshya Kapoor & Sharath Varma Nallapuraju
December
This program is about running the RFID Module
This program is strictly in my own work. Any material
beyond course learning materials that is taken from
the Web or other sources is properly cited, giving
credit to the original authors
#include
#include "millish
#pragma config OSC HS OSCS OFF
#pragma config PWRT OFF, BOR ON BORV
#pragma config WDT OFF
#pragma config DEBUG OFF, LVP OFF, STVR OFF
Boolean values
#define FALSE
#define TRUE FALSE
LCD CMD and DATA pins
#define CMDPIN PORTBbits.RB
#define RWPIN PORTBbits.RB
#define ENPIN PORTBbits.RB
#define CMDPORT PORTB
#define CMDPORTTRIS TRISB
#define CMDPORTTRISVALUE unsigned char~x
Data
#define DATAPORT PORTD
#define DATAPORTTRIS TRISD
Important constants
#define NCHARS number of digits in RFID code
#define BAUDDIVISOR value for baud rate generator BRGH
const unsigned char data;
enum State
WAIT,
RECEIVING,
DISPLAY
;
enum State state WAIT;
unsigned int deadline ;
Function prototypes
void lcdinivoid; initialize LCD module
void delaymsunsigned int milliseconds; YOU FILL IN OTHER LCD FUNCTIONS FROM LAB
const unsigned char BANNER "LAKSHYA ; Define message array
unsigned char cardidNCHARS; Define "cardID array
unsigned int charcounter ;
void delaymsunsigned int milliseconds
unsigned int deadline millis milliseconds;
whilemillis deadline ;
void lcdcmdunsigned char command
CMDPIN ;
delayms;
RWPIN ;
delayms;
ENPIN ;
delayms;
PORTD command;
delayms;
ENPIN ;
delayms;
void lcddataunsigned char data
CMDPIN ;
delayms;
RWPIN ;
delayms;
ENPIN ;
delayms;
PORTD data;
delayms;
ENPIN ;
delayms;
void printerconst char const text, unsigned char startPos
int i;
lcdcmdstartPos;
delayms;
for i ; texti; i
lcddatatexti;
delayms;
You will combine part of lab and part of lab for this bonus assignment. It will require use
of RFID and a state machine to receive and display the card ID on the second line as in lab
but the OK or BAD display will be delayed unGl aHer a Gmer counts down on the st line
similar to Lab
To accomplish this you will have to modify the state machine as follows:
In the DISPLAY state, you should only display the ID DO NOT PRINT OK or BAD and set a
second Gmer deadline.
If another character is received within seconds, go back to RECEIVING state as in Lab
If the deadline elapses, instead of moving to WAIT state, move to a new COUNTDOWN state.
In the COUNTDOWN state, display a count down of to second delay between counts on
the top line in the first two character locaGons. Leave one space, then display the same number
in binary, one bit per character space as or
As you are displaying the countdown on the top line, on the boom line, draw a progress bar
with a single character. At the line is blank, at the line is filled all characters In
between, the line is proporGonal to the number. Hint: try with the filled rectangle character xff
Once the countdown has completed, display OK or BAD as appropriate on the first line, then
move to the WAIT state. Implement this question in the above given given code provided by me
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started