1
00:00:01,270 --> 00:00:06,450
How can we use the interface to detect the key press in a four by four keyboard?

2
00:00:06,880 --> 00:00:08,710
This lecture will address this question.

3
00:00:10,440 --> 00:00:17,460
For the keyboard module, I'm using the digital and pimlott keypad, which is a 16 button keypad, the

4
00:00:17,790 --> 00:00:24,960
keyboard utilizes for rows and columns to create an area of 16 push buttons while driving the column

5
00:00:24,960 --> 00:00:28,440
lines with a low level logic voltage one at a time.

6
00:00:28,650 --> 00:00:34,410
We can read the corresponding logic level voltage on each of the rows to determine which button, if

7
00:00:34,410 --> 00:00:36,330
any, is currently being pressed.

8
00:00:38,570 --> 00:00:45,860
Therefore, our Pyrmont key parts controller will have four states on each state, one column is derived

9
00:00:45,860 --> 00:00:47,060
with logic value zero.

10
00:00:47,210 --> 00:00:48,810
Then Rose will be right.

11
00:00:49,310 --> 00:00:54,800
The key at the intersection of the column and the row with zero value is written as the key.

12
00:00:55,310 --> 00:01:01,010
We should perform this scanning methodology regularly with the frequency of about sixty two point five

13
00:01:01,010 --> 00:01:05,600
kilohertz, which means with the period of 16 millisecond.

14
00:01:08,980 --> 00:01:15,100
Our design consists of two ipis, the first type detects the pressed key and show that on a single cell

15
00:01:15,100 --> 00:01:17,920
and segment display, this IP has three outputs.

16
00:01:18,700 --> 00:01:24,910
One drives the key with columns and to drive a certain segment to display the key.

17
00:01:26,140 --> 00:01:34,020
It also has five inputs, a design clock, a reset, a refresh clock signal, and the status of keyboard

18
00:01:34,030 --> 00:01:34,510
rose.

19
00:01:36,630 --> 00:01:40,650
The second IP generates the pulses with four millisecond per.

20
00:01:41,930 --> 00:01:44,480
Used for the transition between states.

21
00:01:49,450 --> 00:01:52,620
Now, let's describe our design in each of us here.

22
00:01:52,690 --> 00:02:00,250
I will explain the first IP which detects depressed key for the second IP we can use the IP that generates

23
00:02:00,250 --> 00:02:06,790
click refresh pulses described in seven segments section create a new Y to such as project with the

24
00:02:06,790 --> 00:02:13,590
name of Pimlott underscore keyboard dash white essentialists choose the design top function name.

25
00:02:14,260 --> 00:02:18,010
Don't forget to select faces three born as a target FPGA platform.

26
00:02:35,890 --> 00:02:41,960
Artisan conference attached to this lecture and the resources to the creator project upon the design

27
00:02:41,980 --> 00:02:47,650
of their fight, we see it to the constant Arry after including the AP header file.

28
00:02:49,410 --> 00:02:57,020
This area contains the binary index of each key on our keypad, then a constant area represents all

29
00:02:57,030 --> 00:03:00,740
the southern segment codes for the hex numbers from zero to.

30
00:03:09,770 --> 00:03:11,240
Openly designed Sourcefire.

31
00:03:12,160 --> 00:03:19,210
As therefore, as of our design has four states, we define an enumeration type to represent these states.

32
00:03:20,300 --> 00:03:25,160
They're designed to function, has five arguments, two inputs and outputs.

33
00:03:26,220 --> 00:03:32,340
Following the key design approach, the function is parked right now, we need to register to save the

34
00:03:32,340 --> 00:03:33,110
second state.

35
00:03:33,390 --> 00:03:37,080
We also need to register to keep the active column in each state.

36
00:03:40,460 --> 00:03:47,630
Then we define two variables corresponding to these two resistors, these variables keep the intermediate

37
00:03:47,630 --> 00:03:48,920
values temporarily.

38
00:03:49,850 --> 00:03:53,840
We also define two other variables that we need throughout the code.

39
00:03:54,290 --> 00:03:59,660
Now let's have a look at the states in the first set, cold, cold one.

40
00:04:00,320 --> 00:04:06,800
If the input refresh signal is one, then the time slot of this state has been expired and we should

41
00:04:06,800 --> 00:04:09,140
go to the next state called call to.

42
00:04:10,520 --> 00:04:17,630
And the second column should be driven by zero if they state call one time slot is not expired, it

43
00:04:17,630 --> 00:04:24,260
should apply the logic value zero to the first column and read the rules and check which one is zero.

44
00:04:24,710 --> 00:04:28,370
If he has been pressed, the state should return the index of that key.

45
00:04:29,400 --> 00:04:33,940
If no keys pressed, then the no key pressed variables should be activated.

46
00:04:34,980 --> 00:04:37,380
Other states do a similar task.

47
00:04:55,270 --> 00:04:59,570
Finally, we should update the state registers and prepare now.

48
00:05:00,190 --> 00:05:04,030
Now let's synthesize the code and generate the corresponding vivants to.

49
00:05:22,950 --> 00:05:29,220
Create a new one on the project, choose Pimlott underscore keyboard that should be Varnedoe as a project

50
00:05:29,220 --> 00:05:33,960
name, and don't forget to choose bases to be bought as a target FPGA platform.

51
00:05:46,670 --> 00:05:48,260
Create a new blog designed.

52
00:06:00,550 --> 00:06:05,420
At the generated IP and the signal pulse generator to deliver on the IP repository.

53
00:06:06,580 --> 00:06:09,550
Added to Ipis into the design area.

54
00:06:30,260 --> 00:06:34,580
Connect them together and modify the name of external ports, if you like.

55
00:07:16,170 --> 00:07:19,800
Create a new constraint, fine, and the required constraints.

56
00:07:31,070 --> 00:07:34,040
We need a set of constraints to define the clock port.

57
00:07:35,430 --> 00:07:39,180
Also, we should connect the seven segment data and enable signals.

58
00:07:40,700 --> 00:07:44,330
The arrest report can be connected to the center pushbutton.

59
00:07:45,280 --> 00:07:51,430
Finally, we should provide the connections between the design and JCP must signal signal-to-noise.

60
00:07:53,370 --> 00:07:54,240
Now generate the.

61
00:08:46,450 --> 00:08:52,090
I have forgotten to change the clock and reset things, so let's modify them and generate the bitstream

62
00:08:52,090 --> 00:08:52,390
again.

63
00:09:28,390 --> 00:09:31,300
Now we can program the board and examine the design.

64
00:10:04,580 --> 00:10:12,860
This lecture is the last in this section that explained how to work with modern interface in the next

65
00:10:12,860 --> 00:10:18,830
lecture concludes a section by posing a few exercises for you to master the concepts.

66
00:10:21,440 --> 00:10:27,340
This is our takeaway message to detect oppressed key on a four by four mattocks keyboard, we can apply

67
00:10:27,350 --> 00:10:31,490
a low level logic voltage on the column lines once at a time.

68
00:10:32,470 --> 00:10:36,370
And read the corresponding logical level voltage on each of the rows.

69
00:10:38,510 --> 00:10:44,540
Now, the question, modifying the keyboard controller code to make that a single cycle design.
