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.
Using Assembly for Text Data. - jpfrolic - Sep 8 15:40:06 2008
;Assembly data storage
;File Messages.s43
;Date 9/6/2008
;
;
I have tried to use pointers to get this data but all fails. What am
I doing wrong. I am new to both C programming and the MSP430. Since
I have my solution I don't need to use the asm file. It was an easy
way to learn hownto mix asm with "C", but it didn't work out that
way.
#include
NAME Messages
PUBLIC mes1
RSEG CODE
mes1:
DB "Have a nice day!",0x00
;I have used both the termination of ; and :. Makes no difference.
END
In the C portion and using IAR for devlopment, Here is the C code
used to write to INFO memory.
extern char *mes1;
char *mes2;
mes2 = "Year";
while (*mes2 != 0)
{
RXTXData= *mes4++;
write_SegC (RXTXData);
}// end of while mes2
NO PROBLEM HERE, DATA is Written to INFO FLASH.
However the following code which references the asm listing picks up
the first to bytes "Ha" (48 61) using that as the pointer address
0x6148 where in the 2012 resides a zero and while exits.
while (*mes1 != 0) //can we get at data transferred from asm file?
{
RXTXData= *mes1++;
write_SegC (RXTXData);
}
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )
Re: Using Assembly for Text Data. - old_cow_yellow - Sep 8 15:45:19 2008
Your assembly code is fine.
In the c code, you should use:
extern char mes1;
char *ptr;
ptr = &mes1;
And access the data with *ptr++
--- In m...@yahoogroups.com, "jpfrolic"
wrote:
>
> ;Assembly data storage
> ;File Messages.s43
> ;Date 9/6/2008
> ;
> ;
> I have tried to use pointers to get this data but all fails. What am
> I doing wrong. I am new to both C programming and the MSP430. Since
> I have my solution I don't need to use the asm file. It was an easy
> way to learn hownto mix asm with "C", but it didn't work out that
> way.
>
> #include
> NAME Messages
>
> PUBLIC mes1
> RSEG CODE
>
> mes1:
> DB "Have a nice day!",0x00
> ;I have used both the termination of ; and :. Makes no difference.
>
> END
>
> In the C portion and using IAR for devlopment, Here is the C code
> used to write to INFO memory.
>
> extern char *mes1;
>
> char *mes2;
> mes2 = "Year";
>
> while (*mes2 != 0)
> {
> RXTXData= *mes4++;
>
> write_SegC (RXTXData);
> }// end of while mes2
>
> NO PROBLEM HERE, DATA is Written to INFO FLASH.
> However the following code which references the asm listing picks up
> the first to bytes "Ha" (48 61) using that as the pointer address
> 0x6148 where in the 2012 resides a zero and while exits.
>
> while (*mes1 != 0) //can we get at data transferred from asm file?
> {
> RXTXData= *mes1++;
>
> write_SegC (RXTXData);
> }
>
------------------------------------

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