Built-In Chr/Swap/Ord....

General discussion on mikroPascal for AVR.
Post Reply
Author
Message
spinnumber
Posts: 60
Joined: 22 Dec 2005 12:16
Location: France (33)

Built-In Chr/Swap/Ord....

#1 Post by spinnumber » 23 Dec 2005 10:58

I can not use Built-in like C := Ord('A') ;
compiler return Msg 4 Syntax error Expected 'end' but '(' found

vanja
mikroElektronika team
Posts: 253
Joined: 27 Jan 2005 15:13
Contact:

#2 Post by vanja » 23 Dec 2005 11:45

Try :

Code: Select all

var k : byte
...
k:="A";  // is doing the job

spinnumber
Posts: 60
Joined: 22 Dec 2005 12:16
Location: France (33)

#3 Post by spinnumber » 23 Dec 2005 12:07

Ok thanks
And for swap?
Claude

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#4 Post by zristic » 23 Dec 2005 12:26

Please read help for details, there are many questions answered there.

spinnumber
Posts: 60
Joined: 22 Dec 2005 12:16
Location: France (33)

#5 Post by spinnumber » 23 Dec 2005 13:09

zristic I had read help before post my question!
If write this line in my source file compiler retur error
PORTD := Swap(PORTB);
Error 3 Identifier 'Swap' was not declared
What is mean?
Claude

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#6 Post by zristic » 23 Dec 2005 13:13

spinnumber wrote:zristic I had read help before post my question!
If write this line in my source file compiler retur error
PORTD := Swap(PORTB);
Error 3 Identifier 'Swap' was not declared
What is mean?
It means that you called a non-existing function. In help it is described how to make your own functions:

Code: Select all

function swap(input: byte): byte;
begin
  result := input shl 4;
  input  := input shr 4;
  result := result  or input;
end;

spinnumber
Posts: 60
Joined: 22 Dec 2005 12:16
Location: France (33)

#7 Post by spinnumber » 23 Dec 2005 13:47

In help I read this

Swap
Prototype function Swap(var arg : byte) : byte;

Returns Returns byte consisting of swapped nibbles.

Description Swaps higher nibble (bits <7..4>) and lower nibble (bits <3..0>) of byte-size parameter arg.

Requires Nothing.

Example PORTB := $F0;
PORTA := Swap(PORTB); // PORTA = PORTB = $0F

Where I can read other help?
Claude

Post Reply

Return to “mikroPascal for AVR General”