swap not available?

General discussion on mikroPascal PRO for AVR.
Post Reply
Author
Message
corado
Posts: 399
Joined: 28 Mar 2009 11:03

swap not available?

#1 Post by corado » 05 Aug 2022 08:07

If I try this, I got


20 303 Identifier "Swap" was not declared Atmega32_Resistor_array.mpas
20 301 "("is not valid identifier Atmega32_Resistor_array.mpas
20 304 Syntax error: Expected "end" but "(" found Atmega32_Resistor_array.mpas
20 304 Syntax error: Expected "end" but "PORTC" found Atmega32_Resistor_array.mpas
20 304 Syntax error: Expected "end" but ")" found Atmega32_Resistor_array.mpas
20 304 Syntax error: Expected "." but ";" found Atmega32_Resistor_array.mpas
0 102 Finished (with errors): 05 Aug 2022, 09:03:35 Atmega32_Resistor_array.mppav

Code: Select all

program Atmega32;


{ Declarations section }
  VAR n : Byte;
begin
  { Main program }
  DDRC    := 0xFF;
  PortC   := 0x00;
  DDRD.6  := 1;
  PortD.6 := 0;

  While True DO
  Begin
  For n := 0 TO 255 DO
  Begin
       PortC := PortC XOR n;
       PORTC := Swap(PORTC);
       delay_ms(2000);
       PortD.6 := not PortD.6;
  end;
  end;
[code]

corado
Posts: 399
Joined: 28 Mar 2009 11:03

Re: swap not available?

#2 Post by corado » 05 Aug 2022 08:18

howw can I swap 0123 and BIt 4567?

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: swap not available?

#3 Post by filip » 12 Aug 2022 08:13

Hi,

Please have a look at this implementation :
https://www.deltics.co.nz/blog/posts/1233/

Regards,
Filip.

Post Reply

Return to “mikroPascal PRO for AVR General”