Jump to content
43oh

Recommended Posts

Hello! I'm back with another sad question.

 

Simple question though.

 

Now that I seem to have a working UART interface, I have been wondering how to connect a launchpad to a GUI.

 

I would like to write this in C#.

 

I have the concept that it would be serial communication, so the launchpad would be the "Master" and the outside program would be considered the "Slave" right?

 

How does one go about something as simple as this? I know how to simply create a serial port program in c#, I just seem to not understand how to set the LaunchPad up as the master. Does that make sense? It seems like the code from TI is a bit wonky.

 

I apologize. I am still definitely quite lost with hardware -> software programming.

 

 

Link to post
Share on other sites

In C# - you're going to want to use System.IO.Ports.SerialPort - should be pretty simple to find examples online, but post back if you run into trouble there.

 

I'd suggest starting with something like Putty though - so that you can see the values.  

 

From the UART side of things - I don't think there is technically a "Master" unlike SPI.  

 

I've attached an "echo" example from Texas Instruments.  You'll find more on the product page for the 2553 - http://www.ti.com/product/msp430g2553#softTool.  Download the "MSP430G2x53, MSP430G2x33, MSP430G2x13, MSP430G2x03 Code Examples (Rev. C)" file.

msp430g2xx3_uscia0_uart_01_9600.c

Link to post
Share on other sites

I have been able to get things to run through PuTTY for about a week now.

I spent a good deal of time building a crude system in PuTTY to scroll through some options, etc.

 

But to get things to work in a simple GUI seems to be different.

 

I have built a simple GUI in C# with a serial port. It connects and such. I just can't seem to send and receive text. I want to get a simple send/receive text going for now, and go from there.

 

So I have a send box, I type "Hello" and click send, then my receive box will print "Hello"

But do I have to modify simple UART code for the MSP430?

 

I am confused here. I just have the simple USCI UART code going, very similar to the one you linked me to.

Link to post
Share on other sites
I would like to write this in C#.

I have the concept that it would be serial communication, so the launchpad would be the "Master" and the outside program would be considered the "Slave" right?

Well... no.... UART stands for "universal asynchronous receiver/transmitter". The key here is that UART is asynchronous, this means that contrary to (for example) I2C, SPI or USB, either end device can initiate a transmission to the other end in the exact same way.

The RS-232 standard adds some control signals to UART that do build on the concept of a slave and a master, but pure 3-wire serial (Rx, Tx, GND) does make no distinction at all in the master or slave role.

Mostly, the application that runs over UART has some mastre slave concept, ie: one end does only talk if the other end requests information from it, but this is application logic, not serial.

 

I guess that in C# there are helper classes called Master and Slave that add some of the bookkeeping inside the class to make it easier for the programmer to use, , but both would essentially still use a plain UART interface.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...