Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
learn:courses:unit-3-lab3b:start [2017/02/14 23:39] – Martha | learn:courses:unit-3-lab3b:start [2021/10/13 22:14] (current) – Arthur Brown | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Lab 3b: LCD Parallel Interface - PMP IO Control ====== | + | ====== Lab 3b: LCD Parallel Interface - PMP I/O Control ====== |
+ | [[{}/ | ||
+ | [[{}/ | ||
== Download This Document == | == Download This Document == | ||
- | * | + | {{ : |
===== 1. Objectives ===== | ===== 1. Objectives ===== | ||
- | - Develop an application of foreground-background task scheduling. | + | - Identify the PIC32 processor pins used for the LCD interface. |
- | - Use change notification interrupts to detect push button presses and releases. | + | - Implement LCD control |
- | - Eliminate multiple button operations | + | - Understand handshaking requirements for interfacing two systems operating at differing clock speeds. |
- | - Implement the push-on / push off operation using a software-based finite state machine. | + | |
---- | ---- | ||
Line 23: | Line 23: | ||
===== 3. Equipment List ===== | ===== 3. Equipment List ===== | ||
==== 3.1. Hardware ==== | ==== 3.1. Hardware ==== | ||
- | - Basys MX3 trainer board. | + | - [[https:// |
- | - PC or Linux Workstation computer. | + | - [[https://digilent.com/shop/ |
- | - [[http://store.digilentinc.com/ | + | - Workstation computer running Windows 10 or higher, MAC OS, or Linux |
- | - [[http://store.digilentinc.com/ | + | |
+ | In addition, we suggest the following instruments: | ||
+ | |||
+ | - [[http://www.digilentinc.com/ | ||
==== 3.2. Software: ==== | ==== 3.2. Software: ==== | ||
- | - [[http:// | + | The following programs must be installed on your development workstation: |
- | - [[http:// | + | |
- | - [[http:// | + | |
+ | - [[http:// | ||
+ | - [[http:// | ||
+ | - [[http:// | ||
+ | - [[https:// | ||
---- | ---- | ||
===== 4. Project Takeaways ===== | ===== 4. Project Takeaways ===== | ||
- | - How to implement a bi-directional parallel | + | - How to implement a bi-directional parallel |
- How to use delays to control signal timing. | - How to use delays to control signal timing. | ||
- How to manage ASCII text strings. | - How to manage ASCII text strings. | ||
- | |||
---- | ---- | ||
Line 51: | Line 55: | ||
===== 6. Problem Statement ===== | ===== 6. Problem Statement ===== | ||
- | Develop and test a collection of functions that allow text to be placed at any position on a parallel I/O character LCD following the DFD and CFD models presented in Unit 3. The LCD_puts function is required to process the [[http:// | + | Develop and test a collection of functions that allow text to be placed at any position on a parallel I/O character LCD following the DFD and CFD models presented in Unit 3. The //LCD_puts// function is required to process the [[http:// |
Line 57: | Line 61: | ||
===== 7. LCD Background Information ===== | ===== 7. LCD Background Information ===== | ||
- | Character [[https:// | + | Character [[https:// |
- | The handshaking required to successfully communicate with the LCD on the Basys MX3 is representative of many common parallel interfaces. | + | The handshaking required to successfully communicate with the LCD on the Basys MX3 is representative of many common parallel interfaces. |
Line 67: | Line 71: | ||
===== 8. Lab 3a ===== | ===== 8. Lab 3a ===== | ||
==== 8.1. Requirements ==== | ==== 8.1. Requirements ==== | ||
- | - All LCD interface pin control will use //LATx//, // | + | - All LCD interface pin control will use PMP interface as described in the Unit 3 text. |
- Write a library of functions to provide general capability to display strings of text, characters, and numbers at specified positions on the LCD display. | - Write a library of functions to provide general capability to display strings of text, characters, and numbers at specified positions on the LCD display. | ||
- All LCD control sequences must meet the strict timing requirements for the following operations: | - All LCD control sequences must meet the strict timing requirements for the following operations: | ||
- | - Initialize the LCD using the recommended sequence of instructions shown in the control flow diagram | + | - Initialize the LCD using the recommended sequence of instructions |
- Position the cursor in the display space (Line 1 or Line 2) where the next character is to be displayed. | - Position the cursor in the display space (Line 1 or Line 2) where the next character is to be displayed. | ||
- | - Write function(s) that write ASCII control and display data to the Display Data Ram (DDRAM). | + | - Write function(s) that write ASCII control and display data to the Display Data Ram (DDRAM). |
- | - Translate the ASCII control characters into one or more C instructions for the LCD, as detailed in Table 8.1. | + | - Translate the ASCII control characters into one or more C instructions for the LCD as detailed in Table 8.1. |
- Write functions that write ASCII character data to the Display Data Ram (DDRAM). | - Write functions that write ASCII character data to the Display Data Ram (DDRAM). | ||
- Write a function that will write a single ASCII encoded character to the display. | - Write a function that will write a single ASCII encoded character to the display. | ||
- Write a function that will write a string (array) of ASCII encoded characters to the display. | - Write a function that will write a string (array) of ASCII encoded characters to the display. | ||
- | - Using the following program, develop a test project that will verify that the function | + | - Using the following program, develop a test project that will verify that the function LCD_puts(byte *str); correctly displays an array of ASCII text and control characters.< |
char test_str[] = “ User generated test string”; | char test_str[] = “ User generated test string”; | ||
int main(void) | int main(void) | ||
{ | { | ||
- | hardware_setup(void); | + | hardware_setup(void); |
LCD_init(); | LCD_init(); | ||
while(1) | while(1) | ||
{ | { | ||
LCD_puts(test_str); | LCD_puts(test_str); | ||
- | DelayMs(1000); | + | DelayMs(1000); |
LCDWrite(0x01); | LCDWrite(0x01); | ||
} | } | ||
} | } | ||
</ | </ | ||
- | - Write an application program for the BASYS MX3 processor board that achieves the following: | + | - Write an application program for the Basys MX3 processor board that achieves the following: |
- Initializes a loop counter to a value of zero. | - Initializes a loop counter to a value of zero. | ||
- Displays your name on the first line. | - Displays your name on the first line. | ||
- | - Repositions the cursor to the beginning of the second line and displays the text “LAB 3.” | + | - Repositions the cursor to the beginning of the second line and displays the text “Lab 3b.” |
- Repositions the cursor to the eighth character position of the second line. | - Repositions the cursor to the eighth character position of the second line. | ||
- Displays the value of the loop counter. | - Displays the value of the loop counter. | ||
- Increments the loop counter. | - Increments the loop counter. | ||
- Delays one second before repeating steps d through g. | - Delays one second before repeating steps d through g. | ||
+ | |||
**Table 8.1. LCD controls.** | **Table 8.1. LCD controls.** | ||
Line 109: | Line 114: | ||
==== 8.2. Design Phase ==== | ==== 8.2. Design Phase ==== | ||
- Generate a project in MPLAB X. | - Generate a project in MPLAB X. | ||
- | - Copy the config.bits file to the project directory. | + | - Copy the config.bits file to the project directory. |
- Open three new C files: main.c, lcd.c, and swdelay.c. | - Open three new C files: main.c, lcd.c, and swdelay.c. | ||
- Open two new header files: lcd.h and swdelay.h. | - Open two new header files: lcd.h and swdelay.h. | ||
- Generate the contents of the main.c file for the initialization code and the infinite loop. | - Generate the contents of the main.c file for the initialization code and the infinite loop. | ||
- | - In swdelay.c, generate a function prototype for the //msDelay(unsigned int dly);// function. | + | - In swdelay.c, generate a function prototype for the msDelay(unsigned int dly); function. |
- | - Copy the software delay function from Unit 2, Listing 3 to swdelay.c. | + | - Copy the software delay function from Unit 2, Listing |
- In lcd.h, generate function prototypes for the five LCD functions shown in Fig. B.1. | - In lcd.h, generate function prototypes for the five LCD functions shown in Fig. B.1. | ||
- | - Generate the code for the five LCD functions in lcd.c. | + | - Generate the code for the five LCD functions in lcd.c. |
==== 8.3. Construction Phase ==== | ==== 8.3. Construction Phase ==== | ||
Line 131: | Line 137: | ||
- List the processor hardware resources that you will be using in this design. | - List the processor hardware resources that you will be using in this design. | ||
- Generate a data flow diagram that identifies tasks (functions) and the information that needs to be passed between these tasks. | - Generate a data flow diagram that identifies tasks (functions) and the information that needs to be passed between these tasks. | ||
- | - Using the DFD and the multiple CFDs shown in Appendix B, develop and test the functions that will initialize the LCD and display single characters and a string of characters. You should use the? software delay function used in Lab 1b. | + | - Using the DFD and the multiple CFDs shown in Appendix B, develop and test the functions that will initialize the LCD and display single characters and a string of characters. You should use the software delay function used in Lab 1b. |
==== 8.4. Testing ==== | ==== 8.4. Testing ==== | ||
- Demonstrate that the test program developed for requirement 4 executes correctly using the test string “\0141234\0115678\0119ABC\r”. | - Demonstrate that the test program developed for requirement 4 executes correctly using the test string “\0141234\0115678\0119ABC\r”. | ||
- Demonstrate that the test program developed for requirement 5 executes correctly. | - Demonstrate that the test program developed for requirement 5 executes correctly. | ||
+ | |||
---- | ---- | ||
===== 9. Questions ===== | ===== 9. Questions ===== | ||
+ | - What are the advantages of using the PMP interface over the bit-banging interface? | ||
+ | - What are the advantages of using the bit-banging interface over the PMP interface? | ||
- How would the LCD display be affected if the application described above is combined with an application that uses interrupts? | - How would the LCD display be affected if the application described above is combined with an application that uses interrupts? | ||
- | - How can the blocking semaphore represented by the Busy Flag be eliminated? | ||
- What is the maximum rate at which characters can be written to the LCD? | - What is the maximum rate at which characters can be written to the LCD? | ||
+ | |||
---- | ---- | ||
Line 156: | Line 166: | ||
===== Appendix A: Basys MX3 Schematic Drawings ===== | ===== Appendix A: Basys MX3 Schematic Drawings ===== | ||
- | {{ : | + | {{ : |
//Figure A.1. LCD connection schematic diagram for Labs 3a and 3b.// | //Figure A.1. LCD connection schematic diagram for Labs 3a and 3b.// | ||
- | |||
---- | ---- | ||
Line 173: | Line 182: | ||
{{ : | {{ : | ||
- | //Figure B.3. Control flow diagram for LCD Write operation using bit-banging.// | + | //Figure B.4. Control flow diagram for LCD Write operation using bit-banging.// |
{{ : | {{ : | ||
//Figure B.5. LCD display character control flow diagram.// | //Figure B.5. LCD display character control flow diagram.// | ||
+ | |||
+ | ---- | ||
+ | |||
+ | [[{}/ | ||
+ | [[{}/ | ||
+ | [[{}/ | ||
+ |