<< Chapter < Page Chapter >> Page >
Lab 8 deals with the benifits of using DMA and using RS232 as a communication protocol.

Direct memory access is a system to transfer data between peripheral modules and memory without using processor instructions. While its operation does occupy the memory bus, far fewer instructions require CPU interaction. This allows the CPU to work on other tasks simultaneously, or it may be be put into a low power mode.

Dma powered voltmeter

The DMA module allows you to automatically move data between memory locations. This will also allow us to automate much of your program's execution.

  • Set up the DMA module to automatically transfer the data from the ADC to the DAC. Transfer the input from the ADC1 to DAC0 and ADC0 to DAC1. Sampling should be interrupt enabled.
  • Measure the peak-to-peak amplitude of the input signal to ADC0 using the processor. Units are irrelevant. Display the amplitude on the seven segment display. You should have at least 4 different possible levels.

Got questions? Get instant answers now!

Rs232

We will configure the serial port (RS232) to transmit data. Just like before create a new project and do the following: disable the watchdog timer, and initialize the master clock and i2c. This should now be standard for all new projects. To set up the UART to use RS232 we must set the following registers:

  • Reset UICTL (on its own line of code)
  • Set the character length to 8-bits
  • Set U1TCTL to enable ACLK as the BRCLK clock.
  • The baud rate should have the following settings: U1BR0 = 0x7c; and U1BR1 = 0x01; This will set the baud rate at 19,200 bits per second.
  • Set ME2 to enable both transmit and receive.
  • Enable UART_TX and UART_RX on the msp (Hint: use P3SEL)
  • Set UART_TX as an output pin.

To transmit data, check if the UTXIFG1 flag is set in UTXIFG1. Once the flag is set you may write directly to TXBUF1, and that data will be transmitted. Now, come up with an array of ASCII characters in hexadecimal notation, and load each character in the TXBUF1 one at a time. Don't for get to add a new line character, /n , at the end of your message.

To test your project open up HyperTerminal, and set the correct baud rate (19200). All other default settings should be fine. If you correctly configured the UART then you should see your message in the terminal.

Got questions? Get instant answers now!

Once you have verified that you can transmit data to the serial port, load the TXBUF1 via DMA. You may trigger the DMA any way you wish. This will eliminate most of the work that the processor has to do.

Modify the first problem so that you input something into ADC0 and DMA the samples to the serial port. Come up with some way for a computer to read those values, HyperTerminal or otherwise.

Got questions? Get instant answers now!

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Microcontroller and embedded systems laboratory. OpenStax CNX. Feb 11, 2006 Download for free at http://cnx.org/content/col10215/1.29
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Microcontroller and embedded systems laboratory' conversation and receive update notifications?

Ask