Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm writing code in C on Vitis IDE for a PMODKYPD calculator using a RealDigital Blackboard. I'm having trouble getting my keyboard to register inputs.

I'm writing code in C on Vitis IDE for a PMODKYPD calculator using a RealDigital Blackboard. I'm having trouble getting my keyboard to register inputs. I'm trying to to turn on an LED for corresponding keyboard inputs. I just need test code for turning on the first led when i press the the 1 button on the keyboard and i can do the rest. Here's all the information i have and some of my code.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Much thanks in advanced.

Table 1: Overview of added PMOD registers Access alue Description Base Address + Register Reset Value Offset (hex) Name (hex) Ox4BB07000 + 0x00 PMOD_CTRL Ox0 (ba types Read/Write Currently Unused. 0x4BB07000 + 0x04 PMOD_A Oxo 0x4BB07000 + 0x08 PMOD_B Read/Write Connection to GPIO pins. Read/Write Connection to GPIO pins. Oxo Microprocessor Systems Week 4 Lab 3: Introduction to ARM Assembly Table 2: Register - PMOD_CTRL (0x4BB07000 + OxO0) (PMOD) Name Bit Range pe Reset Description Undefined 31:0 N/A N/A Currently Unused. Table 3: Register - PMOD_A (0x4BB07000 + 0x04) (PMOD); PMOD_B (0x4BB07000 + Ox08) (PMOD) Name Bit Range Type Reset Description Undefined 31:8 N/A N/A PMOD A/B Inputs 7:4 R Oxo Bits 31:8 have no effect. Reading from the register will result in the current values from the GPIO pins. Writing to the register will result in updating current values to the GPIO pins. PMOD A/B Outputs 3:0 R/W Oxo Table 4 summarizes the pin connections between the Digilent 12-pin 16 push button keypad peripheral module (plugged into the PMODA connector) and the Blackboard. Note that you may find more information on the keypad peripheral in (Documentation Digilent). You can see the layout of the PMOD connectors in the Blackboard Schematic in (Documentation Blackboard). Table 4: Port to Keypad Mapping Blackboard PMOD_A Pin Register Bit JA1_P (1) 0 JA1_N (2) 1 JA2_P (3) 2 JA2_N (4) 3 GND (5) N/A VCC3V3 (6) N/A Keypad Blackboard PMOD_A Keypad Pin Pin Register Bit Pin COL4 JA3_P (7) 4 ROW4 COL3 JA3_N (8) 5 ROW3 COL2 JA4_P (9) 6 ROW2 COL1 JA4_N (10) 7 ROW1 GND GND (11) N/A GND VCC3V3 VCC3V3 (12) N/A VCC3V3 Overview The Digilent PmodKYPD is a 16 button keypad, providing users with immense configurability. Features include: 3 2 FT 1 16 momentary push-buttons Can detect simultaneous button presses Isolated rows and columns Small PCB size for flexible designs 3.4" x 2.7" (8.6 cm x 6.9 cm) 12-pin Pmod port with GPIO interface Follows Digilent Pmod Interface Specification Type 1 Library and example code available in resource center OF E O Pok The PmodKYPD. 1 Functional Description The PmodKYPD utilizes 4 rows and columns to create an array of 16 momentary pushbuttons. By driving the column lines to a logic level low voltage one at a time, users may read the each of the rows to determine which button, if any, is currently being pressed. Simultaneous button presses can also be recorded, although it is still required to step through each row and column separately in order to ensure that the pressed buttons do not interfere with each measurement. 2 Interfacing with the Pmod The PmodKYPD communicates with the host board via the GPIO protocol. Each button is placed within a simple voltage divider circuit. When a button is not pressed, a large pull-up resistor maintains a logic level high voltage on each of the row pins. When a column pin is driven to a logic level low voltage and a corresponding DOC#: 502-195 Copyright Diglent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. Page 1 of 2 PmodKYPD Reference Manual A DIGILENT button is pressed, completing the voltage divider circuit, the row pin will then read a logic level low voltage instead. Pin 1 2 3 4 5 6 Signal COL4 COL3 COL2 COL1 GND VCC Header J1 Description Pin Column 4 7 Column 3 8 Column 2 9 Column 1 10 Power Supply Ground 11 Power Supply (3.3V/5V) 12 Signal Description ROW4 Row 4 ROW3 Row 3 ROW2 Row 2 ROW1 Row 1 GND Power Supply Ground VCC Power Supply (3.3V/5V) Table 1. Pinout description table. Any external power applied to the PmodKYPD must be within a voltage that your system board can handle; It is recommended that Pmod is operated at 3.3V. 3 Physical Dimensions The pins on the pin header are spaced 100 mil apart. The PCB is 3.4 inches long on the sides parallel to the pins on the pin header and 2.7 inches long on the sides perpendicular to the pin header. 8 #include "calculator.h" 9 #include 10 #include "memory.h" 120 int main(void) 13 { uint32_t buttons; buttons = PMOD_A; LED SETUP = Ob01111111111; LEDS = @b00000000001; usleep(1000000); LEDS = obo; while(1) PMOD_A = Ob000001000; buttons = PMOD_A; while (PMOD_A == Ox01) buttons = PMOD_A; LEDS = Ob00000000001; usleep(1000000); LEDS = obo; 8 #ifndef SRC_MEMORY_H_ 9 #define SRC_MEMORY_H_ 10 // memory.h 11 #define PMOD_A *((uint32_t *)0x4BB07000 + 0x011 12 #define LED_SETUP *((uint32_t *) Ox4BB00000) 13 #define LEDS *((uint32_t *) @x4BB00004) #endif /* SRC_MEMORY_H_ */ Table 1: Overview of added PMOD registers Access alue Description Base Address + Register Reset Value Offset (hex) Name (hex) Ox4BB07000 + 0x00 PMOD_CTRL Ox0 (ba types Read/Write Currently Unused. 0x4BB07000 + 0x04 PMOD_A Oxo 0x4BB07000 + 0x08 PMOD_B Read/Write Connection to GPIO pins. Read/Write Connection to GPIO pins. Oxo Microprocessor Systems Week 4 Lab 3: Introduction to ARM Assembly Table 2: Register - PMOD_CTRL (0x4BB07000 + OxO0) (PMOD) Name Bit Range pe Reset Description Undefined 31:0 N/A N/A Currently Unused. Table 3: Register - PMOD_A (0x4BB07000 + 0x04) (PMOD); PMOD_B (0x4BB07000 + Ox08) (PMOD) Name Bit Range Type Reset Description Undefined 31:8 N/A N/A PMOD A/B Inputs 7:4 R Oxo Bits 31:8 have no effect. Reading from the register will result in the current values from the GPIO pins. Writing to the register will result in updating current values to the GPIO pins. PMOD A/B Outputs 3:0 R/W Oxo Table 4 summarizes the pin connections between the Digilent 12-pin 16 push button keypad peripheral module (plugged into the PMODA connector) and the Blackboard. Note that you may find more information on the keypad peripheral in (Documentation Digilent). You can see the layout of the PMOD connectors in the Blackboard Schematic in (Documentation Blackboard). Table 4: Port to Keypad Mapping Blackboard PMOD_A Pin Register Bit JA1_P (1) 0 JA1_N (2) 1 JA2_P (3) 2 JA2_N (4) 3 GND (5) N/A VCC3V3 (6) N/A Keypad Blackboard PMOD_A Keypad Pin Pin Register Bit Pin COL4 JA3_P (7) 4 ROW4 COL3 JA3_N (8) 5 ROW3 COL2 JA4_P (9) 6 ROW2 COL1 JA4_N (10) 7 ROW1 GND GND (11) N/A GND VCC3V3 VCC3V3 (12) N/A VCC3V3 Overview The Digilent PmodKYPD is a 16 button keypad, providing users with immense configurability. Features include: 3 2 FT 1 16 momentary push-buttons Can detect simultaneous button presses Isolated rows and columns Small PCB size for flexible designs 3.4" x 2.7" (8.6 cm x 6.9 cm) 12-pin Pmod port with GPIO interface Follows Digilent Pmod Interface Specification Type 1 Library and example code available in resource center OF E O Pok The PmodKYPD. 1 Functional Description The PmodKYPD utilizes 4 rows and columns to create an array of 16 momentary pushbuttons. By driving the column lines to a logic level low voltage one at a time, users may read the each of the rows to determine which button, if any, is currently being pressed. Simultaneous button presses can also be recorded, although it is still required to step through each row and column separately in order to ensure that the pressed buttons do not interfere with each measurement. 2 Interfacing with the Pmod The PmodKYPD communicates with the host board via the GPIO protocol. Each button is placed within a simple voltage divider circuit. When a button is not pressed, a large pull-up resistor maintains a logic level high voltage on each of the row pins. When a column pin is driven to a logic level low voltage and a corresponding DOC#: 502-195 Copyright Diglent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners. Page 1 of 2 PmodKYPD Reference Manual A DIGILENT button is pressed, completing the voltage divider circuit, the row pin will then read a logic level low voltage instead. Pin 1 2 3 4 5 6 Signal COL4 COL3 COL2 COL1 GND VCC Header J1 Description Pin Column 4 7 Column 3 8 Column 2 9 Column 1 10 Power Supply Ground 11 Power Supply (3.3V/5V) 12 Signal Description ROW4 Row 4 ROW3 Row 3 ROW2 Row 2 ROW1 Row 1 GND Power Supply Ground VCC Power Supply (3.3V/5V) Table 1. Pinout description table. Any external power applied to the PmodKYPD must be within a voltage that your system board can handle; It is recommended that Pmod is operated at 3.3V. 3 Physical Dimensions The pins on the pin header are spaced 100 mil apart. The PCB is 3.4 inches long on the sides parallel to the pins on the pin header and 2.7 inches long on the sides perpendicular to the pin header. 8 #include "calculator.h" 9 #include 10 #include "memory.h" 120 int main(void) 13 { uint32_t buttons; buttons = PMOD_A; LED SETUP = Ob01111111111; LEDS = @b00000000001; usleep(1000000); LEDS = obo; while(1) PMOD_A = Ob000001000; buttons = PMOD_A; while (PMOD_A == Ox01) buttons = PMOD_A; LEDS = Ob00000000001; usleep(1000000); LEDS = obo; 8 #ifndef SRC_MEMORY_H_ 9 #define SRC_MEMORY_H_ 10 // memory.h 11 #define PMOD_A *((uint32_t *)0x4BB07000 + 0x011 12 #define LED_SETUP *((uint32_t *) Ox4BB00000) 13 #define LEDS *((uint32_t *) @x4BB00004) #endif /* SRC_MEMORY_H_ */

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

=+ (a) Each partner is to receive a salary of 500 per annum.

Answered: 1 week ago

Question

=+1. Describe the value chain of the media industry!

Answered: 1 week ago

Question

=+3. Draw the submodels of an integrated business model!

Answered: 1 week ago