MIN/de

From MCS Wiki AVR
< MIN(Difference between revisions)
Jump to: navigation, search
((**COPIED FROM ENGLISH PAGE**) =)
(Example)
 
(2 intermediate revisions by one user not shown)
Line 17: Line 17:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">Remarks</span> =
+
= <span class="f_Header">Anmerkungen</span> =
 
<div style="padding: 0px; margin: 0px 0px 0px 4px;">
 
<div style="padding: 0px; margin: 0px 0px 0px 4px;">
 
{| width="597" cellspacing="0" cellpadding="1" border="1" style="border: 1px solid rgb(0, 0, 0); border-spacing: 0px;"
 
{| width="597" cellspacing="0" cellpadding="1" border="1" style="border: 1px solid rgb(0, 0, 0); border-spacing: 0px;"
Line 25: Line 25:
  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
Variable that will be assigned with the minimum value.
+
Variable, der der Minimum-Wert zugewiesen wird.
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
Line 32: Line 32:
  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
The first address of the array.
+
Startadresse des Arrays.
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
Line 46: Line 46:
  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
The MIN statement can return the index too
+
Der MIN-Befehl kann auch den Index zurückgeben
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
 
| valign="top" width="10%" style="width: 55px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="10%" style="width: 55px; border: 1px solid rgb(0, 0, 0);" |  
Ar(1)
+
ar(1)
  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
Starting element to get the minimum value and index of
+
Startadresse des Arrays aus den das Minimum gesucht werden soll.
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
 
| valign="top" width="10%" style="width: 55px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="10%" style="width: 55px; border: 1px solid rgb(0, 0, 0);" |  
M
+
m
  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
Line 64: Line 64:
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
 
| valign="top" width="10%" style="width: 55px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="10%" style="width: 55px; border: 1px solid rgb(0, 0, 0);" |  
Idx
+
idx
  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 532px; border: 1px solid rgb(0, 0, 0);" |  
Return the index of the array that contains the minimum value. Returns 0 if there is no minimum value.
+
Gibt den Index des Array-Elementes mit dem Minimum-Wert zurück. Gibt 0 zurück wenn es kein Minumum gibt.
  
 
|}
 
|}
Line 73: Line 73:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
The MIN() ans MAX() functions work on BYTE and WORD arrays only.
+
Die MIN() und MAX() Funktionen arbeiten nur mit BYTE- und WORD-Arrays.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
Line 79: Line 79:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">See also</span> =
+
= <span class="f_Header">Siehe auch</span> =
  
 
[[MAX]]
 
[[MAX]]
Line 87: Line 87:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">Example</span> =
+
= <span class="f_Header">Beispiel</span> =
  
 
<br/><source lang="bascomavr">
 
<br/><source lang="bascomavr">
Line 99: Line 99:
 
'-----------------------------------------------------------------------------------------
 
'-----------------------------------------------------------------------------------------
 
   
 
   
$regfile = "m48def.dat" ' specify the used micro
+
$regfile = "m48def.dat" ' Mikrocontroller
$crystal = 4000000 ' used crystal frequency
+
$crystal = 4000000 ' Taktfrequenz
$baud = 19200 ' use baud rate
+
$baud = 19200 ' Baudrate
 
$hwstack = 32 ' default use 32 for the hardware stack
 
$hwstack = 32 ' default use 32 for the hardware stack
 
$swstack = 10 ' default use 10 for the SW stack
 
$swstack = 10 ' default use 10 for the SW stack
Line 107: Line 107:
 
   
 
   
 
   
 
   
' These functions only works on BYTE and WORD arrays at the moment !!!!!
+
' Diese Funktionen arbeiten nur mit BYTE- und WORD-Arrays !!!!!
 
   
 
   
 
'Dim some variables
 
'Dim some variables
 
Dim Wb As Byte , B As Byte
 
Dim Wb As Byte , B As Byte
Dim W(10) As Word ' or use a BYTE array
+
Dim W(10) As Word ' oder benutzen Sie ein Byte-Array
 
   
 
   
'fill the word array with values from 1 to 10
+
'Füllen des Word-Arrays mit Werten von 1 bis 10
 
For B = 1 To 10
 
For B = 1 To 10
 
W(b) = B
 
W(b) = B

Latest revision as of 01:21, 10 March 2013

Contents

Funktion

Gibt den Minimum-Wert eines Byte- oder Word-Arrays zurück.

 

 

Syntax

var1 = MIN(var2)

MIN(ar(1), m , idx)

 

 

Anmerkungen

var1

Variable, der der Minimum-Wert zugewiesen wird.

var2

Startadresse des Arrays.

 

 

 

Der MIN-Befehl kann auch den Index zurückgeben

ar(1)

Startadresse des Arrays aus den das Minimum gesucht werden soll.

m

Returns the minimum value of the array

idx

Gibt den Index des Array-Elementes mit dem Minimum-Wert zurück. Gibt 0 zurück wenn es kein Minumum gibt.

 

Die MIN() und MAX() Funktionen arbeiten nur mit BYTE- und WORD-Arrays.

 

 

Siehe auch

MAX

 

 

Beispiel


'-----------------------------------------------------------------------------------------
'name : minmax.bas
'copyright : (c) 1995-2005, MCS Electronics
'purpose : show the MIN and MAX functions
'micro : Mega48
'suited for demo : yes
'commercial addon needed : no
'-----------------------------------------------------------------------------------------
 
$regfile = "m48def.dat" ' Mikrocontroller
$crystal = 4000000 ' Taktfrequenz
$baud = 19200 ' Baudrate
$hwstack = 32 ' default use 32 for the hardware stack
$swstack = 10 ' default use 10 for the SW stack
$framesize = 40 ' default use 40 for the frame space
 
 
' Diese Funktionen arbeiten nur mit BYTE- und WORD-Arrays !!!!!
 
'Dim some variables
Dim Wb As Byte , B As Byte
Dim W(10) As Word ' oder benutzen Sie ein Byte-Array
 
'Füllen des Word-Arrays mit Werten von 1 bis 10
For B = 1 To 10
W(b) = B
Next
 
Print "Max number " ; Max(w(1))
Print "Min number " ; Min(w(1))
 
Dim Idx As Word , M1 As Word
Min(w(1) , M1 , Idx)
Print "Min number " ; M1 ; " index " ; Idx
 
Max(w(1) , M1 , Idx)
Print "Max number " ; M1 ; " index " ; Idx
End

Languages   English Deutsch  
Personal tools
Namespaces
Variants
Actions
Navigation
In other languages
Language