Alias for a bit variable

Avra
Schreiberling
Avatar
Geschlecht:
Herkunft: Belgrade, Serbia
Alter: 54
Homepage: rs.linkedin.com/in…
Beiträge: 653
Dabei seit: 07 / 2002
Betreff:

Alias for a bit variable

 · 
Gepostet: 29.05.2014 - 13:02 Uhr  ·  #1
Right now I have to make an alias to a port bit variable like this:
Code
var
  SEL_A[@PortG, 3]: bit;
  ComMuxA[@PortG, 3]: bit;

which I do not like because I have to repeat "@PortG, 3" two times. I would prefer something like this instead:
Code
var
  SEL_A[@PortG, 3]: bit;
  ComMuxA[@SEL_A]: bit;

but compiler does not allow it.

Is there some workaround that I am not aware of?
rh
Administrator
Avatar
Geschlecht:
Herkunft: Germany
Alter: 26
Homepage: e-lab.de
Beiträge: 5558
Dabei seit: 03 / 2002
Betreff:

Re: Alias for a bit variable

 · 
Gepostet: 29.05.2014 - 15:45 Uhr  ·  #2
Hello Avra,
a bit type is very, very different from any other types.
It consists of a 16bit address and an 8bit bit-address and is more like a constant than a variable.
So it is impossible to pass such a type to a function for example.
Also your construction will not work, sorry.

But this is working:
Code
var
  BitX[@PortA, 5]: bit;
  
Alias
  BitY      = BitX;
.....
  if BitX then
  endif;
  if BitY then
  endif;

rolf
Gewählte Zitate für Mehrfachzitierung:   0

Registrierte in diesem Topic

Aktuell kein registrierter in diesem Bereich

Die Statistik zeigt, wer in den letzten 5 Minuten online war. Erneuerung alle 90 Sekunden.
MySQL Queries: 15 · Cache Hits: 14   47   61 · Page-Gen-Time: 0.019434s · Speichernutzung: 2 MB · GZIP: ein · Viewport: SMXL-HiDPI