Msp430 Serial Example
Serial Communication using MSP430 UART(USCIA) In MSP430, serial communication is handled by an on chip peripheral called USCI (Universal Serial Communications Interface). In this example we are going to configure the MSP430 UART to transmit and receive at 9600bps with 8 databits,no Parity and 1 Stop bit. It makes using the MSP430 series boards a snap. And, by the way, makes for a great Arduino alternative. What is the MSP430. The MSP430 is a very capable processor. Behringer x1832usb manual. The G2x series feature lower power consumption than an AVR, while also being 16-bit. And if you remember the video game wars in the 90s, 16-bit is way better than 8-bit.
I had the same problem with the switched TX/RX pins on the launchpad. It took me a while to figure that one out.I wrote my own library for the G2533, but should also work for the C2553.The main difference is the addition of a uartwriteescaped function, which is useful while sending data of different lengths (that way you can have start/end bytes, and if your data contains that byte, it escapes it.)It also supports a callback function so you can have input processing functions when you receive data.It's still a work in progress though. Anytime a packet is received, an interrupt happens and an interrupt service routine(ISR) is called. This ISR gets the packet from the CC2500. Since people want to do different things with the packets, I chose not to process packets in the ISR.The callback function is called after a packet is received and is given the actual packet to process.What you do is come up with your own packet processing function and tell the cc2500 library about it.
That way it knows who tocall when a packet is received.The uartwriteescaped is more for sending whole packets through the serial peripheral to the computer. Normally you just send a stream of bytes. Unfortunately, there is no way for the computer to know when a stream of data begins or ends. This function uses the 0x7E byte as a start and end of packets.
This way, the receiver knows when to begin and end capturing data.If your data contains a 0x7E, that might confuse the receiver, so you must escape it by preceding it with a 0x7D and modifying it. The receiver must be aware of this to process it accordingly.The hextostring function was just for debugging.
When you want to display a value, you usually use printf. Unfortunately, printf takes a lot of cycles to format the data, and if you're doing time-sensitive stuff, you can't afford the delay. In cases where you don't have full debugging capability, you might want to print out the values of some registers or variables. The hextostring function converts a value to a hexadecimal string. You can concatenate the 'hello world' and 'rn' strings to make it 'hello worldrn'.
Also, almost all terminal applications do not require 'r', so you could just use 'hello worldn' as well.A little background: the character 'n' is short for ' newline' which is ascii character 10. 'r' is short for 'carriage return', which is ascii character 13. UNIX machines only use newline, while macs used to use only carriage return, dos/windows uses both.The backslash means the next character is an escaped character, hence the 'n' in 'n' bears a special meaning.
Would you want to output a backslash itself, you'd write '.Note again, that escape characters are one character, you need just one char to store 'n', as it is translated at compile time to the actual newline character. The length of the string 'hello worldrn' is 14 bytes; 5 for hello, 1 for the space, 5 for world, 1 for 'r', 1 for 'n' and one for the implicit '0', which indicates that this is the end of the string.if( (BIT3 & P1IN)0)if((P1IN & BIT3)0)if(!(P1IN&BIT3))Do all mean the same, which is 'do the following if the fourth bit of P1IN is equal to zero'. Which is P1.3 on the launchpad and is thus connected to the left switch.
Aktivmed GlucoCheck Comfort glucose meter- Printed circuit board below the LCD hosting an MSP 430 CPUThe MSP430 can be used for low powered. The drawn in idle mode can be less than 1 µA. The top CPU speed is 25 MHz.
It can be throttled back for lower power consumption. The MSP430 also uses six different low-power modes, which can disable unneeded clocks and CPU. Additionally, the MSP430 is capable of wake-up times below 1 microsecond, allowing the microcontroller to stay in sleep mode longer, minimizing its average current consumption.The device comes in a variety of configurations featuring the usual peripherals: internal, including, 10/12/14/16/24-bit, and reset. Some less usual peripheral options include (that can be used with the timers to do simple ADC), on-chip for, 12-bit, driver, and for ADC results. Apart from some older (MSP430E3xx) and high volume (MSP430Cxxx) versions, all of the devices are via (full four-wire or ) or a built in loader (BSL) using such as, or on devices with USB support.There are, however, limitations that preclude its use in more complex embedded systems. The MSP430 does not have an external, so it is limited to on-chip memory (up to 512 KB and 66 KB ) which may be too small for applications that require large buffers or data tables.
Also, although it has a DMA controller, it is very difficult to use it to move data off the chip due to a lack of a DMA output strobe. MSP430 part numbering. MSP430 NomenclatureAn MSP430 part number such as ' MSP430F2618ATZQWT-EP' consists of the following pieces:. MSP430: Standard prefix.
F: Indicates a memory type or specialized application. ' F' indicating is by far the most popular. Other options for memory type include ' C' for, ' FR' for, ' G' for Flash Value Line, and ' L' as in the MSP430L09x series, which indicates a RAM-only part; it must remain continuously powered to retain its programming. A second letter (except for 'FR') indicates a specialized application for the part. For example, ' G' is an optional specialization letter indicating hardware support for a specialized use. ' E' indicates special electricity meter functions, ' G' devices are designed for medical instrumentation, and ' W' devices include a special 'scan interface' designed for flow meters.
An exception is the MSP430FG2xx devices, which are considered a separate generation. 2: The generation of device. There can be significant changes to core peripherals (clock generators, UARTs, etc.) in different generations.
These are not in chronological order, but rather higher values roughly indicate greater size, complexity and cost. For example, generations 3 and 4 include LCD controllers which the others do not. 6: The model within the generation. This indicates the mixture of on-board peripheral devices and number of pins. 18: One or two digits indicating the amount of memory on the device.
The numbering is (mostly) consistent throughout the MSP430 series. Not all suffixes are valid with all models; most models are available in 3–6 memory sizes, chosen to match the other capabilities of the device. Larger numbers indicate increasing amounts of memory, but sometimes one type of memory (RAM or ROM) is sacrificed to fit more of the other.
MSP430 Memory configurationsSuffixRAMROMSuffixRAMROM01281 K105 K32 K11282 K1110 K48 K22564 K125 K55/56 K32568 K13451212 K14551216 K1561 K24 K164 K92 K71 K32 K178 K92 K82 K48K188 K116 K92 K60K194 K120 K. An optional suffix digit indicating a variant device, adding or deleting some analog peripherals. For example, a ' 1' suffix may indicate the addition of a comparator or deletion of an ADC. If the memory size is ' 1', this suffix can be confused with part of the memory size, but no single model is available in both '1' and '10' (or greater) memory sizes. An optional ' A' suffix indicating an upward-compatible revised version. The MSP430F11x1A has an additional 256 bytes of data flash not present in the plain 'F11x1.Trailing suffix letters indicate options not visible to software:. T: Indicates a temperature range of −40 °C to +105 °C.
ZQW: Indicates the package the part is kept in. ' ZQW' is a TI-specific name for a. T: Indicates that the parts are shipped in small reel (7-inch) packaging.EP: Indicates an additional feature. ' -Q1' specifies that the part is automotive qualified. ' -EP' and ' -HT' indicate extended temperature products.
Enhanced products, ' -EP', have a temperature range from -40 °C to 125 °C, and extreme temperature parts, ' -HT', have a temperature range from -56 °C to 150 °C.MSP430 generations There are six general generations of MSP430 processors. In order of development, they are the '3xx generation, the '1xx generation, the '4xx generation, the '2xx generation, the '5xx generation, and the '6xx generation. The digit after the generation identifies the model (generally higher model numbers are larger and more capable), the third digit identifies the amount of memory on board, and the fourth, if present, identifies a minor model variant. The most common variation is a different on-chip.The 3xx and 1xx generations are limited to a 16-bit address space. In the later generations this was expanded to include '430X' instructions that allow a 20-bit address space. As happened with other processor architectures (e.g. The processor of the ), extending the addressing range beyond the 16-bit word size introduced some peculiarities and inefficiencies for programs larger than 64 kBytes.In the following list, it helps to think of the typical 200 mAHr capacity of a lithium as 200,000 μAHr, or 22.8 μAyear.
Thus, considering only the CPU draw, such a battery could supply a 0.7 μA current draw for 32 years. (In reality, battery would reduce this number.)The significance of the 'RAM retention' vs the 'real-time clock mode' is that in real time clock mode the CPU can go to sleep with a clock running which will wake it up at a specific future time. In RAM retention mode, some external signal is required to wake it, e.g. I/O pin signal or SPI slave receive interrupt.MSP430x1xx series The is the basic generation without an embedded controller. They are generally smaller than the '3xx generation. – video on. ^ D.
Raskovic, and D. Thorsen, Transactions on Computers and Intelligent Systems, vol. 1(2), 2009. ^., Energia website.
published in magazine., Texas Instruments Embedded Processors Wiki. (PDF). Texas Instruments. Retrieved 9 July 2008. The size bit itself is named 'A/L', where 'L' (long) is used by other processors to indicate 32-bit operands.