Define Word DW statement in MSP430 program

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Define Word DW statement in MSP430 program

MSP430 - Discuss mailing list
I am trying to understand the usage of the DW statement in this program.These program was written by a previous staff who has left the co,Anyone can explain. As I'm trying to modify the program parameters.
;***********************************************************************************
; Conductivity Table
; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * EVEN
COND_TAB
 DW 0000h  ; 00.0
 DW 0000h  ; 00.2
 DW 0000h  ; 00.4

 DW 0FFFFh  ; 00.6
 DW 0FFFFh  ; 00.8
 DW 0FFFEh  ; 01.0
 DW 0FFFEh  ; 01.2
 DW 0FFFDh  ; 01.4
 DW 0FFFDh  ; 01.6
 DW 0FFFEh  ; 01.8
 DW 0FFFEh  ; 02.0
 DW 0FFFFh  ; 02.2
 DW 0FFFFh  ; 02.4
 DW 0000h  ; 02.6
 DW 0000h  ; 02.8
 DW 0000h  ; 03.0
 DW 0001h  ; 03.2
 DW 0002h  ; 03.4
 DW 0004h  ; 03.6
 DW 0006h  ; 03.8
 DW 0008h  ; 04.0
 DW 000Ah  ; 04.2
 DW 000Ch  ; 04.4
 DW 000Eh  ; 04.6
 DW 0010h  ; 04.8
 DW 0013h  ; 05.0
 DW 0016h  ; 05.2
 DW 0019h  ; 05.4
 DW 001Ch  ; 05.6
 DW 001Fh  ; 05.8
 DW 0022h  ; 06.0
 DW 0025h  ; 06.2
 DW 0028h  ; 06.4
 DW 002Bh  ; 06.6
 DW 002Dh  ; 06.8
 DW 0031h  ; 07.0
 DW 0034h  ; 07.2
 DW 0037h  ; 07.4

 DW 003Ah  ; 07.6
 DW 003Dh  ; 07.8
 DW 0040h  ; 08.0
 DW 0043h  ; 08.2
 DW 0046h  ; 08.4
 DW 0049h  ; 08.6
 DW 004Ch  ; 08.8
 DW 004Fh  ; 09.0
 DW 0052h  ; 09.2
 DW 0055h  ; 09.4
 DW 0058h  ; 09.6
 DW 005Bh  ; 09.8
 DW 005Dh  ; 10.0
Reply | Threaded
Open this post in threaded view
|

Re: Define Word DW statement in MSP430 program

MSP430 - Discuss mailing list
This looks like a simple conversion table. DW reserves and sets a word
in memory, so this would be in flash somewhere. Simply put the program
looks like it will receive, or read a value from somewhere, which it
then translates.

The first value after 'DW' is the value stored. The next values, which
follow the semicolon are comments (assembler comments follow a ';') and
inform the programmer what the stored value relates to, probably as a
read number. It appears that this is reading something, say a
temperature sensor, then reading the table to collect the next level of
data it needs to process. It cannot be a scanned table because of the
out of order and duplicate entries, ie this isn't a table that the
program searches through. therefore you will probably find it is
accessed by an instruction like:

         MOV        data,Rxx
         MOV       COND_TAB(Rxx),&SOMEVAR

or

         MOV        #COND_TAB,Rxx
         ADD        data,Rxx
         MOV        @Rxx,SOMEVAR

Can't guess much more without a lot more information, but simply put
changing the table values will change the result, and unless you have
changed the sensor, or the way the data is interpreted then you probably
don't need to do much here.

Al

On 27/10/2015 12:16 PM, MuangMuang Soe [hidden email]
[msp430] wrote:

>
>
> I am trying to understand the usage of the DW statement in this program.
> These program was written by a previous staff who has left the co,
> Anyone can explain. As I'm trying to modify the program parameters.
>
> ;***********************************************************************************
> ; Conductivity Table
> ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> * * * * *
>  EVEN
> COND_TAB
>  DW 0000h  ; 00.0
>  DW 0000h  ; 00.2
>  DW 0000h  ; 00.4
>  DW 0FFFFh  ; 00.6
>  DW 0FFFFh  ; 00.8
>  DW 0FFFEh  ; 01.0
>  DW 0FFFEh  ; 01.2
>  DW 0FFFDh  ; 01.4
>  DW 0FFFDh  ; 01.6
>  DW 0FFFEh  ; 01.8
>  DW 0FFFEh  ; 02.0
>  DW 0FFFFh  ; 02.2
>  DW 0FFFFh  ; 02.4
>  DW 0000h  ; 02.6
>  DW 0000h  ; 02.8
>  DW 0000h  ; 03.0
>  DW 0001h  ; 03.2
>  DW 0002h  ; 03.4
>  DW 0004h  ; 03.6
>  DW 0006h  ; 03.8
>  DW 0008h  ; 04.0
>  DW 000Ah  ; 04.2
>  DW 000Ch  ; 04.4
>  DW 000Eh  ; 04.6
>  DW 0010h  ; 04.8
>  DW 0013h  ; 05.0
>  DW 0016h  ; 05.2
>  DW 0019h  ; 05.4
>  DW 001Ch  ; 05.6
>  DW 001Fh  ; 05.8
>  DW 0022h  ; 06.0
>  DW 0025h  ; 06.2
>  DW 0028h  ; 06.4
>  DW 002Bh  ; 06.6
>  DW 002Dh  ; 06.8
>  DW 0031h  ; 07.0
>  DW 0034h  ; 07.2
>  DW 0037h  ; 07.4
>  DW 003Ah  ; 07.6
>  DW 003Dh  ; 07.8
>  DW 0040h  ; 08.0
>  DW 0043h  ; 08.2
>  DW 0046h  ; 08.4
>  DW 0049h  ; 08.6
>  DW 004Ch  ; 08.8
>  DW 004Fh  ; 09.0
>  DW 0052h  ; 09.2
>  DW 0055h  ; 09.4
>  DW 0058h  ; 09.6
>  DW 005Bh  ; 09.8
>  DW 005Dh  ; 10.0
>
>
>