INCL und EXCL gehen nicht bei Register?

  • 1
  • 2
  • Page 1 of 2
Lschreyer
Schreiberling
Avatar
Gender: n/a
Posts: 526
Registered: 02 / 2007
Subject:

INCL und EXCL gehen nicht bei Register?

 · 
Posted: 24.06.2019 - 13:07  ·  #1
Ich habe versucht mit INCL(INT0MASKB, 1) ein Bit eines Registers zu setzen, was aber nicht geht.
Gibt es dafür einen bestimmten Grund warum das da nicht geht?

Kann ich das nur auf normale Variablen anwenden?
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1372
Registered: 03 / 2005
Subject:

Re: INCL und EXCL gehen nicht bei Register?

 · 
Posted: 25.06.2019 - 10:21  ·  #2
Which processor? What is definition of INT0MASKB?

For example

Code
  incl( PCICR, 1 );


Works fine with mega1280 and others.
miparo
Administrator
Avatar
Gender:
Location: Germany
Age: 59
Posts: 956
Registered: 09 / 2007
Subject:

Re: INCL und EXCL gehen nicht bei Register?

 · 
Posted: 25.06.2019 - 14:31  ·  #3
Hi Merlin,

Incl(INT0MASKB,1) used the new "atomic" opcode LAS = Load and Store on Xmega Devices.
Code

LDI       _ACCBLO, INT0MASKB AND 0FFh
LDI       _ACCCHI, INT0MASKB SHRB 8
MOV       _ACCCLO, _ACCBLO
LDI       _ACCA, 002h
LAS       Z, _ACCA


a simple INT0MASKB.1:= True creates read AND write code
Code

LDS       _ACCA, 0062Ah
SBR       _ACCA, 002h
STS       0062Ah, _ACCA


Leider wissen wir nicht , ob Lschreyer ein PIC,ARM,Mega oder so benutzt?

miparo
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1372
Registered: 03 / 2005
Subject:

Re: INCL und EXCL gehen nicht bei Register?

 · 
Posted: 25.06.2019 - 16:16  ·  #4
Hi miparo.

You write Incl (INTCTRLB, 1) but the code generated uses INT0MASKB. Is that a typo?
miparo
Administrator
Avatar
Gender:
Location: Germany
Age: 59
Posts: 956
Registered: 09 / 2007
Subject:

Re: INCL und EXCL gehen nicht bei Register?

 · 
Posted: 25.06.2019 - 16:33  ·  #5
Hi Merlin,
copy&paste error :)

miparo
Lschreyer
Schreiberling
Avatar
Gender: n/a
Posts: 526
Registered: 02 / 2007
Subject:

Re: INCL und EXCL gehen nicht bei Register?

 · 
Posted: 26.06.2019 - 13:53  ·  #6
It is a Xmega256A3U
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1372
Registered: 03 / 2005
Subject:

Re: INCL und EXCL gehen nicht bei Register?

 · 
Posted: 26.06.2019 - 16:12  ·  #7
Hi

I cannot reproduce your problem. The following compiles in the latest version

Code
program Bug;

Device = Xmega256A3U, VCC=5;


Import SysTick, LCDPort;

From System Import;

Define
  OSCtype        = int32MHz,
                   PLLmul = 4,
                   prescB = 1,
                   prescC = 1;
  SysTick        = 10;             {msec}
  StackSize      = 50, iData;
  FrameSize      = 50, iData;
  LCDtype = 44780; {66712}
  LCDport = PortA; {Port Address}
  LCDRows = 2; {2-lined display}
  LCDcolumns = 16; {16-character display}

uses
  ;
  
Implementation

{$IDATA}
const

type

{--------------------------------------------------------------}
{ Var Declarations }

var
  DebugLED [@PORTB, 2] : bit;


{--------------------------------------------------------------}
{ functions }
procedure ExecDebug;
begin
    Toggle( DebugLED );
end;

{ Main Program }
{$IDATA}

begin

  EnableInts($87);

  INCL (INT0MASKB, 1);

  loop
  
  endloop;
end Bug.


Can you give a similar example that does not compile?

Regards
Lschreyer
Schreiberling
Avatar
Gender: n/a
Posts: 526
Registered: 02 / 2007
Subject:

Re: INCL und EXCL gehen nicht bei Register?

 · 
Posted: 30.06.2019 - 15:06  ·  #8
It compiles, that is not a problem, but the command does not change anything in the register.


I tried to set Bit 1 from INT0MASKB with
INCL(INT0MASKB, 1)

But bit 1 from INT0MASKB stays "0" after the command.

Only if I do a
INT0MASKB:=INT0MASKB OR %00000010
I can see the bit switched to "1"

The strange thing is, if I do a

Code
var 
  dummy: byte

INCL(dummy, 1); 

it works! But not on INT0MASKB, at least not here.
  • 1
  • 2
  • Page 1 of 2
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   136   150 · Page-Gen-Time: 0.024567s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI