also ich bin der meinung, sry aber die while schleifen sidn nicht das richtige für diesen einsatz,.
hab jetzt mal noch ne for schleife ringemacht welche mir den pointer_x hochzählt,.
jetzt werde einzelne punkte auf dem display angezeigt, schonmal etwas,.
aufruf im pogramm
hab jetzt mal noch ne for schleife ringemacht welche mir den pointer_x hochzählt,.
jetzt werde einzelne punkte auf dem display angezeigt, schonmal etwas,.
aufruf im pogramm
Code:
Do
Messergebnis = Getadc(5)
Volt = Messergebnis * Adc_multi
Print "ADC wert" ; Volt
Dim Help As String * 10
Help = "Temp Sim "
Lcd_string = Str(volt)
Lcdtext Lcd_string , 40 , 200 , 5 , Blue , White
Neu = Volt
Call Lcd_draw_time_dia(zwischenspeicher , Neu)
Zwischenspeicher = Neu
loop
end
Code:
Sub Lcd_draw_time_dia(byval Alt As Word , Neu As Word)
'Lcd_set_pixel(byval X1 As Word , Y1 As Word , Color As Word)
Const Start_x = 30
Const Start_y = 30
Const End_x = 280
Const End_y = 310
Dim Pointer_x As Word
Dim Pointer_y As Word
Dim X As Word
Dim Y As Word
Dim I As Integer
'Local Alt As Word
'Local Neu As Word
Local Mitte As Word
Local Richtung As Integer
'*Koordinatenkreuz zeichnen
Call Lcd_h_line(30 , 240 , 30 , White)
Call Lcd_v_line(30 , 320 , 30 , White)
'##########################
Pointer_x = 30 'diagramm startet bei 30pixeln
Pointer_y = 30 'diagramm startetbei 30pixeln
Call Lcd_set_pixel(alt , Pointer_x , Yellow)
Mitte = Neu - Alt
Shift Mitte , Right , 1 , Signed 'Diff = Diff / 2
Mitte = Mitte + Alt
Richtung = -1
'*linie steigt oder fällt
If Neu > Alt Then
Richtung = 1
End If
Pointer_y = Start_y + 1 'startwert in y-richtung
Print "alt: " ; Alt
Print "neu: " ; Neu
Print "mitte " ; Mitte
Print "pointer_y " ; Pointer_y
Pointer_y = Pointer_y + Richtung
Pointer_y = Pointer_y + Alt
For Pointer_x = Start_x To End_x Step 1
While Pointer_y <> Mitte 'pointer_y ungleich mitte |hier wird die erste Hälfte gezeichnet
Call Lcd_set_pixel(pointer_y , Pointer_x , White)
Print "alt-mitte pointer_y: " ; Pointer_y ; "Pointer_x: " ; Pointer_x
Pointer_y = Pointer_y + Richtung
Wend
Incr Pointer_x 'erhöhe pointer_x um eins
While Pointer_y <> Neu 'pointer_y ungleich mitte |und nun die zweite Hälfte
Call Lcd_set_pixel(pointer_y , Pointer_x , White)
Print "mitte_neu hälfte pointer_Y: " ; Pointer_y ; "Pointer_x: " ; Pointer_x
Pointer_y = Pointer_y + Richtung
Wend
Incr Pointer_x 'erhöhe pointer_x um eins
Call Lcd_set_pixel(neu , Pointer_x , White)
Print "neuer Wert : " ; Neu ; "P_x: " ; Pointer_x
Next
End Sub