Code-Beispiel
Analog- und Digitalanzeige
Lizenz: | Erster Autor: | Letzte Bearbeitung: |
k. A. | Volta | 19.02.2016 |
Analoganzeige
Diese beiden Programme sind nur als Anregun für eigene Anwendungen gedacht.
Dieses Bild sollten Sie sich auf Ihren PC laden und (z.B. mt PAINT) in eine BMP -Datei wandeln.
'Analoge Anzeige by Volta 20.01.2015
ScreenRes 370,156,32,2
WindowTitle "Analoge Anzeige by Volta"
Sub Zeiger (i As Single,z As Single)
Dim As Single a=185, x,sb,cb,sc,cc
x=(z/2-i)*(0.92/z)
sb = Sin(x)*375
cb = 415-(Cos(x)*375)
sc = Sin(x)*295
cc = 415-(Cos(x)*295)
ScreenLock 'Anzeige nicht ändern
ScreenCopy 0, 1 'kopiere Seite 0 (Scala) zu Seite 1
Line (a -sb, cb)-(a -sc, cc),&hff0000
Line (a-1-sb, cb)-(a-1-sc, cc),&hff0000
Line (a+1-sb, cb)-(a+1-sc, cc),&hff0000
ScreenUnLock 'Anzeigen
ScreenSync
End Sub
ScreenSet 0, 1 'aktive_Seite, sichtbare_Seite
Dim As Any Ptr analmes =ImageCreate(370,156,32)
BLoad("analmes.bmp", analmes)
Put(0,0),analmes, PSet
ScreenSet 1, 1 'setze aktive Seite 1
Dim As Single Schritte = 255
For i As Single = 0 To Schritte
Zeiger (i,Schritte)
Sleep 10,1
Next
Sleep
ImageDestroy analmes
Digitalanzeige
'Digitale Anzeige by Volta 25.03.2015
'Digitale Anzeige by Volta 19.02.2016 (FB 1.04 Win 10/64Bit)
'ImageScale2x (source image ptr, Dest image ptr)
Sub ImageScale2x(ByVal Image As ULong Ptr, ByVal Dest As ULong Ptr)
Dim As ULong B, D, E, F, H
Dim As Long j, k, ic, dc
Dim As Integer dp, x, y, pitch
ImageInfo Dest,dp,,,,Dest
ImageInfo image,x,y,,pitch,image
pitch \= 4
For k = 0 To y-1
For j = 0 To x-1
If k Then B = Image[ic - pitch] Else B = Image[ic]
If k = y-1 Then H = Image[ic] Else H = Image[ic + pitch]
If j Then
D = E
E = F
Else
E = Image[ic]
D = E
EndIf
If j < x-1 Then F = Image[ic + 1]
If B <> H And D <> F Then
If D = B Then Dest[dc] = D Else Dest[dc] = E
If B = F Then Dest[dc + 1] = F Else Dest[dc + 1] = E
If D = H Then Dest[dc + dp] = D Else Dest[dc + dp] = E
If H = F Then Dest[dc + dp +1] = F Else Dest[dc + dp +1] = E
Else
Dest[dc] = E
Dest[dc + 1] = E
Dest[dc + dp] = E
Dest[dc + dp +1] = E
End If
ic +=1
dc +=2
Next j
ic = ic+pitch-x
dc = dc+((dp-x)*2)
Next k
End Sub
ScreenRes 34*8,16*6,32
WindowTitle "Digitale Anzeige by Volta"
Color &hC1D2EE,&hdddddd
Dim As Integer breite, hoehe, b,h
ScreenInfo breite, hoehe
Width breite\8,hoehe\16 'Font_16 einstellen
Dim As Any Ptr img1, img2, img3
b=8*8
h=12
img1=ImageCreate(b,h,&h215Ab5)
img2=ImageCreate(b*2,h*2,&h215Ab5)
img3=ImageCreate(b*4,h*4,&h215Ab5)
For i As Single = 0 To 10 Step 10/255
Line img1,(0,0)-(b-1,h-1),&h215Ab5,bf
Draw String img1,(1,-1),Right(" "+Left(Str(i),4),5)+"mV ",&hC1D2EE
ImageScale2x(img1,img2)
ImageScale2x(img2,img3)
Put(8,20),img3,PSet
Sleep 10,1
Next
Sleep
ImageDestroy(img1)
ImageDestroy(img2)
ImageDestroy(img3)
Zusätzliche Informationen und Funktionen | |||||||
---|---|---|---|---|---|---|---|
|