Jump to content
43oh

MSPhere - Arduino-like framework of functions for the MSP430


Recommended Posts

As initiator of this framework and this thread, I would like to make a motion to end all of the silly bickering this thread currently contains. It's not good for anyone or anything, and I'm sorry for being a bit too hasty to snap at the bit myself. So, I suggest we just turn this back into a feedback and updates thread. I welcome any comments/criticism about the framework itself and it's use, and from this point forward I will (and would like to encourage everyone else to) take it for what it is.

 

Again, I apologize for my reactions. But I would like to see this thing forward.

 

Thanks for reading,

-->suspended-chord/gatesphere

Link to post
Share on other sites
  • Replies 37
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Hello all,   If you've been reading my posts, you might have heard me mention a framework I've been working on for the MSP430 to bring the Arduino functions and programming paradigm to the MSP430--i

All I meant to say was: I know you more experienced guys won't be on the same page/book as us beginners with this chip for very long, but while you are I hope some of you will leave behind enough bits & pieces of your knowledge at a basic level that focus on the chip without extra layers/knowledge barriers, so those of us without any experience can pickup enough from you to get started and learn the rest ourselves.

 

I'm not sure ti's examples/documents are the best to learn from. I think I'd be trying to get the launchpad genie to come out.

I know I can release the smoke, but I'll need some help with the genie.

Link to post
Share on other sites

Well, I'm actually a beginner with the MSP430 myself. In fact, I just got into microcontrollers in general this summer. So I am where you are, and I probably will be for a long time. I'm actually writing this as a way to teach myself bitshifting and all of that good stuff so that I have the knowledge to write the code you are talking about, without the crutch of this library.

 

Also, I'm working on the documentation at the moment. I think it's quite thorough at the moment, considering how small the library is so far. Feel free to check it out: http://wiki.suspended-chord.info/wikka. ... ka=MSPhere

Link to post
Share on other sites
Well, I'm actually a beginner with the MSP430 myself. In fact, I just got into microcontrollers in general this summer. So I am where you are, and I probably will be for a long time. I'm actually writing this as a way to teach myself bitshifting and all of that good stuff so that I have the knowledge to write the code you are talking about, without the crutch of this library.

 

Same here. I've also entertained thoughts of creating library during the learning process but I don't yet have enough experience to know what material would be suitable. The MSP430 is the first opportunity I've had to program a uc and I'm loving the experience.

Link to post
Share on other sites

" // pins 0-7 are P1.0-P1.7, pins 8-16 are P2.0-P2.7"

This won't work properly without first converting into hex, or decimal representation of binary, unless I missed that part, also pin 2.7 needs to have P2SEL cleared when used as an input (footnote@p6).

 

I think you're missing a primer on pin usage, I just wrote this, its not complete, might not be completely accurate, and public domain in its current form.

The pins of the msp430 are grouped into groups of up to 8 pins, a group of pins is called a port, for the value line it has 10 pins and 2 ports.
Inside each port the pins are controlled by various 8-bit status registers.
Binary representation of an 8-bit status register: 0000000, each placeholder represents one bit, each bit represents a pin, each bit can be either 0(LOW) or 1(HIGH)

These are just a few of the port status registers:
PxDIR used to set the pin as input(0) or output(1)
PxOUT used to set the pin as off(0), or on(1)
PxSEL used to set the pin to normal mode(0) or to use the pins internal function(1)
*replace x with the port number

common methods used to change the pin bits.
=  used to sets the entire register to the value you specify
|= used to set only the bits you specify to 1(HIGH)
&= ~ used to clear only the bits you specify to 0(LOW)
^=   used to alternate between 1(HIGH)/0(LOW) of the bits you specify

various formats of values used to represent the bits:
0x00-0xFF 
0-255: decimal representation of binary/hex value.
BIT0-BITF

I wish I saw this earlier: http://justinstech.org/2010/08/msp430-b ... ng-part-1/

I wouldn't have had so much trouble figuring out some of the stuff myself.

Link to post
Share on other sites
" // pins 0-7 are P1.0-P1.7, pins 8-16 are P2.0-P2.7"

This won't work properly without first converting into hex, or decimal representation of binary, unless I missed that part,

 

It works, I have all the conversions in place. When any of the functions that takes a pin number is called, it first checks to see if the number is greater than 7. Then it sets a variable called port depending on the number (0 <= pin <= 7, port = 1; 8 <= pin <= 15, port = 2). If pin > 7, it subtracts 8 from pin, and reassigns the value. I figured since there will only ever be P1 and P2 on the 20-pin DIPs, it was safe to assume that only those would be used. This library does target the LaunchPad, after all.

 

also pin 2.7 needs to have P2SEL cleared when used as an input (footnote@p6).

Thanks, I didn't remember that bit. I just tested it, and you're correct. I'm going to be adding a few more register manipulation functions to the library to deal with the other Px registers. P2.6 also has it set to 1 by default.

 

This is why I need the community :)

Link to post
Share on other sites

That part will work fine, but setting a pin like this won't work:

pin =3 ;

P1DIR |= pin;

binary representation of decimal: 3=00000011, 4=00000100, 8=00001000, pins: x.0=1, x.1=2, x.2=4, x.3=8,x.4=16,x.5=32, x.6=64, x.7=128.

To assign decimal numbers to pins like that you need something that converts it to a binary representation, either hex, or decimal: 1=1,2=2,3=4, 4=8, 5=16, 6=32, 7=64,8=128,

 

 

Sorry about my earlier complaint, this is more of what/how I was hoping would happen, It sounded like you were done and that I/beginners would have no chance to learn from something like: hardware/arduino/cores/arduino.

Link to post
Share on other sites
That part will work fine, but setting a pin like this won't work:

pin =3 ;

P1DIR |= pin;

 

Ah. Well, I never intended for there to be a universal remapping like the example you are thinking. My functions are built on top of the registers. While still providing access to them, they are designed to abstract away from them. So yeah, that example won't work, and at least to as far as I plan to take this framework, never will. I intended to just provide the option for simple bit writes, while leaving the low-level options available, in the same way that the Arduino platform does (one may use the digital I/O functions, or optionally use the low-level bit registers with Arduino).

 

So yes, you are right. I might have been a bit misleading in my announcements, but the pin remapping only works within the constructs of the framework.

 

Sorry about my earlier complaint, this is more of what/how I was hoping would happen, It sounded like you were done and that I/beginners would have no chance to learn from something like: hardware/arduino/cores/arduino.

 

It's not a problem. The only reason that the Arduino is so popular is because it has a devoted community with the knowledge to help out those who wish to dive deeper, while at the same time allowing the low-level to be abstracted away for those who wish to simply prototype rapidly. I am simply trying to help get both knowledge and options out there, and build the community up a bit.

 

It's all water under the bridge to me :)

Link to post
Share on other sites

Sry to be off topic but, Doc, I had no idea the app inventor was that simple! Very cool! I planned on writing an app eventually for my project when I got to the point where it would use bluetooth and was worried I'd have to learn yet another language, my head is crammed full of them. Now I'm excited for when I can get to the point of using bluetooth! But that is far away. Cool stuff.

 

I wont throw my other cent in because enough was probably said.

 

There my 2 (1) cents worth.

 

Now here's a suggestion. About 7 years ago or so, there was a microcomputer language where you could do the following. P1OUT.4 = 1; instead of P1OUT = BIT4;. This could be done for ANY register, it provided very very readable code. Since it was so long ago and I was really young, I forget exactly where I saw that. Adding this kind of functionality though would involve doing some quite complex things in c, and might mean writing your own interpreter/compiler for the MSP430. Probably waaay outta the scope of this project, but thought I'd throw the idea out there.

 

NJC

_________________________

http://msp430launchpad.com

Link to post
Share on other sites
Now here's a suggestion. About 7 years ago or so, there was a microcomputer language where you could do the following. P1OUT.4 = 1; instead of P1OUT = BIT4;. This could be done for ANY register, it provided very very readable code. Since it was so long ago and I was really young, I forget exactly where I saw that. Adding this kind of functionality though would involve doing some quite complex things in c, and might mean writing your own interpreter/compiler for the MSP430. Probably waaay outta the scope of this project, but thought I'd throw the idea out there.

 

Actually, if you look up information about the io430xxxxx.h files, they include this ability... in a roundabout way (P5OUT_bit.P5OUT_0 = 1is the syntax for those headers). But they are maintained by IAR, not TI, so I am not sure whether or not they are included with or compatible with CCS or MSPGCC4. As for doing it myself, I intend for this library to be cross platform (later on down the road, although at the moment it doesn't require any specific environment), so I don't think using these headers would be an option. But I see where you're coming from with that, it is helpful.

Link to post
Share on other sites

Update:

 

Class is in full swing again, so my time to work on MSPhere is shrinking. I have however re-factored a few of the functions to reduce code bloat, and decided on exactly which functions and modules will be in the initial release.

 

I have also created a small library for the TLV5620 from TI. It's a quad-channel 8-bit DAC with simultaneous update and 1X-2X amplifier available in a 14-pin DIP. It is also available in TI's sample program (in quantities of five), which is where I obtained my chips from. Library and example code (quad waveform streamer) will be available once I am able to test. I intend on developing an audio synthesis shield around this chip should testing prove successful.

 

So, in essence: MSPhere coming soon, TLV5620 library coming sooner.

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...