Jump to content
43oh

Antscran

Members
  • Content Count

    47
  • Joined

  • Last visited

  • Days Won

    6

Reputation Activity

  1. Like
    Antscran got a reaction from bluehash in MSP430 voice control over bluetooth   
    Hi all,
     
    I was playing around with the MSP430G2553 and the UART at the weekend, then remembered I had a cheap HC06 bluetooth module.  The result being a basic Android app that you can control your launchpad using voice control, it's far from polished but a bit of fun all the same 
     
    Project tutorial. C code and Android App http://coder-tronics.com/msp430-voice-control-over-bluetooth/
    Video demonstration  https://www.youtube.com/watch?v=8Z5ixK30Ddc
     
    Cheers,
    Ant
  2. Like
    Antscran got a reaction from Automate in MSP430 voice control over bluetooth   
    Hi all,
     
    I was playing around with the MSP430G2553 and the UART at the weekend, then remembered I had a cheap HC06 bluetooth module.  The result being a basic Android app that you can control your launchpad using voice control, it's far from polished but a bit of fun all the same 
     
    Project tutorial. C code and Android App http://coder-tronics.com/msp430-voice-control-over-bluetooth/
    Video demonstration  https://www.youtube.com/watch?v=8Z5ixK30Ddc
     
    Cheers,
    Ant
  3. Like
    Antscran got a reaction from spirilis in C2000 Launchpad Solar MPPT Project and Tutorial   
    Trey,
     
    Cheers for the comments much appreciated.  I am fairly new to C programming (2 years) and have a lot to learn still, mainly in the larger program structures using struct and typedef.  Have read lots of tutorials and as such have found some that are great and others that are lacking, so trying to make sure any tutorials I write are as easy to understand and clear.  It also helps me understand the subject matter better, when trying to explain it.
     
    A big fan of open source and sharing of ideas and knowledge, it's definitely the way forward.
     
    Ant
  4. Like
    Antscran got a reaction from bluehash in List of MSP430 Webpages and Blogs   
    Can I get mine added to the list http://www.coder-tronics.com/category/msp430/
     
    Cheers,
    Ant
  5. Like
    Antscran got a reaction from sol25 in MSP430G2553 on breadboard   
    The Launchpad user guide has a nice circuit diagram to follow if need be, and has all the components already mentioned, see page 16 for the MSP430G Launchpad.
     
    http://www.ti.com/lit/ug/slau318e/slau318e.pdf
  6. Like
    Antscran got a reaction from Rickta59 in Oversampling, averaging and getting confused.   
    Bit late to the party on this post, but I found the graphing tool in Code Composer Studio very useful to see the direct effects of over sampling.  It's not the fasted refresh rate, as in the debug mode you can only get a 100mS maximum refresh rate, but it's really good to see trends in data.
     
    This video shows it in action https://www.youtube.com/watch?v=AV4J9uGyiKo&list=UUUIN5H4aVjwwqXUS39_CEBQ
     
    I also did some tests with a digital filter using the graph tool and comparing the unfiltered data with the filtered.  Both images below are of the same filter, if you refresh the data after the initial start condition, then you get a smaller resolution so effectively zoom in.
     

     

     
    Cheers,
    Ant
  7. Like
    Antscran got a reaction from roadrunner84 in Made a couple of MSP430 tutorials   
    Hi all,
     
    I have made a couple of MSP430 Tutorials and thought I would share the links here:
     
    ADC tutorial and example code
    I did this one awhile ago and just covers the ADC with 3 example codes, multiple channels, multiple reads etc
    http://coder-tronics.com/msp430-adc-tutorial/
     
    Timer tutorial and example code
    Only posted recently and covers both timers on the MSP430G2253, again with 3 examples PWM, interrupts etc.
    http://coder-tronics.com/msp430-timer-tutorial/
     
    Programming tutorial covering the GPIO and peripheral registers
    I found this all a little confusing when I started out and had a question from someone recently, so thought I would try and break it down into simple terms.
    http://coder-tronics.com/msp430-programming-tutorial-pt1/
    http://coder-tronics.com/msp430-programming-tutorial-pt2/
     
    Switch Debouncing tutorial with several MSP430 code examples
    Just some useful information on switch debouncing as well as some code useful code examples
    http://coder-tronics.com/switch-debouncing-tutorial-pt1/
    http://coder-tronics.com/switch-debouncing-tutorial-pt2/
     
    Hopefully they are of some use  ,
     
    Cheers,
    Ant
  8. Like
    Antscran reacted to bobnova in Made a couple of MSP430 tutorials   
    I read through a couple of your linked articles, they are going to be useful to me.
    Thanks!
  9. Like
    Antscran reacted to zeke in Made a couple of MSP430 tutorials   
    I like your state machine articles. Good job!
  10. Like
    Antscran got a reaction from RobG in Made a couple of MSP430 tutorials   
    Hi all,
     
    I have made a couple of MSP430 Tutorials and thought I would share the links here:
     
    ADC tutorial and example code
    I did this one awhile ago and just covers the ADC with 3 example codes, multiple channels, multiple reads etc
    http://coder-tronics.com/msp430-adc-tutorial/
     
    Timer tutorial and example code
    Only posted recently and covers both timers on the MSP430G2253, again with 3 examples PWM, interrupts etc.
    http://coder-tronics.com/msp430-timer-tutorial/
     
    Programming tutorial covering the GPIO and peripheral registers
    I found this all a little confusing when I started out and had a question from someone recently, so thought I would try and break it down into simple terms.
    http://coder-tronics.com/msp430-programming-tutorial-pt1/
    http://coder-tronics.com/msp430-programming-tutorial-pt2/
     
    Switch Debouncing tutorial with several MSP430 code examples
    Just some useful information on switch debouncing as well as some code useful code examples
    http://coder-tronics.com/switch-debouncing-tutorial-pt1/
    http://coder-tronics.com/switch-debouncing-tutorial-pt2/
     
    Hopefully they are of some use  ,
     
    Cheers,
    Ant
  11. Like
    Antscran got a reaction from bobnova in Made a couple of MSP430 tutorials   
    Hi all,
     
    I have made a couple of MSP430 Tutorials and thought I would share the links here:
     
    ADC tutorial and example code
    I did this one awhile ago and just covers the ADC with 3 example codes, multiple channels, multiple reads etc
    http://coder-tronics.com/msp430-adc-tutorial/
     
    Timer tutorial and example code
    Only posted recently and covers both timers on the MSP430G2253, again with 3 examples PWM, interrupts etc.
    http://coder-tronics.com/msp430-timer-tutorial/
     
    Programming tutorial covering the GPIO and peripheral registers
    I found this all a little confusing when I started out and had a question from someone recently, so thought I would try and break it down into simple terms.
    http://coder-tronics.com/msp430-programming-tutorial-pt1/
    http://coder-tronics.com/msp430-programming-tutorial-pt2/
     
    Switch Debouncing tutorial with several MSP430 code examples
    Just some useful information on switch debouncing as well as some code useful code examples
    http://coder-tronics.com/switch-debouncing-tutorial-pt1/
    http://coder-tronics.com/switch-debouncing-tutorial-pt2/
     
    Hopefully they are of some use  ,
     
    Cheers,
    Ant
  12. Like
    Antscran got a reaction from zeke in Made a couple of MSP430 tutorials   
    Hi all,
     
    I have made a couple of MSP430 Tutorials and thought I would share the links here:
     
    ADC tutorial and example code
    I did this one awhile ago and just covers the ADC with 3 example codes, multiple channels, multiple reads etc
    http://coder-tronics.com/msp430-adc-tutorial/
     
    Timer tutorial and example code
    Only posted recently and covers both timers on the MSP430G2253, again with 3 examples PWM, interrupts etc.
    http://coder-tronics.com/msp430-timer-tutorial/
     
    Programming tutorial covering the GPIO and peripheral registers
    I found this all a little confusing when I started out and had a question from someone recently, so thought I would try and break it down into simple terms.
    http://coder-tronics.com/msp430-programming-tutorial-pt1/
    http://coder-tronics.com/msp430-programming-tutorial-pt2/
     
    Switch Debouncing tutorial with several MSP430 code examples
    Just some useful information on switch debouncing as well as some code useful code examples
    http://coder-tronics.com/switch-debouncing-tutorial-pt1/
    http://coder-tronics.com/switch-debouncing-tutorial-pt2/
     
    Hopefully they are of some use  ,
     
    Cheers,
    Ant
  13. Like
    Antscran got a reaction from xxx1 in Made a couple of MSP430 tutorials   
    Hi all,
     
    I have made a couple of MSP430 Tutorials and thought I would share the links here:
     
    ADC tutorial and example code
    I did this one awhile ago and just covers the ADC with 3 example codes, multiple channels, multiple reads etc
    http://coder-tronics.com/msp430-adc-tutorial/
     
    Timer tutorial and example code
    Only posted recently and covers both timers on the MSP430G2253, again with 3 examples PWM, interrupts etc.
    http://coder-tronics.com/msp430-timer-tutorial/
     
    Programming tutorial covering the GPIO and peripheral registers
    I found this all a little confusing when I started out and had a question from someone recently, so thought I would try and break it down into simple terms.
    http://coder-tronics.com/msp430-programming-tutorial-pt1/
    http://coder-tronics.com/msp430-programming-tutorial-pt2/
     
    Switch Debouncing tutorial with several MSP430 code examples
    Just some useful information on switch debouncing as well as some code useful code examples
    http://coder-tronics.com/switch-debouncing-tutorial-pt1/
    http://coder-tronics.com/switch-debouncing-tutorial-pt2/
     
    Hopefully they are of some use  ,
     
    Cheers,
    Ant
  14. Like
    Antscran got a reaction from spirilis in C2000 Launchpad Solar MPPT Project and Tutorial   
    Hi All,
     
    Just finished off writing up a tutorial about a project I did earlier this year.  It's a solar maximum power point tracker (MPPT), based on the C2000 Launchpad.  There are some links to the project and tutorial below as well as a few videos on YouTube, all the code is also downloadable.
     

     
    I intend to work on a second iteration at some point with some larger panels, and a battery charging state machine.
     
    http://coder-tronics.com/c2000-solar-mppt-tutorial-pt1/
    http://coder-tronics.com/c2000-solar-mppt-tutorial-pt2/
    http://coder-tronics.com/c2000-solar-mppt-tutorial-pt3/
    http://coder-tronics.com/c2000-solar-mppt-tutorial-pt4/
     
    https://www.youtube.com/watch?v=XJc2RtL-iBk&list=UUUIN5H4aVjwwqXUS39_CEBQ
    https://www.youtube.com/watch?v=AV4J9uGyiKo&list=UUUIN5H4aVjwwqXUS39_CEBQ
     
    Comments welcome on improvements etc.
     
    Cheers,
    Ant
  15. Like
    Antscran got a reaction from L.R.A in Made a couple of MSP430 tutorials   
    Hi all,
     
    I have made a couple of MSP430 Tutorials and thought I would share the links here:
     
    ADC tutorial and example code
    I did this one awhile ago and just covers the ADC with 3 example codes, multiple channels, multiple reads etc
    http://coder-tronics.com/msp430-adc-tutorial/
     
    Timer tutorial and example code
    Only posted recently and covers both timers on the MSP430G2253, again with 3 examples PWM, interrupts etc.
    http://coder-tronics.com/msp430-timer-tutorial/
     
    Programming tutorial covering the GPIO and peripheral registers
    I found this all a little confusing when I started out and had a question from someone recently, so thought I would try and break it down into simple terms.
    http://coder-tronics.com/msp430-programming-tutorial-pt1/
    http://coder-tronics.com/msp430-programming-tutorial-pt2/
     
    Switch Debouncing tutorial with several MSP430 code examples
    Just some useful information on switch debouncing as well as some code useful code examples
    http://coder-tronics.com/switch-debouncing-tutorial-pt1/
    http://coder-tronics.com/switch-debouncing-tutorial-pt2/
     
    Hopefully they are of some use  ,
     
    Cheers,
    Ant
  16. Like
    Antscran got a reaction from TI_Trey in C2000 Launchpad Solar MPPT Project and Tutorial   
    Hi All,
     
    Just finished off writing up a tutorial about a project I did earlier this year.  It's a solar maximum power point tracker (MPPT), based on the C2000 Launchpad.  There are some links to the project and tutorial below as well as a few videos on YouTube, all the code is also downloadable.
     

     
    I intend to work on a second iteration at some point with some larger panels, and a battery charging state machine.
     
    http://coder-tronics.com/c2000-solar-mppt-tutorial-pt1/
    http://coder-tronics.com/c2000-solar-mppt-tutorial-pt2/
    http://coder-tronics.com/c2000-solar-mppt-tutorial-pt3/
    http://coder-tronics.com/c2000-solar-mppt-tutorial-pt4/
     
    https://www.youtube.com/watch?v=XJc2RtL-iBk&list=UUUIN5H4aVjwwqXUS39_CEBQ
    https://www.youtube.com/watch?v=AV4J9uGyiKo&list=UUUIN5H4aVjwwqXUS39_CEBQ
     
    Comments welcome on improvements etc.
     
    Cheers,
    Ant
  17. Like
    Antscran reacted to roadrunner84 in State Machine Tutorial   
    A little on pointers, just for the fun of it.
     
    Pointer may seem complex and intimidating at first, but if you keep a little track of the type of something, it's quite understandable.
     
    C knows basically only one type: a scalar. This means that anything can be represented as a number. A string is a series of numbers representing letters, a boolean is a number (0 or 1), an integer is a number, a loating point is a set of numbers representing a fractional value and a pointer is a number of the address of something else in memory.
    These numbers are very powerful and very versatile, this is why you need to take care that you know what a certain number means.
    int x = 0; // x is an alias to a number; the number 0 int* p = 0; // p is a pointer to a number; the memory address 0 char s[] = "0"; // s is a pointer to a series of characters; the first character is the digit 0 char s2[] = "\0"; // s2 is a pointer to a series of characters; the first character is the NUL character There are two special symbols associated with the use of pointers, the * (asterisk) and the & (ampersand). The confusing thing is that their meaning differs in the context.
    int x; int* p = &x; // int* is the type of p, this is "pointer to integer" *p = 5; // *p means "use the value that p is pointing to". Since p is pointing to an integer, x in this case, x will become 5 p = 5; // WRONG: set p to point to memory address 5 p = &x; // &x means "use the address of x"; p will become the address of x; p points to x int a[4]; // a is an array, this is equal to "a points to the start of a consecutive series of 4 unnamed integers" p = a; // since both p is a pointer to int and a is a pointer to int, we can let p become a or "let the pointer p become the same address as the pointer a" int b[4]; // b is also a pointer to a series of 4 integers b = a; // WRONG: both b and a are pointers, so C won't complain, but you just lost a pointer to the series of 4 integers that b used to point to; this is called memory leak int d[8]; p = a; a = d; d = p; // since we used p as a temporary for a, we can use this to exchange the pointer values of a and d. // note that since a pointed to a series of 4 and d pointed to a series of 8, that now the opposite is the case, I'm not sure how your compiler will behave: int e[2]; void foo(void) { int b[4]; int* p; p = e; e = b; b = p; // normally the array b will be disposed of at function end, but will the compiler drop 4 integers or 2 integers? // best practice is to never assign to the array, but only to pointers } void bar(void) { int b[4]; int* p; int* q; p = e; q = b; // now use p and q where you wanted to use b and e. } As you can see, an array is secretly a pointer to a series of values, this means that we can use array indexing and * (pointer dereferencing) in mixed order:
    int a[4]; int* p = a; p[2] = 5; // a[2] will become 5 *a + 3 = 2; // a[3] will become 2 Things become really interesting when using arrays of pointers
    int a=1; int b=2; int c=3; int* q = &c; // q points to the address of c int* p[3] = {&a, &b, q}; // p is an array of pointers to integers, so p points to a series of pointers to integers int** r = p; // r is a pointer to a pointer to integers, so *r is a series of pointers to integers *(*p + 1) = 5; // equal to *(p[1]) or even equal to p[1][0], all which are equal to b, since p[1] is a pointer to b q = &a; // this only affects q, since p copied the address held by q, so p[2] still is equal to c p[2]=4; // c becomes 4 *q = 0; // a becomes 0 q[0] = 3; // a becomes 3 Things get a little confusing when we're talking about pointers to functions, this is because pointer dereference and address referencing is optional for functions.
    void foo(void) { // do something } foo(); // the compiler will save the current instruction pointer and load the address of foo in the instruction pointer // then when foo is done, it will load the saved instruction pointer back to the instruction pointer, so execution continues just after the call to foo void (* bar)(void); // this is a variable called bar, it is a pointer to a function that looks like void name(void) bar = &foo; // bar is now pointing to the function foo bar = foo; // C accepts omitting the & when talking function pointers, try to avoid this form if you're new to pointers (*bar)(); // do a call to the function that bar points to; call foo bar(); // C accepts omitting the * when talking function pointers, here again. So this also calls foo bar = foo(); // WRONG: try to assign the return value of foo (void) to bar typedef int number; // this is a type definition; the type number is now equal to the type int typedef void(*voidfunc)(void); // this is a type definition; voidfunc is now equal to void(*name)(void) voidfunc baz; // baz is a variable, it is a pointer to a function that looks like void name(void) constant pointers and pointers to constants
    Take notice that pointers don't need to point to the same value throughout the program, unlike variables (and just like variable values).
    C has the keyword const to denote that a value may never change. In the case of the MSP430 this is also used to place a value in flash instead of ram (since you promised not to change it anyway, in AVR you must use the PROGMEM attribute to force a value to flash).
    int x; // x holds a variable value; const int y=5; // y hold a constant value 5, so y will never ever change const int z; // WRONG: since z will never change, you must assign it a value at declaration const int* p = &y; // p points to the constant integer y int const* q = &y; // q points to the constant integer y int * const r = &x; // r is a constant pointer to the integer x, so r will never change, but it's dereferenced value (the value of *r or x) may change int * const s = &y; // WRONG: since y is a const int, s must be a pointer to constant integer, but it is a constant pointer to integer const int * const t = &y; // t is a constant pointer to a constant integer; neither t nor *t (y) may change value As you can see, the const keyword may come before or after the type int. But when placing the const keyword after the * it is a property of the pointer, not a property of the type int.
     
    buffer overflow
    Whenever you're working with arrays and/or pointers, take much care to not cross the boundaries of the actually allocated memory
    int a[4]; // a is 4 integers long: a[0], a[1], a[2] and a[3]. int* p = a; // p points to a[0] p[1] = 5; // p[1] is a[1] and becomes 5 p[4] = 4; // WRONG: p[4] is a[4] which is the memory location after a[3], but we've never allocated this memory. You might be overwriting something else! void fillbuffer(int* buffer, int length, int value) // fill a buffer named buffer of length length with value value { for(int iter = 0; iter <= length; iter++) // WRONG: iter should be less, not less or equal to length { *buffer = value; // write value to the element buffer is pointing to buffer++; // increment the address in buffer by 1 element } } const int len = 5; int b[len]; // b is now 5 integers large p =b; // p now points to b[0] fillbuffer(p, len, 0); // write the value 0 to all elements of p //WARNING: are you sure that your function is doing what it should do? void fillbuffer2(int* buffer, int max_elem, int value) // fill a buffer named buffer of length max_elem - 1 with value value { for(int iter = 0; iter <= max_elem; iter++) // WARNING: will the user pass the right value to max_elem? { *buffer = value; // write value to the element buffer is pointing to buffer++; // increment the address in buffer by 1 element } } const int len2 = 5; int b2[len2]; // b2 is now 5 integers large p2 =b2; // p2 now points to b[0] fillbuffer2(p2, len2 - 1, 0); // write the value 0 to all elements of p2 //WARNING: these "off by 1" situations happen a lot! always be sure you're doing it right I hope this sheds some light on the behaviour of pointers. It is a lot, and you need to be really sure to always use the right symbol at the right time. This is what makes C an unsafe language and what causes 90% of all security leaks in software. Languages like C# and Java try to fix this by monitoring memory overflows or restrict pointery stuff, in which they succeed for less than 100%. Javascript et al. do not support fixed-length arrays or pointers, which causes the language itself to be safe, but not all implementations are.
  18. Like
    Antscran reacted to roadrunner84 in State Machine Tutorial   
    Sorry, my bad. As you can see in the statemachine function declaration, it expects both the input events and the current state, so you should call it like this:
    Current_State = StateMachine( ReadKeyInput(), Current_State);
     
    The enums shouldn't be changed.
    By the way, whenever you're using enums to enumerate something, also use them as type for the parameters to expect. I know C accepts an int to be passed an enum, but you shouldn't treat enums as ints ever.
  19. Like
    Antscran reacted to Rei Vilo in State Machine Tutorial   
    Thanks for sharing.
     
    I'm using FSM for my robotics models. Parallel processes managed by the same MCU are coordinated with FSM. The same approach was later extended to different MCUs through a Bluetooth LAN.
     

     
    I read the training Electrical Engineering and Computer Science from the 
     
    I describe the whole approach in Dealing with Very Large Models.
  20. Like
    Antscran reacted to roadrunner84 in State Machine Tutorial   
    Looking nice. I do have some suggestions for enhancement.
     
    First, I try to adhere to the dependency injection / global is evil mantra. This means I try to avoid any kind of global state (if it is at all reasonable).
    As a concept, the Next_State should be a return value from the state machine logic; the loop where it is called can be viewed as the synchronous state machine tick and thus the maintainer thereof.
    /***** * Main function starts here *****/ int main() { enum states Current_State = S_OFF; while ( Current_State != S_MAX ) { // Function call for the state machine, which then calls the read keys function and waits for the value returned Current_State = StateMachine( ReadKeyInput(), Current_State ); } return 0; } As a result hereof, the Next_State must be returned:
    enum states StateMachine(enum events event, enum states Current_State) { int Next_State = Current_State; switch ( Current_State ) { // all the state transition stuff } if (Next_State != Current_State) { // Function call for Upon Exit function, it can be omitted but allows extra functionality UponExit(Current_State); // Function call for Upon Enter function, it can be omitted but allows extra functionality UponEnter(Next_State); } else // I think ActionWhileInState should only be called when NOT doing a transition! { if ( event != E_MAX) ActionWhileInState( Current_State ); } return Next_State; } Second: you have an UponEnter, ActionWhileInState and UponExit which all take the current state. In the case of C++ one would make a class hereof, in C, this is best done using a prefix or postix, combined with a lookup table.
    typedef void (* const voidFunc)(void); void hEnter_OFF(void); void hEnter_ON(void); void hEnter_PROCESS(void); void hInState_OFF(void); void hInState_ON(void); void hInState_PROCESS(void); void hExit_OFF(void); void hExit_ON(void); void hExit_PROCESS(void); voidFunc UponEnter[S_MAX] = {hEnter_OFF, hEnter_ON, hEnter_PROCESS}; voidFunc ActionWhileInState[S_MAX] = {hInState_OFF, hInState_ON, hInState_PROCESS}; voidFunc UponExit[S_MAX] = {hExit_OFF, hExit_ON, hExit_PROCESS}; enum states StateMachine(enum events event, enum states Current_State) { int Next_State = Current_State; switch ( Current_State ) { // all the state transition stuff } if (Next_State != Current_State) { // Function call for Upon Exit function, it can be omitted but allows extra functionality UponExit[Current_State](); // Function call for Upon Enter function, it can be omitted but allows extra functionality if (Next_State != S_MAX) UponEnter[Next_State](); } else // I think ActionWhileInState should only be called when NOT doing a transition! { if ( event != E_MAX) ActionWhileInState[Current_State](); } return Next_State; } Now, while this may seem to only clutter things, it will save you the excessive switch statements to split the states again each time:
    void hEnter_OFF(void) { // Code to execute when entering the OFF state } You will get a load of functions, but each function will only handle a single task, making each function itself more readable.
    For convenience, you may want to make a single placeholder handler as well
    void hEmpty(void) { // This function is empty and will be called for each event that I don't want to write a handler for. }
  21. Like
    Antscran got a reaction from Rei Vilo in State Machine Tutorial   
    Hi all,
     
    Just put together a basic state machine tutorial with portable C programming code, I have also made a small 4 state project with a basic user interface (LCD and 4 buttons), all based on a MSP430G2234.
     
    Would be interested in anyone's views on it's readability and maybe even improvements?
     
    State machine tutorial and C programming code:
     
    http://coder-tronics.com/state-machine-tutorial-pt1/
    http://coder-tronics.com/state-machine-tutorial-pt2/
     
    Youtube video with MSP430 state machine (tutorial and all code to follow) :
     
    https://www.youtube.com/watch?v=JzDn6SKjBxE
     
    Cheers,
     
    Ant
  22. Like
    Antscran got a reaction from bluehash in State Machine Tutorial   
    Hi all,
     
    Just put together a basic state machine tutorial with portable C programming code, I have also made a small 4 state project with a basic user interface (LCD and 4 buttons), all based on a MSP430G2234.
     
    Would be interested in anyone's views on it's readability and maybe even improvements?
     
    State machine tutorial and C programming code:
     
    http://coder-tronics.com/state-machine-tutorial-pt1/
    http://coder-tronics.com/state-machine-tutorial-pt2/
     
    Youtube video with MSP430 state machine (tutorial and all code to follow) :
     
    https://www.youtube.com/watch?v=JzDn6SKjBxE
     
    Cheers,
     
    Ant
  23. Like
    Antscran got a reaction from reaper7 in State Machine Tutorial   
    Hi all,
     
    Just put together a basic state machine tutorial with portable C programming code, I have also made a small 4 state project with a basic user interface (LCD and 4 buttons), all based on a MSP430G2234.
     
    Would be interested in anyone's views on it's readability and maybe even improvements?
     
    State machine tutorial and C programming code:
     
    http://coder-tronics.com/state-machine-tutorial-pt1/
    http://coder-tronics.com/state-machine-tutorial-pt2/
     
    Youtube video with MSP430 state machine (tutorial and all code to follow) :
     
    https://www.youtube.com/watch?v=JzDn6SKjBxE
     
    Cheers,
     
    Ant
  24. Like
    Antscran reacted to EngIP in Displaying ADC value on a 16x2 LCD   
    When I've done this in the past, I've use a character map and a function to translate an integer to display values.  Basically there's a variable with the LCD code for that particular number in it's indexed location.  For my LCD it's 
     
    const char charMap[10] = {0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39};
     
    Then if I have an integer to display (say 341) I do the modulus operator to find the remainder after 10 (1 in this case), send charMap[1] to the display, then divide by 10 and repeat.
     
    Hope this helps
  25. Like
    Antscran reacted to RobG in Displaying ADC value on a 16x2 LCD   
    Here are few examples:
    http://forum.43oh.com/topic/401-launchpad-adc-and-lcd/
    http://forum.43oh.com/topic/904-new-take-on-adc-lcd/
     
    If you don't have 74hc164 on hand, there are 4bit LCD examples on 43oh, like this one:
    http://forum.43oh.com/topic/1767-lcd-16x2-in-4-bit-mode/
×
×
  • Create New...