DOC PREVIEW
UIUC GE 423 - Text LCD screen, DSP/BIOS and Transmission Control Protocol/Internet Protocol (TCPIP) Communication

This preview shows page 1-2-3-4 out of 11 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Mechatronics Laboratory Assignment 2Text LCD screen, DSP/BIOS and Transmission Control Protocol/Internet Protocol (TCPIP) CommunicationRecommended Due Date: By your lab time the week of February 10thPossible Points: If checked off before your lab time the week of Feb. 17th … 10 pointsIf checked off after your lab time the week of Feb. 17th and before your lab time the week of Feb. 24th … 7 pointsIf work not finished before your lab time the week of Feb. 24th … 0 pointsGE423, Mechatronic Systems Lab 2, Page 1 of 11 Mechatronics Laboratory Assignment 2 Text LCD screen, DSP/BIOS and Transmission Control Protocol/Internet Protocol (TCPIP) Communication Recommended Due Date: By your lab time the week of February 10th Possible Points: If checked off before your lab time the week of Feb. 17th … 10 points If checked off after your lab time the week of Feb. 17th and before your lab time the week of Feb. 24th … 7 points If work not finished before your lab time the week of Feb. 24th … 0 points Goals for this Lab Assignment: 1. Introduce the VB environment for PC-based monitoring of the robot 2. Learn to interface to the robot’s text LCD screen 3. Learn about DSP/BIOS tasks and software interrupts DSP/BIOS Objects Used: PRD, TSK, SEM_pend, SEM_post, SWI, SWI_post Library Functions Used: LCDPrintfLine Prelab: Explore the TMS320 DSP/BIOS User’s Guide (http://www.ti.com/lit/ug/spru423i/spru423i.pdf) 1. In the user’s guide, read the “About DSP/BIOS” section. You don’t have to understand all the details; just skim. 2. Also in the DSP/BIOS User’s Guide read through section 4.1 to get an introduction to Hardware interrupts (HWI), Software Interrupts (SWI), Tasks (TSK). Skim sections 4.2, 4.3, 4.4, and especially 4.7 (Semaphores). 3. Read your C book for information on how to use the ANSI C “printf” and “sprintf” functions. Make sure you know how to use the formatters for int %d, char %c, float %f and char array (string) %s. For example understand what this piece of code is doing (assume here that printf prints to your PC command console): char mystring[256]; int strsize; float gain = 1.3472; void myfunc(void) { strsize = sprintf(mystring,”Gain=%.2f”,gain); printf(“Size = %d, string=%s”,strsize,mystring); } 4. Each lab builds upon the result of the previous lab. You will have to recall many of the things you learned in previous labs, such as creating a PRD object, writing a function, creating a new project, etc. 5. Familiarize yourself with chapters 1-6 in the VB book “Teach Yourself VB 6 in 24 hours”. A number of copies of this book are found in the lab. Try to build a simple VB application with a push button and a text box before lab.GE423, Mechatronic Systems Lab 2, Page 2 of 11 Laboratory Exercise 1: A simple VB GUI interface In this portion of the lab, you will create a simple Visual Basic GUI from scratch to communicate with your robot. 1. Open up VB, create a new project by selecting “VB Pro Edition Controls” instead of the default “Standard EXE”, and immediately save it to a local directory. I suggest you save it somewhere in your checked-out repository where you will easily find it. 2. Open up the form view. a. Add 2 text boxes b. In the same manner. Add a Winsock control object. The Winsock object’s icon pictures two computers connected by a red line. c. Add a button 3. Using the properties option for each of the objects, rename the first text box to TXMessage, and the second text box to RXMessage. 4. Single-click on the Winsock object in the form view. Leave the default Winsock settings, except for the following: a. Name: Winsock1 b. Remote Host: Your Robot’s IP number (Ask your instructor) c. Remote Port 10001 5. In the form view, single click on your button. Change the name to “SendMessage”, and change the caption to “Send Message”. Also change the button’s property “Default” to True. When the “Default” setting of a button is set to true, the button’s code is run when you press the “Enter” key of the keyboard. 6. Double Click on the SendMessage button and insert the following code which causes VB to send the text you typed into the TXMessage text box along with the start character 253 and the stop character 255 every time you press the button. Winsock1.Senddata(Chr(253) & TXMessage.Text & Chr(255)) 7. Double click on any empty space in your form window and VB will pull up the Form_Load function. Add the following code to Form_Load: Winsock1.Connect 'Connect to TCPIP Server application running in Linux on the robot 8. Arrow to the very top of your form code above all the other functions. Add the following instruction and global variables: Option Explicit 'Forces you to declare all your variables Dim strNextString As String Dim RecieveData As String 9. At the top of VB’s code window select Form in the left pull down and in the right pull down select Unload. VB will then create the Form_Unload function. In this function as the following code: Winsock1.Close 10. Again at the top of VB’s code window select Winsock1 in the left pull down and in the right pull down select DataArrival. VB will then create the Winsock1_DataArrival function. This function is called when there is at least one character received over the Ethernet into VB. Most of the time this will be the entire string ofGE423, Mechatronic Systems Lab 2, Page 3 of 11 characters sent from the robot but the code must handle the case when the entire string is not sent thus a start and stop character are used. Add the following code inside this function (cut and paste): Dim intStart As Integer 'the index of StartChar Dim intEnd As Integer 'the index of EndChar Winsock1.GetData RecieveData, vbString strNextString = strNextString & RecieveData ' Append new com data intStart = InStr(strNextString, Chr(253)) 'Find the index of StartChar If (intStart > 0) Then strNextString = Mid(strNextString, intStart) intEnd = InStr(strNextString, Chr(255)) 'Find the index of EndChar If (intEnd > 1) Then 'If Start&End exist and Start comes before End RXMessage.Text = Mid(strNextString, 2, intEnd - 2) + " " 'Output the full message strNextString = Mid(strNextString, intEnd + 1) 'Trim off the message from our input stream End If End If Note that this code is handling error checking for you using the 253 and 255 bytes as stop and start characters. This means you


View Full Document

UIUC GE 423 - Text LCD screen, DSP/BIOS and Transmission Control Protocol/Internet Protocol (TCPIP) Communication

Documents in this Course
ARTWORK

ARTWORK

16 pages

Load more
Download Text LCD screen, DSP/BIOS and Transmission Control Protocol/Internet Protocol (TCPIP) Communication
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Text LCD screen, DSP/BIOS and Transmission Control Protocol/Internet Protocol (TCPIP) Communication and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Text LCD screen, DSP/BIOS and Transmission Control Protocol/Internet Protocol (TCPIP) Communication 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?