Modify SFR with SFR_CMD

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Modify SFR with SFR_CMD

Axel_Lott
I want to change the SFR bits with the SFR_CMD. But the compile reported
many error. What is wrong in my source code?

#include <io.h>
#include <signal.h>

 int main (void) {

   P1DIR |= 0x01;
   P1DIR |= 0x10;
   P1OUT |= 0x01;
   P1OUT &= ~0x10;

   SFR_CMD(bic.b, P1OUT, 0x10);
   SFR_CMD(bis.b, IE1, WDTIE);

   return(0);

 }

The Compiler OUTPUT:

D:\Projekte\MSP430\C_TEST>msp430-gcc -mmcu=msp430x149 -O2 -Wall -g   -c -o
bugdemo.o bugdemo.c
bugdemo.c: In function `main':
bugdemo.c:12: typedef `_ts' is initialized (use __typeof__ instead)
bugdemo.c:12: invalid lvalue in asm statement
bugdemo.c:13: typedef `_ts' is initialized (use __typeof__ instead)
bugdemo.c:13: invalid lvalue in asm statement
bugdemo.c:12: output number 0 not directly addressable
bugdemo.c:13: output number 0 not directly addressable
>Exit code: 1


I start the compiler with this options:

msp430-gcc -mmcu=msp430x149 -O2 -Wall -g   -c -o bugdemo.o bugdemo.c




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: Modify SFR with SFR_CMD

Chris Liechti
[hidden email] wrote:
> I want to change the SFR bits with the SFR_CMD. But the compile reported
> many error. What is wrong in my source code?
...
>    SFR_CMD(bis.b, IE1, WDTIE);

why do you want to use SFR_CMD? the compiler generates the instruction
you want with "IE1 &= ~WDTIE;"

chris



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: Re: Modify SFR with SFR_CMD

Axel_Lott
In reply to this post by Axel_Lott

I want to set or clear similar bits of the SFR. If I use the [&= ~]
command, the compiler is generate and.b but not bic.b code. I hope the
internal hardware of the MSP430 is not modified similar bits of the SFR, if
the and.b command is executed.

axel





Chris Liechti <[hidden email]>@lists.sourceforge.net am 15.06.2005
02:39:06

Bitte antworten an [hidden email]

Gesendet von:     [hidden email]


An:     [hidden email]
Kopie:
Thema:  Re: [Mspgcc-users] Modify SFR with SFR_CMD


[hidden email] wrote:
> I want to change the SFR bits with the SFR_CMD. But the compile reported
> many error. What is wrong in my source code?
...
>    SFR_CMD(bis.b, IE1, WDTIE);

why do you want to use SFR_CMD? the compiler generates the instruction
you want with "IE1 &= ~WDTIE;"

chris



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mspgcc-users mailing list
[hidden email]
 https://lists.sourceforge.net/lists/listinfo/mspgcc-users




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: Modify SFR with SFR_CMD

Steve Underwood
Hi Axel,

The compiler only produces multiple instructions for this when
optimisation is off. If you use -O2 for the optimisation level, it
produces a single instruction. Other than the timing being slower, using
several instructions instead of one has no effect on the behaviour of
the hardware.

Steve


[hidden email] wrote:

>I want to set or clear similar bits of the SFR. If I use the [&= ~]
>command, the compiler is generate and.b but not bic.b code. I hope the
>internal hardware of the MSP430 is not modified similar bits of the SFR, if
>the and.b command is executed.
>
>axel
>
>
>
>
>
>Chris Liechti <[hidden email]>@lists.sourceforge.net am 15.06.2005
>02:39:06
>
>Bitte antworten an [hidden email]
>
>Gesendet von:     [hidden email]
>
>
>An:     [hidden email]
>Kopie:
>Thema:  Re: [Mspgcc-users] Modify SFR with SFR_CMD
>
>
>[hidden email] wrote:
>  
>
>>I want to change the SFR bits with the SFR_CMD. But the compile reported
>>many error. What is wrong in my source code?
>>    
>>
>...
>  
>
>>   SFR_CMD(bis.b, IE1, WDTIE);
>>    
>>
>
>why do you want to use SFR_CMD? the compiler generates the instruction
>you want with "IE1 &= ~WDTIE;"
>
>chris
>
>  
>



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users