Hi
Thanks folks for your value inputs.
I had a one more Question
I am using MSP430f5528 uC and MSP-TS430RGC64USB - MSP430F55xx 64-Pin Target
board with MSP-FET430UIF kit .
Any suggestions on how to interface LCD with the target board
******************************************************************************************
On Wed, Jun 29, 2011 at 10:53 AM, Thomas Grajewski wrote:
> Hi All,
> I use sprintf(buffer,"%3u",value); to get an int into a string so I can
> easily print them onto my LCD (I use CCS). To make sprintf() work you have
> to go to properties of your project in the "C/C++ build" tab go to
> "Library
> Assumption" on the list that pops up when you select C/C++ build. Once you
> have clicked on the Library assumption there is an option (should be the
> first one) that reads "Level of printf support required(--printf support)"
> turn this to full and there you go. If you really need a pic of it I can
> post one but I am rather lazy and you should be able to figure it out.
>
> Jake G
>
> On Wed, Jun 29, 2011 at 12:14 AM, old_cow_yellow
> wrote:
>
> > **
> >
> >
> > Dan,
> >
> > You are right. With KickStart, normally printf() will call putchar()
> which
> > in turn will call __write() to send characters to an I/O terminal. But
> > __write() is not in the library.
> >
> > However, the debugger has an I/O terminal emulator. If you enable that
> > feature, part of the PC screen and keyboard will act as fake I/O terminal
> > for the MSP430.
> >
> > --OCY
> >
> >
> > --- In m..., Dan Bloomquist wrote:
> > >
> > > Ken Bueltmann wrote:
> > > > i had the same problem when i started with the msp, reading c for
> > dummies,
> > > > tried to start at the beginning [?]. Then I realized I needed some
> kind
> > of
> > > > terminal connection... (as Bear kindly pointed out)
> > > >
> > >
> > > Hi Ken, ocy,
> > >
> > > As I recall kickstart would get you a linker error if you don't
define
> > > putchar, (don't see how it wouldn't.). I use GCC, you have to
define
> > > putchar. But there certainly is a printf in the stdio, that is not a
> > > micro thing. What is the issue is that the msp430 libs don't come
with
> > > an operating system (i.e,i/o), so, no putchar. The author has to supply
> > > that.
> > >
> > > Best, Dan.
> > >
> > > --
> > > There are several traffic signs within the association. These signs are
> > currently maintained by the city and are expected to have a useful life
> > equal to the life of the community. They should only need to be replaced
> due
> > to weather or vandalism and in the event that the city will no longer
> > maintain the signs they will be budgeted for in the operation budget of
> the
> > association. The condition of the signs at the time of the last field
> > inspection was near new.
> > >
> >
> >
> > --
> Thomas J. Grajewski
> Engineer
>
>
>
Help for a beginner in MSP430
Started by ●June 28, 2011
Reply by ●June 30, 20112011-06-30
Reply by ●June 30, 20112011-06-30
Hi,
You got to be more clear what LCD you are using and more importantly the
type or controller number. There is a big difference in pin use if it is a
parallel or a serial interface. if it is parallel obviously you have to
dedicate a whole PXOUT to just the data and half another port for the
handshaking. The best thing to do is look up the data sheet for the LCD you
want to use, most of them will have a interface example and possibly example
code.
Jake G.
On Wed, Jun 29, 2011 at 9:57 AM, Abhaykumar kumbhar wrote:
> **
> Hi
>
> Thanks folks for your value inputs.
>
> I had a one more Question
> I am using MSP430f5528 uC and MSP-TS430RGC64USB - MSP430F55xx 64-Pin Target
> board with MSP-FET430UIF kit .
> Any suggestions on how to interface LCD with the target board
> ******************************************************************************************
> On Wed, Jun 29, 2011 at 10:53 AM, Thomas Grajewski > >wrote:
> > Hi All,
> > I use sprintf(buffer,"%3u",value); to get an int into a string so I can
> > easily print them onto my LCD (I use CCS). To make sprintf() work you
> have
> > to go to properties of your project in the "C/C++ build" tab go to
> > "Library
> > Assumption" on the list that pops up when you select C/C++ build. Once
> you
> > have clicked on the Library assumption there is an option (should be the
> > first one) that reads "Level of printf support required(--printf
> support)"
> > turn this to full and there you go. If you really need a pic of it I can
> > post one but I am rather lazy and you should be able to figure it out.
> >
> > Jake G
> >
> > On Wed, Jun 29, 2011 at 12:14 AM, old_cow_yellow
> > wrote:
> >
> > > **
> > >
> > >
> > > Dan,
> > >
> > > You are right. With KickStart, normally printf() will call putchar()
> > which
> > > in turn will call __write() to send characters to an I/O terminal. But
> > > __write() is not in the library.
> > >
> > > However, the debugger has an I/O terminal emulator. If you enable that
> > > feature, part of the PC screen and keyboard will act as fake I/O
> terminal
> > > for the MSP430.
> > >
> > > --OCY
> > >
> > >
> > > --- In m..., Dan Bloomquist wrote:
> > > >
> > > > Ken Bueltmann wrote:
> > > > > i had the same problem when i started with the msp, reading c for
> > > dummies,
> > > > > tried to start at the beginning [?]. Then I realized I needed some
> > kind
> > > of
> > > > > terminal connection... (as Bear kindly pointed out)
> > > > >
> > > >
> > > > Hi Ken, ocy,
> > > >
> > > > As I recall kickstart would get you a linker error if you don't
> define
> > > > putchar, (don't see how it wouldn't.). I use GCC, you have to define
> > > > putchar. But there certainly is a printf in the stdio, that is not a
> > > > micro thing. What is the issue is that the msp430 libs don't come
> with
> > > > an operating system (i.e,i/o), so, no putchar. The author has to
> supply
> > > > that.
> > > >
> > > > Best, Dan.
> > > >
> > > > --
> > > > There are several traffic signs within the association. These signs
> are
> > > currently maintained by the city and are expected to have a useful life
> > > equal to the life of the community. They should only need to be
> replaced
> > due
> > > to weather or vandalism and in the event that the city will no longer
> > > maintain the signs they will be budgeted for in the operation budget of
> > the
> > > association. The condition of the signs at the time of the last field
> > > inspection was near new.
> > > >
> > >
> > >
> > >
> >
> >
> >
> > --
> > Thomas J. Grajewski
> > Engineer
>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
You got to be more clear what LCD you are using and more importantly the
type or controller number. There is a big difference in pin use if it is a
parallel or a serial interface. if it is parallel obviously you have to
dedicate a whole PXOUT to just the data and half another port for the
handshaking. The best thing to do is look up the data sheet for the LCD you
want to use, most of them will have a interface example and possibly example
code.
Jake G.
On Wed, Jun 29, 2011 at 9:57 AM, Abhaykumar kumbhar wrote:
> **
> Hi
>
> Thanks folks for your value inputs.
>
> I had a one more Question
> I am using MSP430f5528 uC and MSP-TS430RGC64USB - MSP430F55xx 64-Pin Target
> board with MSP-FET430UIF kit .
> Any suggestions on how to interface LCD with the target board
> ******************************************************************************************
> On Wed, Jun 29, 2011 at 10:53 AM, Thomas Grajewski > >wrote:
> > Hi All,
> > I use sprintf(buffer,"%3u",value); to get an int into a string so I can
> > easily print them onto my LCD (I use CCS). To make sprintf() work you
> have
> > to go to properties of your project in the "C/C++ build" tab go to
> > "Library
> > Assumption" on the list that pops up when you select C/C++ build. Once
> you
> > have clicked on the Library assumption there is an option (should be the
> > first one) that reads "Level of printf support required(--printf
> support)"
> > turn this to full and there you go. If you really need a pic of it I can
> > post one but I am rather lazy and you should be able to figure it out.
> >
> > Jake G
> >
> > On Wed, Jun 29, 2011 at 12:14 AM, old_cow_yellow
> > wrote:
> >
> > > **
> > >
> > >
> > > Dan,
> > >
> > > You are right. With KickStart, normally printf() will call putchar()
> > which
> > > in turn will call __write() to send characters to an I/O terminal. But
> > > __write() is not in the library.
> > >
> > > However, the debugger has an I/O terminal emulator. If you enable that
> > > feature, part of the PC screen and keyboard will act as fake I/O
> terminal
> > > for the MSP430.
> > >
> > > --OCY
> > >
> > >
> > > --- In m..., Dan Bloomquist wrote:
> > > >
> > > > Ken Bueltmann wrote:
> > > > > i had the same problem when i started with the msp, reading c for
> > > dummies,
> > > > > tried to start at the beginning [?]. Then I realized I needed some
> > kind
> > > of
> > > > > terminal connection... (as Bear kindly pointed out)
> > > > >
> > > >
> > > > Hi Ken, ocy,
> > > >
> > > > As I recall kickstart would get you a linker error if you don't
> define
> > > > putchar, (don't see how it wouldn't.). I use GCC, you have to define
> > > > putchar. But there certainly is a printf in the stdio, that is not a
> > > > micro thing. What is the issue is that the msp430 libs don't come
> with
> > > > an operating system (i.e,i/o), so, no putchar. The author has to
> supply
> > > > that.
> > > >
> > > > Best, Dan.
> > > >
> > > > --
> > > > There are several traffic signs within the association. These signs
> are
> > > currently maintained by the city and are expected to have a useful life
> > > equal to the life of the community. They should only need to be
> replaced
> > due
> > > to weather or vandalism and in the event that the city will no longer
> > > maintain the signs they will be budgeted for in the operation budget of
> > the
> > > association. The condition of the signs at the time of the last field
> > > inspection was near new.
> > > >
> > >
> > >
> > >
> >
> >
> >
> > --
> > Thomas J. Grajewski
> > Engineer
>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
Reply by ●June 30, 20112011-06-30
Some LCDs also have a 4-bit (for data) interface.
Emmett Redd Ph.D. mailto:E...@missouristate.edu
Professor (417)836-5221
Department of Physics, Astronomy, and Materials Science
Missouri State University Fax (417)836-6226
901 SOUTH NATIONAL Lab (417)836-3770
SPRINGFIELD, MO 65897 USA Dept (417)836-5131
In statesmanship get the formalities right, never mind about the moralities. -- Mark Twain.
________________________________________
From: m... [m...] On Behalf Of Thomas Grajewski [p...@gmail.com]
Sent: Thursday, June 30, 2011 9:51 AM
To: m...
Subject: Re: [msp430] Re: Help for a beginner in MSP430
Hi,
You got to be more clear what LCD you are using and more importantly the
type or controller number. There is a big difference in pin use if it is a
parallel or a serial interface. if it is parallel obviously you have to
dedicate a whole PXOUT to just the data and half another port for the
handshaking. The best thing to do is look up the data sheet for the LCD you
want to use, most of them will have a interface example and possibly example
code.
Jake G.
On Wed, Jun 29, 2011 at 9:57 AM, Abhaykumar kumbhar wrote:
> **
> Hi
>
> Thanks folks for your value inputs.
>
> I had a one more Question
> I am using MSP430f5528 uC and MSP-TS430RGC64USB - MSP430F55xx 64-Pin Target
> board with MSP-FET430UIF kit .
> Any suggestions on how to interface LCD with the target board
> ******************************************************************************************
> On Wed, Jun 29, 2011 at 10:53 AM, Thomas Grajewski > >wrote:
> > Hi All,
> > I use sprintf(buffer,"%3u",value); to get an int into a string so I can
> > easily print them onto my LCD (I use CCS). To make sprintf() work you
> have
> > to go to properties of your project in the "C/C++ build" tab go to
> > "Library
> > Assumption" on the list that pops up when you select C/C++ build. Once
> you
> > have clicked on the Library assumption there is an option (should be the
> > first one) that reads "Level of printf support required(--printf
> support)"
> > turn this to full and there you go. If you really need a pic of it I can
> > post one but I am rather lazy and you should be able to figure it out.
> >
> > Jake G
> >
> > On Wed, Jun 29, 2011 at 12:14 AM, old_cow_yellow
> > wrote:
> >
> > > **
> > >
> > >
> > > Dan,
> > >
> > > You are right. With KickStart, normally printf() will call putchar()
> > which
> > > in turn will call __write() to send characters to an I/O terminal. But
> > > __write() is not in the library.
> > >
> > > However, the debugger has an I/O terminal emulator. If you enable that
> > > feature, part of the PC screen and keyboard will act as fake I/O
> terminal
> > > for the MSP430.
> > >
> > > --OCY
> > >
> > >
> > > --- In m..., Dan Bloomquist wrote:
> > > >
> > > > Ken Bueltmann wrote:
> > > > > i had the same problem when i started with the msp, reading c for
> > > dummies,
> > > > > tried to start at the beginning [?]. Then I realized I needed some
> > kind
> > > of
> > > > > terminal connection... (as Bear kindly pointed out)
> > > > >
> > > >
> > > > Hi Ken, ocy,
> > > >
> > > > As I recall kickstart would get you a linker error if you don't
> define
> > > > putchar, (don't see how it wouldn't.). I use GCC, you have to define
> > > > putchar. But there certainly is a printf in the stdio, that is not a
> > > > micro thing. What is the issue is that the msp430 libs don't come
> with
> > > > an operating system (i.e,i/o), so, no putchar. The author has to
> supply
> > > > that.
> > > >
> > > > Best, Dan.
> > > >
> > > > --
> > > > There are several traffic signs within the association. These signs
> are
> > > currently maintained by the city and are expected to have a useful life
> > > equal to the life of the community. They should only need to be
> replaced
> > due
> > > to weather or vandalism and in the event that the city will no longer
> > > maintain the signs they will be budgeted for in the operation budget of
> > the
> > > association. The condition of the signs at the time of the last field
> > > inspection was near new.
> > > >
> > >
> > >
> > >
> >
> >
> >
> > --
> > Thomas J. Grajewski
> > Engineer
>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
Emmett Redd Ph.D. mailto:E...@missouristate.edu
Professor (417)836-5221
Department of Physics, Astronomy, and Materials Science
Missouri State University Fax (417)836-6226
901 SOUTH NATIONAL Lab (417)836-3770
SPRINGFIELD, MO 65897 USA Dept (417)836-5131
In statesmanship get the formalities right, never mind about the moralities. -- Mark Twain.
________________________________________
From: m... [m...] On Behalf Of Thomas Grajewski [p...@gmail.com]
Sent: Thursday, June 30, 2011 9:51 AM
To: m...
Subject: Re: [msp430] Re: Help for a beginner in MSP430
Hi,
You got to be more clear what LCD you are using and more importantly the
type or controller number. There is a big difference in pin use if it is a
parallel or a serial interface. if it is parallel obviously you have to
dedicate a whole PXOUT to just the data and half another port for the
handshaking. The best thing to do is look up the data sheet for the LCD you
want to use, most of them will have a interface example and possibly example
code.
Jake G.
On Wed, Jun 29, 2011 at 9:57 AM, Abhaykumar kumbhar wrote:
> **
> Hi
>
> Thanks folks for your value inputs.
>
> I had a one more Question
> I am using MSP430f5528 uC and MSP-TS430RGC64USB - MSP430F55xx 64-Pin Target
> board with MSP-FET430UIF kit .
> Any suggestions on how to interface LCD with the target board
> ******************************************************************************************
> On Wed, Jun 29, 2011 at 10:53 AM, Thomas Grajewski > >wrote:
> > Hi All,
> > I use sprintf(buffer,"%3u",value); to get an int into a string so I can
> > easily print them onto my LCD (I use CCS). To make sprintf() work you
> have
> > to go to properties of your project in the "C/C++ build" tab go to
> > "Library
> > Assumption" on the list that pops up when you select C/C++ build. Once
> you
> > have clicked on the Library assumption there is an option (should be the
> > first one) that reads "Level of printf support required(--printf
> support)"
> > turn this to full and there you go. If you really need a pic of it I can
> > post one but I am rather lazy and you should be able to figure it out.
> >
> > Jake G
> >
> > On Wed, Jun 29, 2011 at 12:14 AM, old_cow_yellow
> > wrote:
> >
> > > **
> > >
> > >
> > > Dan,
> > >
> > > You are right. With KickStart, normally printf() will call putchar()
> > which
> > > in turn will call __write() to send characters to an I/O terminal. But
> > > __write() is not in the library.
> > >
> > > However, the debugger has an I/O terminal emulator. If you enable that
> > > feature, part of the PC screen and keyboard will act as fake I/O
> terminal
> > > for the MSP430.
> > >
> > > --OCY
> > >
> > >
> > > --- In m..., Dan Bloomquist wrote:
> > > >
> > > > Ken Bueltmann wrote:
> > > > > i had the same problem when i started with the msp, reading c for
> > > dummies,
> > > > > tried to start at the beginning [?]. Then I realized I needed some
> > kind
> > > of
> > > > > terminal connection... (as Bear kindly pointed out)
> > > > >
> > > >
> > > > Hi Ken, ocy,
> > > >
> > > > As I recall kickstart would get you a linker error if you don't
> define
> > > > putchar, (don't see how it wouldn't.). I use GCC, you have to define
> > > > putchar. But there certainly is a printf in the stdio, that is not a
> > > > micro thing. What is the issue is that the msp430 libs don't come
> with
> > > > an operating system (i.e,i/o), so, no putchar. The author has to
> supply
> > > > that.
> > > >
> > > > Best, Dan.
> > > >
> > > > --
> > > > There are several traffic signs within the association. These signs
> are
> > > currently maintained by the city and are expected to have a useful life
> > > equal to the life of the community. They should only need to be
> replaced
> > due
> > > to weather or vandalism and in the event that the city will no longer
> > > maintain the signs they will be budgeted for in the operation budget of
> > the
> > > association. The condition of the signs at the time of the last field
> > > inspection was near new.
> > > >
> > >
> > >
> > >
> >
> >
> >
> > --
> > Thomas J. Grajewski
> > Engineer
>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
Reply by ●July 8, 20112011-07-08
Hi
Folks
I had quick Question regarding UART
for UART coding
1. Select the I/O pins for UART
2. Enable UART TX, RX, or Both
3. Select the character format - 7 or 8 bits
4. Source the UART Module with a clock of a certain frequency
5. Set the baud generator correctly so as to get a correct baud rate from
the clock sourced
6. Enable the UART module state machine
7. Enable Interrupts if required
My concern is Point #2 *"ME1 |= UTXE0 + URXE0;"*
*
*
I am using MSP430f5528 , but in this uC i am not sure what i am must do to
enable my UART TX , RX.
Do i have just enable UCMODx or is there something else i need to do ?
Folks
I had quick Question regarding UART
for UART coding
1. Select the I/O pins for UART
2. Enable UART TX, RX, or Both
3. Select the character format - 7 or 8 bits
4. Source the UART Module with a clock of a certain frequency
5. Set the baud generator correctly so as to get a correct baud rate from
the clock sourced
6. Enable the UART module state machine
7. Enable Interrupts if required
My concern is Point #2 *"ME1 |= UTXE0 + URXE0;"*
*
*
I am using MSP430f5528 , but in this uC i am not sure what i am must do to
enable my UART TX , RX.
Do i have just enable UCMODx or is there something else i need to do ?
Reply by ●July 8, 20112011-07-08
2) wants you to use PxSEL to set the certain pins from a GPIO to a specific
function (in your case RXD and TXD). For example in my code using a
MSP430F5438A
P3SEL |= BIT4+BIT5; // P3.4,5 UART option select
The code sets the 3.5/3.6 to TXD/RXD for UART.
Jake G.
On Wed, Jul 6, 2011 at 4:10 PM, Abhaykumar kumbhar wrote:
> **
> Hi
> Folks
>
> I had quick Question regarding UART
> for UART coding
>
> 1. Select the I/O pins for UART
> 2. Enable UART TX, RX, or Both
> 3. Select the character format - 7 or 8 bits
> 4. Source the UART Module with a clock of a certain frequency
> 5. Set the baud generator correctly so as to get a correct baud rate from
> the clock sourced
> 6. Enable the UART module state machine
> 7. Enable Interrupts if required
>
> My concern is Point #2 *"ME1 |= UTXE0 + URXE0;"*
> *
> *
> I am using MSP430f5528 , but in this uC i am not sure what i am must do to
> enable my UART TX , RX.
> Do i have just enable UCMODx or is there something else i need to do ?
>
>
>
>
--
Thomas J. Grajewski
Engineer
function (in your case RXD and TXD). For example in my code using a
MSP430F5438A
P3SEL |= BIT4+BIT5; // P3.4,5 UART option select
The code sets the 3.5/3.6 to TXD/RXD for UART.
Jake G.
On Wed, Jul 6, 2011 at 4:10 PM, Abhaykumar kumbhar wrote:
> **
> Hi
> Folks
>
> I had quick Question regarding UART
> for UART coding
>
> 1. Select the I/O pins for UART
> 2. Enable UART TX, RX, or Both
> 3. Select the character format - 7 or 8 bits
> 4. Source the UART Module with a clock of a certain frequency
> 5. Set the baud generator correctly so as to get a correct baud rate from
> the clock sourced
> 6. Enable the UART module state machine
> 7. Enable Interrupts if required
>
> My concern is Point #2 *"ME1 |= UTXE0 + URXE0;"*
> *
> *
> I am using MSP430f5528 , but in this uC i am not sure what i am must do to
> enable my UART TX , RX.
> Do i have just enable UCMODx or is there something else i need to do ?
>
>
>
>
--
Thomas J. Grajewski
Engineer
Reply by ●July 8, 20112011-07-08
From a non-C expert, but aren't you guys using '+'
inappropriately. Shouldn't you use '|'?
Emmett Redd Ph.D. mailto:E...@missouristate.edu
Professor (417)836-5221
Department of Physics, Astronomy, and Materials Science
Missouri State University Fax (417)836-6226
901 SOUTH NATIONAL Lab (417)836-3770
SPRINGFIELD, MO 65897 USA Dept (417)836-5131
In statesmanship get the formalities right, never mind about the moralities. -- Mark Twain.
________________________________________
From: m... [m...] On Behalf Of Thomas Grajewski [p...@gmail.com]
Sent: Friday, July 08, 2011 12:11 PM
To: m...
Subject: Re: [msp430] Re: Help for a beginner in MSP430
2) wants you to use PxSEL to set the certain pins from a GPIO to a specific
function (in your case RXD and TXD). For example in my code using a
MSP430F5438A
P3SEL |= BIT4+BIT5; // P3.4,5 UART option select
The code sets the 3.5/3.6 to TXD/RXD for UART.
Jake G.
On Wed, Jul 6, 2011 at 4:10 PM, Abhaykumar kumbhar wrote:
> **
> Hi
> Folks
>
> I had quick Question regarding UART
> for UART coding
>
> 1. Select the I/O pins for UART
> 2. Enable UART TX, RX, or Both
> 3. Select the character format - 7 or 8 bits
> 4. Source the UART Module with a clock of a certain frequency
> 5. Set the baud generator correctly so as to get a correct baud rate from
> the clock sourced
> 6. Enable the UART module state machine
> 7. Enable Interrupts if required
>
> My concern is Point #2 *"ME1 |= UTXE0 + URXE0;"*
> *
> *
> I am using MSP430f5528 , but in this uC i am not sure what i am must do to
> enable my UART TX , RX.
> Do i have just enable UCMODx or is there something else i need to do ?
>
>
--
Thomas J. Grajewski
Engineer
Emmett Redd Ph.D. mailto:E...@missouristate.edu
Professor (417)836-5221
Department of Physics, Astronomy, and Materials Science
Missouri State University Fax (417)836-6226
901 SOUTH NATIONAL Lab (417)836-3770
SPRINGFIELD, MO 65897 USA Dept (417)836-5131
In statesmanship get the formalities right, never mind about the moralities. -- Mark Twain.
________________________________________
From: m... [m...] On Behalf Of Thomas Grajewski [p...@gmail.com]
Sent: Friday, July 08, 2011 12:11 PM
To: m...
Subject: Re: [msp430] Re: Help for a beginner in MSP430
2) wants you to use PxSEL to set the certain pins from a GPIO to a specific
function (in your case RXD and TXD). For example in my code using a
MSP430F5438A
P3SEL |= BIT4+BIT5; // P3.4,5 UART option select
The code sets the 3.5/3.6 to TXD/RXD for UART.
Jake G.
On Wed, Jul 6, 2011 at 4:10 PM, Abhaykumar kumbhar wrote:
> **
> Hi
> Folks
>
> I had quick Question regarding UART
> for UART coding
>
> 1. Select the I/O pins for UART
> 2. Enable UART TX, RX, or Both
> 3. Select the character format - 7 or 8 bits
> 4. Source the UART Module with a clock of a certain frequency
> 5. Set the baud generator correctly so as to get a correct baud rate from
> the clock sourced
> 6. Enable the UART module state machine
> 7. Enable Interrupts if required
>
> My concern is Point #2 *"ME1 |= UTXE0 + URXE0;"*
> *
> *
> I am using MSP430f5528 , but in this uC i am not sure what i am must do to
> enable my UART TX , RX.
> Do i have just enable UCMODx or is there something else i need to do ?
>
>
--
Thomas J. Grajewski
Engineer
Reply by ●July 9, 20112011-07-09
Dr. Redd makes a really good point about a potential bug in using the addition
operator (+) instead of the bit-wise-or operator (|).
For some strange reason, much, if not all, of the TI example code uses the +, not |. Because TI (or their compiler partners) have carefully defined their bits in header files, the +'s work out in the same way as |'s.
BUT it is conceptually wrong, in my opinion. If one were to combine bitmasks which have overlapping values, you will get errors!
For example, you may have a register that contains some values and control registers. You might set a value on one step, then set some control in another step. If you add, you will get a bug. Logically you want to OR.
PERIPH_REG = 0xC0; // Set some peripheral register value
PERIPH_REG += 0xC1; // Turn on the peripheral (bit 0) and keep the value (0xC0). THIS IS A BUG
PERIPH_REG |= 0xC1; // Turn on the peripheral (bit 0) and keep the value (0xC0). THIS IS RIGHT.
That is:
a + b != a | b.
Early on in my MSP430 career I got burned by this by carelessly following TI's convention of adding, instead of masking, bits.
I urge TI to change this going forward.
Stuart
--- In m..., "Redd, Emmett R" wrote:
>
> From a non-C expert, but aren't you guys using '+' inappropriately. Shouldn't you use '|'?
>
> Emmett Redd Ph.D. mailto:EmmettRedd@...
> Professor (417)836-5221
> Department of Physics, Astronomy, and Materials Science
> Missouri State University Fax (417)836-6226
> 901 SOUTH NATIONAL Lab (417)836-3770
> SPRINGFIELD, MO 65897 USA Dept (417)836-5131
>
> In statesmanship get the formalities right, never mind about the moralities. -- Mark Twain.
> ________________________________________
> From: m... [m...] On Behalf Of Thomas Grajewski [prs.jake@...]
> Sent: Friday, July 08, 2011 12:11 PM
> To: m...
> Subject: Re: [msp430] Re: Help for a beginner in MSP430
>
> 2) wants you to use PxSEL to set the certain pins from a GPIO to a specific
> function (in your case RXD and TXD). For example in my code using a
> MSP430F5438A
>
> P3SEL |= BIT4+BIT5; // P3.4,5 UART option select
>
> The code sets the 3.5/3.6 to TXD/RXD for UART.
>
> Jake G.
>
> On Wed, Jul 6, 2011 at 4:10 PM, Abhaykumar kumbhar wrote:
>
> > **
> >
> >
> > Hi
> > Folks
> >
> > I had quick Question regarding UART
> > for UART coding
> >
> > 1. Select the I/O pins for UART
> > 2. Enable UART TX, RX, or Both
> > 3. Select the character format - 7 or 8 bits
> > 4. Source the UART Module with a clock of a certain frequency
> > 5. Set the baud generator correctly so as to get a correct baud rate from
> > the clock sourced
> > 6. Enable the UART module state machine
> > 7. Enable Interrupts if required
> >
> > My concern is Point #2 *"ME1 |= UTXE0 + URXE0;"*
> > *
> > *
> > I am using MSP430f5528 , but in this uC i am not sure what i am must do to
> > enable my UART TX , RX.
> > Do i have just enable UCMODx or is there something else i need to do ?
> >
> >
> >
> >
> >
> > --
> Thomas J. Grajewski
> Engineer
>
>
>
>
For some strange reason, much, if not all, of the TI example code uses the +, not |. Because TI (or their compiler partners) have carefully defined their bits in header files, the +'s work out in the same way as |'s.
BUT it is conceptually wrong, in my opinion. If one were to combine bitmasks which have overlapping values, you will get errors!
For example, you may have a register that contains some values and control registers. You might set a value on one step, then set some control in another step. If you add, you will get a bug. Logically you want to OR.
PERIPH_REG = 0xC0; // Set some peripheral register value
PERIPH_REG += 0xC1; // Turn on the peripheral (bit 0) and keep the value (0xC0). THIS IS A BUG
PERIPH_REG |= 0xC1; // Turn on the peripheral (bit 0) and keep the value (0xC0). THIS IS RIGHT.
That is:
a + b != a | b.
Early on in my MSP430 career I got burned by this by carelessly following TI's convention of adding, instead of masking, bits.
I urge TI to change this going forward.
Stuart
--- In m..., "Redd, Emmett R" wrote:
>
> From a non-C expert, but aren't you guys using '+' inappropriately. Shouldn't you use '|'?
>
> Emmett Redd Ph.D. mailto:EmmettRedd@...
> Professor (417)836-5221
> Department of Physics, Astronomy, and Materials Science
> Missouri State University Fax (417)836-6226
> 901 SOUTH NATIONAL Lab (417)836-3770
> SPRINGFIELD, MO 65897 USA Dept (417)836-5131
>
> In statesmanship get the formalities right, never mind about the moralities. -- Mark Twain.
> ________________________________________
> From: m... [m...] On Behalf Of Thomas Grajewski [prs.jake@...]
> Sent: Friday, July 08, 2011 12:11 PM
> To: m...
> Subject: Re: [msp430] Re: Help for a beginner in MSP430
>
> 2) wants you to use PxSEL to set the certain pins from a GPIO to a specific
> function (in your case RXD and TXD). For example in my code using a
> MSP430F5438A
>
> P3SEL |= BIT4+BIT5; // P3.4,5 UART option select
>
> The code sets the 3.5/3.6 to TXD/RXD for UART.
>
> Jake G.
>
> On Wed, Jul 6, 2011 at 4:10 PM, Abhaykumar kumbhar wrote:
>
> > **
> >
> >
> > Hi
> > Folks
> >
> > I had quick Question regarding UART
> > for UART coding
> >
> > 1. Select the I/O pins for UART
> > 2. Enable UART TX, RX, or Both
> > 3. Select the character format - 7 or 8 bits
> > 4. Source the UART Module with a clock of a certain frequency
> > 5. Set the baud generator correctly so as to get a correct baud rate from
> > the clock sourced
> > 6. Enable the UART module state machine
> > 7. Enable Interrupts if required
> >
> > My concern is Point #2 *"ME1 |= UTXE0 + URXE0;"*
> > *
> > *
> > I am using MSP430f5528 , but in this uC i am not sure what i am must do to
> > enable my UART TX , RX.
> > Do i have just enable UCMODx or is there something else i need to do ?
> >
> >
> >
> >
> >
> > --
> Thomas J. Grajewski
> Engineer
>
>
>
>
Reply by ●July 9, 20112011-07-09
On Sat, Jul 9, 2011 at 9:50 AM, Stuart_Rubin wrote:
> For some strange reason, much, if not all, of the TI example code uses the +, not |.
Does anyone know why this is? Is there ever a reason to use "+" over
"|" for setting/manipulating bitfields like this?
-p.
> For some strange reason, much, if not all, of the TI example code uses the +, not |.
Does anyone know why this is? Is there ever a reason to use "+" over
"|" for setting/manipulating bitfields like this?
-p.
Reply by ●July 9, 20112011-07-09
On Sat, 9 Jul 2011 12:02:08 -0400, you wrote:
>On Sat, Jul 9, 2011 at 9:50 AM, Stuart_Rubin wrote:
>
>> For some strange reason, much, if not all, of the TI example code uses the +, not |.
>
>Does anyone know why this is? Is there ever a reason to use "+" over
>"|" for setting/manipulating bitfields like this?
Old habits, perhaps. Some BASIC interpreters (for example,
HP's 2000F timesharing system) didn't even include a way to
specify a logical inclusive-OR operation. So you had to use
addition. Once that gets ingrained from long practice, it
can be a slight bit of work to undo the old habit.
An argument _could_ be made, I suppose, that if addition is
used instead of an inclusive-or, one _might_ discover
inherent problems in some expression more quickly. ;) It
might cause more obvious problems in operation if some fields
overflowed into other fields, than if overlapping fields
merely interfered a little. Okay. I'm stretching the
argument. But it is fun to do. :P
Jon
>On Sat, Jul 9, 2011 at 9:50 AM, Stuart_Rubin wrote:
>
>> For some strange reason, much, if not all, of the TI example code uses the +, not |.
>
>Does anyone know why this is? Is there ever a reason to use "+" over
>"|" for setting/manipulating bitfields like this?
Old habits, perhaps. Some BASIC interpreters (for example,
HP's 2000F timesharing system) didn't even include a way to
specify a logical inclusive-OR operation. So you had to use
addition. Once that gets ingrained from long practice, it
can be a slight bit of work to undo the old habit.
An argument _could_ be made, I suppose, that if addition is
used instead of an inclusive-or, one _might_ discover
inherent problems in some expression more quickly. ;) It
might cause more obvious problems in operation if some fields
overflowed into other fields, than if overlapping fields
merely interfered a little. Okay. I'm stretching the
argument. But it is fun to do. :P
Jon
Reply by ●July 10, 20112011-07-10
I often say: "Add cream and sugar to coffee."
Should I replace that by: "Or cream Or sugar to coffee"?
Wait, I did not mean Logic_OR. I meant Bit-wise-OR.
"coffee Bit-wise-OR update-with cream Bit-wise-OR sugar"
--- In m..., Jon Kirwan wrote:
>
> On Sat, 9 Jul 2011 12:02:08 -0400, you wrote:
>
> >On Sat, Jul 9, 2011 at 9:50 AM, Stuart_Rubin wrote:
> >
> >> For some strange reason, much, if not all, of the TI example code uses the +, not |.
> >
> >Does anyone know why this is? Is there ever a reason to use "+" over
> >"|" for setting/manipulating bitfields like this?
>
> Old habits, perhaps. Some BASIC interpreters (for example,
> HP's 2000F timesharing system) didn't even include a way to
> specify a logical inclusive-OR operation. So you had to use
> addition. Once that gets ingrained from long practice, it
> can be a slight bit of work to undo the old habit.
>
> An argument _could_ be made, I suppose, that if addition is
> used instead of an inclusive-or, one _might_ discover
> inherent problems in some expression more quickly. ;) It
> might cause more obvious problems in operation if some fields
> overflowed into other fields, than if overlapping fields
> merely interfered a little. Okay. I'm stretching the
> argument. But it is fun to do. :P
>
> Jon
>
Should I replace that by: "Or cream Or sugar to coffee"?
Wait, I did not mean Logic_OR. I meant Bit-wise-OR.
"coffee Bit-wise-OR update-with cream Bit-wise-OR sugar"
--- In m..., Jon Kirwan wrote:
>
> On Sat, 9 Jul 2011 12:02:08 -0400, you wrote:
>
> >On Sat, Jul 9, 2011 at 9:50 AM, Stuart_Rubin wrote:
> >
> >> For some strange reason, much, if not all, of the TI example code uses the +, not |.
> >
> >Does anyone know why this is? Is there ever a reason to use "+" over
> >"|" for setting/manipulating bitfields like this?
>
> Old habits, perhaps. Some BASIC interpreters (for example,
> HP's 2000F timesharing system) didn't even include a way to
> specify a logical inclusive-OR operation. So you had to use
> addition. Once that gets ingrained from long practice, it
> can be a slight bit of work to undo the old habit.
>
> An argument _could_ be made, I suppose, that if addition is
> used instead of an inclusive-or, one _might_ discover
> inherent problems in some expression more quickly. ;) It
> might cause more obvious problems in operation if some fields
> overflowed into other fields, than if overlapping fields
> merely interfered a little. Okay. I'm stretching the
> argument. But it is fun to do. :P
>
> Jon
>