Showing posts with label MSP430. Show all posts
Showing posts with label MSP430. Show all posts

Tuesday, 25 October 2011

MSP430 running without power!

Well, not quite :D

I had plugged the Launchpad into USB for convenience but didn't have need for it yet, the code that was on the MSP430G2231 in the socket didn't do much besides blink the LEDs on P1.0 and P1.6

This was slightly annoying but instead of removing the USB cable (which tends to run away and hide) I decided to remove the VCC jumper from J3. My thinking was…
"This will cut power to the device and cease that annoying blinking!"
Turns out I was wrong! Have a look at the video :D

 

With the VCC jumper the LEDs blink bright, taking the VCC jumper off they still blink but not quite as bright.

Not shown in the video disconnecting the TXD or RXD line will reduce the brightness further, removing both will not allow the LEDs to light.

The above doesn't always seem to be true suggesting we are right on the limit of what the MSP430 can run on sourcing power through random pins.

In the code all pins are left at their default state except for P1.0 and P1.6 which are set to outputs.

Any ideas?

Wednesday, 12 October 2011

Notes on the MSP430 header files

Browsing MSP430 header files I came across a syntax I wasn't familiar with and searching online failed to give me a good explanation (or rather, I was missing the obvious) here is the section from the header file so hopefully you can find this via google :D

#define INCH_0 (0*0x1000u) /* Selects Channel 0 */
#define INCH_1 (1*0x1000u) /* Selects Channel 1 */
#define INCH_2 (2*0x1000u) /* Selects Channel 2 */
#define INCH_3 (3*0x1000u) /* Selects Channel 3 */
#define INCH_4 (4*0x1000u) /* Selects Channel 4 */
#define INCH_5 (5*0x1000u) /* Selects Channel 5 */
#define INCH_6 (6*0x1000u) /* Selects Channel 6 */
#define INCH_7 (7*0x1000u) /* Selects Channel 7 */
#define INCH_8 (8*0x1000u) /* Selects Channel 8 */
#define INCH_9 (9*0x1000u) /* Selects Channel 9 */
#define INCH_10 (10*0x1000u) /* Selects Channel 10 */
#define INCH_11 (11*0x1000u) /* Selects Channel 11 */
#define INCH_12 (12*0x1000u) /* Selects Channel 12 */
#define INCH_13 (13*0x1000u) /* Selects Channel 13 */
#define INCH_14 (14*0x1000u) /* Selects Channel 14 */
#define INCH_15 (15*0x1000u) /* Selects Channel 15 */


These definitions are used to set the input channel for the ADC, reading the family guide (slau144) Section 22.3.2 the above numbers should map to bits 15-12, notably INCH_10 should map to 1010 on those bits which is the internal temperature sensor where available.

But how does 10*0x1000u produce 1010?

Looking at the u threw me first, all that symbolises is that the number is unsigned. If it was signed the 15th bit would be to denote positive or negative but in this case its just a part of the number, for our purposes here we can ignore it.

The next problem I had was the multiplication. I opened up a programming calculator set to hex and typed in

10*1000 = 10000 and converted to binary 1 0000 0000 0000 0000

In a case of missing the obvious… The first set of digits isn't hex! Its decimal!

Decimal 10 = Hex A, A*1000 = A000 = 1010 0000 0000 0000