Sign in

username:

password:



Not a member?

Search msp430



Search tips

Subscribe to msp430



Ads

Discussion Groups

Discussion Groups | MSP430 | Can any plz explain this

The purpose of this group is to foster exchange of information on the Texas Instruments MSP430 family of microcontrollers and related tools. Everyone welcome, all levels of familiarity/expertise.

Can any plz explain this - Nav - Sep 3 12:15:19 2008

Hiyaaaaa
I know C progrmming but could't understand this programmm,,
plz Explainnnn!!!!!!!!

Program 1

#include=C2=A0

void main(void)
{
=C2=A0 WDTCTL =3D WDTPW + WDTHOLD;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // Stop watchdog =
timer
=C2=A0 P1DIR |=3D 0x01;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // Set P1.0 to output direction
=C2=A0 SD16CTL =3D SD16REFON + SD16SSEL_1;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0 // 1.2V ref, SMCLK(what is this?)
=C2=A0 SD16INCTL0 =3D SD16INCH_1;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // A1+/- (what=
is this?)
=C2=A0 SD16CCTL0 =3D=C2=A0 SD16UNI + SD16IE;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // 256OSR, unipolar, interrupt=C2=A0=
=C2=A0=C2=A0=20
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A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0=C2=A0=C2=A0 // SD16MEM0 > 0.3V?, =
clears IFG
=C2=A0=C2=A0=C2=A0 P1OUT &=3D ~0x01;
=C2=A0 else
=C2=A0=C2=A0=C2=A0 P1OUT |=3D 0x01;
}

Navvvvv !=20
=20=20=20=20=20=20

[Non-text portions of this message have been removed]
------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )


Re: Can any plz explain this - old_cow_yellow - Sep 3 12:25:58 2008

Knowing c programming helps. But it is neither necessary nor
sufficient. There is a lot to lean.=20

--- In m...@yahoogroups.com, Nav wrote:
>
> Hiyaaaaa
> I know C progrmming but could't understand this programmm,,
> plz Explainnnn!!!!!!!!
>=20
> Program 1
>=20
> #include=C2
>=20
> void main(void)
> {
> =C2 WDTCTL =3D WDTPW + WDTHOLD;=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =
=C2 =C2 =C2 =C2 =C2 =C2 // Stop
watchdog timer
> =C2 P1DIR |=3D
0x01;=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =
=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 // Set
P1.0 to output direction
> =C2 SD16CTL =3D SD16REFON + SD16SSEL_1;=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =
// 1.2V ref,
SMCLK(what is this?)
> =C2 SD16INCTL0 =3D SD16INCH_1;=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =
=C2 =C2 =C2 =C2 =C2 =C2 =C2 //
A1+/- (what is this?)
> =C2 SD16CCTL0 =3D=C2 SD16UNI + SD16IE;=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =
=C2 =C2 =C2 // 256OSR,
unipolar, interrupt=C2 =C2 =C2=20=20
>
=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2=
=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =
=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2=
=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =
=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2=20
enable(what is this?)
> =C2 SD16AE =3D SD16AE2;=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =
=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2=20
// P1.1 A1+, A1- =3D VSS(what is this?)
> =C2 SD16CCTL0 |=3D SD16SC;=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =
=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 //
Set bit to start conversion
>=20
> =C2 _BIS_SR(LPM0_bits + GIE);(what is this?)
> }
>=20
> #pragma vector =3D SD16_VECTOR
> __interrupt void SD16ISR(void)
> {
> =C2 if (SD16MEM0 < 0x7FFF)=C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =C2 =
=C2 =C2 =C2 =C2 =C2 //
SD16MEM0 > 0.3V?, clears IFG
> =C2 =C2 =C2 P1OUT &=3D ~0x01;
> =C2 else
> =C2 =C2 =C2 P1OUT |=3D 0x01;
> }
>=20
>=20
>=20
> Navvvvv !=20
>=20
>=20
>=20=20=20=20=20=20=20
>=20
> [Non-text portions of this message have been removed]
>

------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )

Re: Can any plz explain this - Leon - Sep 3 13:34:45 2008

----- Original Message -----
From: "Nav"
To:
Sent: Wednesday, September 03, 2008 5:00 PM
Subject: [msp430] Can any plz explain this
Hiyaaaaa
I know C progrmming but could't understand this programmm,,
plz Explainnnn!!!!!!!!
Read the data sheet and the User's Guide.

Leon
--
Leon Heller
Amateur radio call-sign G1HSM
Yaesu FT-817ND transceiver
Suzuki SV1000S motorcycle
l...@btinternet.com
http://www.geocities.com/leon_heller

------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )

Re: Can any plz explain this - Ian Okey - Sep 3 14:22:22 2008

2008/9/3 Nav

> Hiyaaaaa
> I know C progrmming but could't understand this programmm,,
> plz Explainnnn!!!!!!!!
>
> Program 1
>
> #include void main(void)
> {
> WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
> P1DIR |= 0x01; // Set P1.0 to output direction
> SD16CTL = SD16REFON + SD16SSEL_1; // 1.2V ref, SMCLK(what is
> this?)
> SD16INCTL0 = SD16INCH_1; // A1+/- (what is this?)
> SD16CCTL0 = SD16UNI + SD16IE; // 256OSR, unipolar,
> interrupt
>
> enable(what is this?)
> SD16AE = SD16AE2; // P1.1 A1+, A1- = VSS(what is
> this?)
> SD16CCTL0 |= SD16SC; // Set bit to start conversion
>
> _BIS_SR(LPM0_bits + GIE);(what is this?)
> }
>
> #pragma vector = SD16_VECTOR
> __interrupt void SD16ISR(void)
> {
> if (SD16MEM0 < 0x7FFF) // SD16MEM0 > 0.3V?, clears IFG
> P1OUT &= ~0x01;
> else
> P1OUT |= 0x01;
> }
>
> Navvvvv !
> In addition to the other comments I believe that reading the "Janet and
> John" series of books might help you.
>
[Non-text portions of this message have been removed]
------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )

Re: Can any plz explain this - Steve Sabram - Sep 3 14:47:27 2008

Read the MSP430 Programmers Guide. That will answer your questions.

Steve
Nav wrote:
>
> Hiyaaaaa
> I know C progrmming but could't understand this programmm,,
> plz Explainnnn!!!!!!!!
>
> Program 1
>
> #include void main(void)
> {
> WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
> P1DIR |= 0x01; // Set P1.0 to output
> direction
> SD16CTL = SD16REFON + SD16SSEL_1; // 1.2V ref, SMCLK(what is
> this?)
> SD16INCTL0 = SD16INCH_1; // A1+/- (what is this?)
> SD16CCTL0 = SD16UNI + SD16IE; // 256OSR, unipolar,
> interrupt
>
> enable(what is this?)
> SD16AE = SD16AE2; // P1.1 A1+, A1- =
> VSS(what is this?)
> SD16CCTL0 |= SD16SC; // Set bit to start conversion
>
> _BIS_SR(LPM0_bits + GIE);(what is this?)
> }
>
> #pragma vector = SD16_VECTOR
> __interrupt void SD16ISR(void)
> {
> if (SD16MEM0 < 0x7FFF) // SD16MEM0 > 0.3V?, clears IFG
> P1OUT &= ~0x01;
> else
> P1OUT |= 0x01;
> }
>
> Navvvvv !
>
> [Non-text portions of this message have been removed]
>
>
------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )

Re: Can any plz explain this - Alexander Espinosa - Sep 3 14:54:15 2008

Hi, you need to read the=A0 datasheet for your microcontroller.
you'll see the meaning for each register there, including use of pins for A=
DC converter and use of other peripherals....
=A0
=20=20=20=20=20=20

[Non-text portions of this message have been removed]
------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )

Re: Can any plz explain this - Tom Baugh - Sep 3 15:33:22 2008

Nav,

I think a great place to start to help understanding that sample
program is to read the new book, MSP430 Microcontroller Basics, by
John Davies:

http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%
2Fwww.amazon.com%2FMSP430-Microcontroller-Basics-John-Davies%2Fdp%
2F0750682760%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1220014595%26sr%3D8-
2&tag=softcom-20&linkCode=ur2&camp=1789&creative=9325

After that book, you will then be ready to use the state-based
approach that we have used with the MSP430 world for a decade. This
approach is provided in detail in our book MSP430 State Machine
Programming:

http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%
2Fwww.amazon.com%2FMSP430-State-Machine-Programming-ES2274%2Fdp%
2F0975475924%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1214397954%26sr%3D8-
1&tag=softcom-20&linkCode=ur2&camp=1789&creative=9325

If those links don't work, then search amazon.com for MSP430 as one
word. John's book and ours will be at the top of the list. The pair
of these books, studied intently for a few weeks, will fill in a lot
of the gaps. Also, after working the exercises in our book you will
have a level of architectural expertise that would otherwise take
years to learn. This is like taking a MSP430 course in a few weeks
for less than $100.

You can find reviews of our book elsewhere on this group, but let me
know if you have any questions.

Tom

------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )

RE: Re: Can any plz explain this - Dan Muzzey - Sep 3 18:18:24 2008

Tom

While I do appreciate the advice that you put forth on the mailing list
and I do value your experience and knowledge, the continuing
self-promotion is starting to wear thin. In the case below, you do not
actually offer advice but instead just ask people to buy your book. It
is one thing to suggest a book once or twice. I think there were three
cases today alone where you recommended buying the book without actually
offering advice.

Respectfully

Dan

________________________________

From: m...@yahoogroups.com [mailto:m...@yahoogroups.com] On Behalf
Of Tom Baugh
Sent: Wednesday, September 03, 2008 2:33 PM
To: m...@yahoogroups.com
Subject: [msp430] Re: Can any plz explain this

Nav,

I think a great place to start to help understanding that sample
program is to read the new book, MSP430 Microcontroller Basics, by
John Davies:

http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%

2Fwww.amazon.com%2FMSP430-Microcontroller-Basics-John-Davies%2Fdp%
2F0750682760%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1220014595%26sr%3D8-
2&tag=softcom-20&linkCode=ur2&camp=1789&creative=9325

After that book, you will then be ready to use the state-based
approach that we have used with the MSP430 world for a decade. This
approach is provided in detail in our book MSP430 State Machine
Programming:

http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%

2Fwww.amazon.com%2FMSP430-State-Machine-Programming-ES2274%2Fdp%
2F0975475924%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1214397954%26sr%3D8-
1&tag=softcom-20&linkCode=ur2&camp=1789&creative=9325

If those links don't work, then search amazon.com for MSP430 as one
word. John's book and ours will be at the top of the list. The pair
of these books, studied intently for a few weeks, will fill in a lot
of the gaps. Also, after working the exercises in our book you will
have a level of architectural expertise that would otherwise take
years to learn. This is like taking a MSP430 course in a few weeks
for less than $100.

You can find reviews of our book elsewhere on this group, but let me
know if you have any questions.

Tom

[Non-text portions of this message have been removed]
------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )

Re: Re: Can any plz explain this - Nav - Sep 3 20:09:15 2008

Hiyaa,,,
I was going through the example program from TI about use of ADC,
In this=C2=A0 program, their is one instruction.=20
WDTCTL =3D WDT_MDLY_32;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // WD=
T Timer interval
I have gone through User guide but didnt get how watchdog interval is set, =
actually what is this WDT_MDLY_32.=20
Plz help me outttttt....
Navvvvv !=20

-
=20=20=20=20=20=20

[Non-text portions of this message have been removed]
------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )

RE: Re: Can any plz explain this - Paul Curtis - Sep 3 20:24:14 2008

Hi,

> Hiyaa,,,
> I was going through the example program from TI about use of ADC,
> In this program, their is one instruction.
> WDTCTL = WDT_MDLY_32; // WDT Timer interval
> I have gone through User guide but didnt get how watchdog interval is set,
> actually what is this WDT_MDLY_32.
> Plz help me outttttt....
> Navvvvv !

You seem to have a stuck-key problem with your keyboard. I suggest you get a can of air and give your keyboard a good blow.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors

------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )

Re: Can any plz explain this - "paddu.koti" - Sep 3 23:01:51 2008

--- In m...@yahoogroups.com, "Paul Curtis" wrote:
>
> Hi,
>
> > Hiyaa,,,
> > I was going through the example program from TI about use of ADC,
> > In this program, their is one instruction.
> > WDTCTL = WDT_MDLY_32; // WDT Timer interval
> > I have gone through User guide but didnt get how watchdog
interval is set,
> > actually what is this WDT_MDLY_32.
> > Plz help me outttttt....
> > Navvvvv !
>
> You seem to have a stuck-key problem with your keyboard. I
suggest you get a can of air and give your keyboard a good blow.
>
> --
> Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors
>
Hi,

The WatchDog module can be configured as either a watchdog or a
interval timer,WDT_MDLY_32 provides 32ms interval.
If you are using IAR embedded system,you can find the watchdog timer
definition in the .h header files
C:\Program Files\IAR Systems\Embedded Workbench 5.0\430\inc

If need to learn MSP430,go through the online training.
http://training.ti.com/courses/CourseCatalog.asp?iGID=1062

------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )