Herzlich Willkommen im einzigen (deutschsprachigem) Picaxe-Forum.

Der Ursprung dieses Forum reicht bis in das Jahr 2008 zurück

Foren Suche

  • HC-05 ??Datum12.07.2023 23:19
    Foren-Beitrag von BoomBoomMagic im Thema HC-05 ??

    Hab ich mir fast gedacht .

    Is ja bei der Picaxe schon fast wie : Im Kindergarten fragen wer kennt sich mit der Relativitätstheorie aus

  • HC-05 ??Datum11.07.2023 18:02
    Thema von BoomBoomMagic im Forum Little small Talk

    Mal ne Frage an alle .

    Schon mal jemand mit nem HC-05 einen ELM327 ausgelesen ??

    Oder sogar mit nem MCP2515 den OBDII ?

  • ZeitschalterDatum09.07.2023 13:24
    Foren-Beitrag von BoomBoomMagic im Thema Zeitschalter

    [[File:Harry.jpg|none|auto]]

    Hallo Harry ,

    gut, also soooo verkehrt ist diese Art jetzt nicht.
    Wüßte ich keinen besseren Weg , wäre auch das meine erste Wahl.

    Aber da man ja das Glück mit TIME hat, ist es so einfacher

  • Ich wußt ja nicht das das noch immer um die ur alte Picaxe ging ;-)
    Beim Atmel is das sehr einfach :-)

  • ZeitschalterDatum07.07.2023 15:02
    Foren-Beitrag von BoomBoomMagic im Thema Zeitschalter

    Hab das mal just gemacht .... nicht daste da jetzt tagelang dran bastelst ...

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
     

     

    #picaxe 08M2
     
    let Dirs=%00000001
     

     
    Main:
    let Time=0
     
    Do
    loop until Time>43200
     
    let Time=0
    pinc.0=1
     
    do
    loop until Time>300
     
    pinc.0=0
     
    goto Main

     
     

  • ZeitschalterDatum07.07.2023 13:31
    Foren-Beitrag von BoomBoomMagic im Thema Zeitschalter

    Hallo Harry

    uih uih ... Picaxe is ja doch schon etwas her .

    Es gibt den Befehl : TIMER
    Dieser arbeitet im Sekundentakt.
    65536 Sekunden und läuft dann wieder von NULL los.
    65536 Sekunden = 18 Std


    Das heißt , wenn diesen Timer auf Null setzt, dann in einer Loop abfragst wann dieser TIMER größer 43200 is ( =12 Std ) kannst in wieder auf Nullsetzen ,
    die Pumpe anschalten zur Bewässerung und so lange laufen lassen bis TIMER > 300 Sekunden (= 5min.) ist.
    Danach wieder TIMER auf Null setzen und von vorne beginnen.

  • So .
    Hier mal ein Vorschlag :

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
     

     

    Do
    Main:
     

    If NEUwert<ALTwert then
     
    If ALTwert-50<0 then
    ALTwert=0
    goto Main
    endif
     
    ALTwert=ALTwert-50
     
    goto Main
     
    endif
     

     
    If NEUwert>ALTwert then
     
    If ALTwert+50>1023 then
    ALTwert=1023
    goto Main
    endif
     
    ALTwert=ALTwert+50
     
    goto Main
     
    endif
     
    Loop
     

     

  • ..... Gedankenfehler ...

  • Is zwar noch früh am Morgen .... aber ich glaube , ich habs begriffen :-)

  • Also , Du möchtest das eine Variable nur einen neuen Wert enthällt , wenn diese + - 50 dem alten ist -- ok , nicht das Problem.

    Zitat

    Auẞerhalb dieser Bereichsgrenze soll er auf das max Limit begrenzt werden.



    Was heißt das ?
    Außerhalb dieser Grenze soll er auf max. begrenzt sein ??

  • nur ein Test ...Datum06.07.2023 12:42
    Foren-Beitrag von BoomBoomMagic im Thema nur ein Test ...

    Tja, ... es gibt so viele Layouts ....
    Nur müsse ich dann viele Einstellungen anpassen .

    Da ich das nicht jeden Tag mache , kost mich das dann auch jeweils gut nen Tag.
    Ergo :
    Alles lassen wie es ist

  • nur ein Test ...Datum05.07.2023 12:53
    Foren-Beitrag von BoomBoomMagic im Thema nur ein Test ...

    Naja , alte Besen kehren gut .....
    hab's wieder in blau gemacht.
    Es sind sooo viele Einstellungen zu machen ... :-(

  • nur ein Test ...Datum05.07.2023 12:18
    Foren-Beitrag von BoomBoomMagic im Thema nur ein Test ...

    Ach , der Herr Joe

    Es ist zum Einen ein Update und zum Anderen auch ein neues Design.
    Mir war des blau ein wenig langweilig geworden.
    Ich weiß net , was man jetzt hiervon halten soll ??

  • nur ein Test ...Datum03.07.2023 13:59
    Foren-Beitrag von BoomBoomMagic im Thema nur ein Test ...

    Tja , ....

    sollen wa das so lassen ??

  • nur ein Test ...Datum03.07.2023 11:54
    Thema von BoomBoomMagic im Forum Little small Talk

    Brabbel Brabbel

    Tüdelü Tüdelü

    Interessant

  • AVR für EinsteigerDatum31.05.2023 18:52
    Foren-Beitrag von BoomBoomMagic im Thema AVR für Einsteiger

    Finde ich immer lustig .... im Sommer kein Zeit , mach ich im Winter ...

    Wohnt ihr den Sommer über immer alle woanders ???
    Für mich ist's im Sommer oder Winter immer die gleiche Wohnung und der gleiche Alltag ..? ..

  • AVR für EinsteigerDatum31.05.2023 10:07
    Foren-Beitrag von BoomBoomMagic im Thema AVR für Einsteiger

    Na ?
    Was macht denn Deine Oddysee nach Grafikdisplay's

  • AVR für EinsteigerDatum21.05.2023 11:05
    Foren-Beitrag von BoomBoomMagic im Thema AVR für Einsteiger

    Naja, ... das Display ist sehr günstig.
    Warum ?
    Es kann ja von Haus aus nix !
    Also , ... man muss ihm alles sagen.
    Hierbei handelt es sich um ein Display mit : SPI
    Woher nimmst die Befehle ?????
    Diese sind nicht bei der Bestellung mit bei !!
    Die mussu mühsam suchen ....


    $regfile = "M8def.dat"
    $crystal = 16000000
    $hwstack = 512
    $swstack = 512
    $framesize = 512
    $baud = 57600


    Lots of constants


    Const Driver_code_read = $00
    Const Start_oscillation = $00
    Const Driver_output_control = $01
    Const Lcd_driving_control = $02
    Const Entry_mode = $03
    Const Resize_control = $04
    Const Display_control_1 = $07
    Const Display_control_2 = $08
    Const Display_control_3 = $09
    Const Display_control_4 = $0a
    Const Rgb_display_interface_control_1 = $0c
    Const Frame_maker_position = $0d
    Const Rgb_display_interface_control_2 = $0f
    Const Power_control_1 = $10
    Const Power_control_2 = $11
    Const Power_control_3 = $12
    Const Power_control_4 = $13
    Const Horizontal_gram_address = $20
    Const Vertical_gram_address = $21
    Const Write_data_to_gram = $22
    Const Power_control_7 = $29
    Const Frame_rate_and_color_control = $2b
    Const Gamma_control_1 = $30
    Const Gamma_control_2 = $31
    Const Gamma_control_3 = $32
    Const Gamma_control_4 = $35
    Const Gamma_control_5 = $36
    Const Gamma_control_6 = $37
    Const Gamma_control_7 = $38
    Const Gamma_control_8 = $39
    Const Gamma_control_9 = $3c
    Const Gamma_control_10 = $3d
    Const Horizontal_add_start_position = $50
    Const Horizontal_add_end_position = $51
    Const Vertical_add_start_position = $52
    Const Vertical_add_end_position = $53
    Const Driver_output_control_2 = $60
    Const Base_image_display_control = $61
    Const Vertical_scroll_control = $6a
    Const Partial_image_1_display_position = $80
    Const Partial_image_1_area_start_line = $81
    Const Partial_image_1_area_end_line = $82
    Const Partial_image_2_display_position = $83
    Const Partial_image_2_area_start_line = $84
    Const Partial_image_2_area_end_line = $85
    Const Panel_interface_control_1 = $90
    Const Panel_interface_control_2 = $92
    Const Panel_interface_control_3 = $93
    Const Panel_interface_control_4 = $95
    Const Panel_interface_control_5 = $97
    Const Panel_interface_control_6 = $98
    Const Pi = 3.14159265358979

    '-------------------------------------------------------------------------------
    'pre define Colors
    '-------------------------------------------------------------------------------

    Const Red = &HF800
    Const Green = &H07E0
    Const Blue = &H001F
    Const White = &HFFFF
    Const Black = &H0000
    Const Yellow = &HFFE0
    Const Cyan = &H0410
    Const Magenta = &H8010
    Const Brown = &HFC00
    Const Olive = &H8400
    Const Bright_red = &HF800
    Const Bright_green = &H07E0
    Const Bright_blue = &H001F
    Const Bright_yellow = &HFFE0
    Const Bright_cyan = &H07FF
    Const Bright_magenta = &HF81F
    Const Light_gray = &H8410
    Const Dark_gray = &H4208
    Const Light_blue = &H841F
    Const Light_green = &H87F0
    Const Light_cyan = &H87FF
    Const Light_red = &HFC10
    Const Gray1 = &HC618
    Const Gray2 = &HA514
    Const Gray3 = &H630C
    Const Gray4 = &H4208
    Const Gray5 = &H2104
    Const Gray6 = &H3186
    Const Blue0 = &H1086
    Const Blue1 = &H3188
    Const Blue2 = &H4314
    Const Blue3 = &H861C
    Const Cyan0 = &H3D34
    Const Cyan1 = &H1DF7
    Const Green0 = &H0200
    Const Green1 = &H0208


    Configuring the hardware ports


    Data_disp Alias Porta
    Rs_disp Alias Portd.7
    Wr_disp Alias Portg.2
    _wr_disp Alias 2
    Cs_disp Alias Portg.1
    Res_disp Alias Portg.0

    Config Rs_disp = Output
    Config Cs_disp = Output
    Config Wr_disp = Output
    Config Res_disp = Output
    Config Data_disp = Output

    \C7onfigure clock for AVR-DOS
    Config Clock = Soft
    Enable Interrupts
    Config Date = Mdy , Separator = .


    Declaring the subroutines


    Declare Sub Ili9325_init(byval Modus As Byte , Byval Direction As Word)
    Declare Sub Ili9325_write_reg(byval Index As Byte , Byval Daten As Word)
    Declare Sub Ili9325_write_data(byval Daten As Word) 'was byref
    Declare Sub Ili9325_select_reg(byval Index As Byte )
    Declare Sub Ili9325_exit_sleep()
    Declare Sub Ili9325_enter_sleep()
    Declare Sub Ili9325_scroll(byval Lines As Word )
    Declare Sub Ili9325_set_window(byval Xpos As Word , Byval Ypos As Word , Byval Xsize As Word , Byval Ysize As Word)
    Declare Sub Ili9325_negate(byval Art As Word )
    Declare Sub Ili9325_set_pixel(byval X1 As Word , Byval Y1 As Word , Byval Color As Word)
    Declare Sub Ili9325_set_cursor(byval X As Word , Y As Word )
    Declare Sub Ili9325_text(byval Lcd_text As String , Byval Lcd_posx As Word , Byval Lcd_posy As Word , Byval Fontset As Byte , Byval Forecolor As Word , Byval Backcolor As Word)
    Declare Sub Ili9325_line(byval X1 As Word , Byval Y1 As Word , Byval X2 As Word , Byval Y2 As Word , Byval Pen_width As Byte , Byval Color As Word)
    Declare Sub Ili9325_box(byval X1 As Word , Byval Y1 As Word , Byval X2 As Word , Byval Y2 As Word , Byval Fill_color As Word , Byval Border_color As Word , Byval Fill As Byte , Byval Show_border As Byte)
    Declare Sub Ili9325_lineto(byval X As Word , Byval Y As Word , Byval Pen_width As Byte , Byval Color As Word)
    Declare Sub Ili9325_moveto(byval X As Word , Byval Y As Word)
    Declare Sub Ili9325_drawcircle(byval Centerx As Word , Byval Centery As Word , Byval Radius As Word , Byval Sides As Word , Byval Pen_width As Byte , Byval Color As Word)
    Declare Sub Ili9325_drawarc(byval Centerx As Word , Byval Centery As Word , Byval Radius As Word , Byval Startangle As Word , Byval Arcangle As Word , Byval Steps As Word , Byval Pen_width As Byte , Byval Color As Word)
    Declare Sub Ili9325_drawrect(byval X1 As Word , Byval Y1 As Word , Byval X2 As Word , Byval Y2 As Word , Byval Pen_width As Byte , Byval Color As Word)
    Declare Sub Ili9325_showpicture(byval Xoffset As Word , Byval Yoffset As Word) 'Draw an Bascom BGC image on the lcd
    Declare Sub Ili9325_clear(byval Color As Word , Byval Direction As Word)
    Declare Sub Ili9325_draw_bmp(byval Filename As String , Byval Xpos As Word , Byval Ypos As Word)


    Declaring the functions


    Declare Function Ili9325_trigfunctionx(byval Pointratio As Single) As Single
    Declare Function Ili9325_trigfunctiony(byval Pointratio As Single) As Single
    Declare Function Ili9325_get_color(byval R As Byte , Byval G As Byte , Byval B As Byte) As Word
    Declare Function Ili9325_rgb16(byval Rgb8 As Byte) As Word
    'Convert the 8bit RRRGGGBB bgc data to 16 bit RRRRRGGGGGGBBBBB


    Dimensioning the variables


    Dim Color_array(10) As Word
    Color_array(1) = Red
    Color_array(2) = Green
    Color_array(3) = Blue
    Color_array(4) = White
    Color_array(5) = Bright_yellow
    Color_array(6) = Yellow
    Color_array(7) = Cyan
    Color_array(8) = Magenta
    Color_array(9) = Brown
    Color_array(10) = Olive

    Dim X_pixel As Word , Y_pixel As Word
    Dim Move_x As Word , Move_y As Word
    Dim Display_modus As Byte
    Dim Out_of_range As Byte
    Dim Xx1 As Word , Xx2 As Word , Yy1 As Word , Yy2 As Word , Kleur As Word
    Dim Penwidth As Byte , Radius As Word
    Dim Modus As Byte
    Dim Direction As Word
    Dim Hulpstring As String * 30
    Dim Rgb16 As Word
    Dim Rgb16_l As Byte At Rgb16 Overlay
    Dim Rgb16_h As Byte At Rgb16 + 1 Overlay
    Dim Wtemp1 As Word , Wtemp2 As Word
    Dim Btemp1 As Byte
    Dim Lcd_text As String * 30



    'for BMP-routine
    Dim Line_len As Word
    Dim Line_byte As Word
    Dim Bmp_read_pos As Long
    Dim Biwidth As Word 'normaly long, but we can't handle bigger bmp's!
    Dim Biheight As Word 'normaly long, but we can't handle bigger bmp's!


    'for AVR-DOS
    Dim Gbdriveerror As Byte ' General Driver Error register
    Dim Gbdriveerrorreg As Byte ' Driver load Error-Register of HD in case of error
    Dim Gbdrivestatusreg As Byte ' Driver load Status-Register of HD on case of error
    Dim Gbdrivedebug As Byte


    AVR-DOS SPI Settings


    ' Chip Select Pin => Pin 1 of MMC/SD
    Config Pinb.0 = Output
    Mmc_cs Alias Portb.0
    Set Mmc_cs



    ' MOSI - Pin => Pin 2 of MMC/SD
    Config Pinb.2 = Output
    Set Portb.2
    Mmc_portmosi Alias Portb
    Bmmc_mosi Alias 2



    ' MISO - Pin => Pin 7 of MMC/SD
    Config Pinb.3 = Input
    Mmc_portmiso Alias Pinb
    Bmmc_miso Alias 3



    ' SCK - Pin => Pin 5 of MMC/SD
    Config Pinb.1 = Output
    Set Portb.1
    Mmc_portsck Alias Portb
    Bmmc_sck Alias 1

    ' Error
    Const Cperrdrivereset = 225 ' Error response Byte at Reset command
    Const Cperrdriveinit = 226 ' Error response Byte at Init Command
    Const Cperrdrivereadcommand = 227 ' Error response Byte at Read Command
    Const Cperrdrivewritecommand = 228 ' Error response Byte at Write Command
    Const Cperrdrivereadresponse = 229 ' No Data response Byte from MMC at Read
    Const Cperrdrivewriteresponse = 230 ' No Data response Byte from MMC at Write
    Const Cperrdrive = 231
    Const Cperrdrivenotsupported = 232 ' return code for DriveGetIdentity, not supported yet
    Waitms 1 ' Wait some time before initialising MMC/SD

    $lib "MMC.LIB" ' link driver library
    $external _mmc

    Gbdriveerror = Driveinit()
    If Gbdriveerror = 0 Then



    ' Include AVR-DOS Configuration and library
    $include "Config_AVR-DOS.BAS"



    Demo code


    Call Ili9325_init(2 , 2)
    'clear screen
    Call Ili9325_clear(white , 0)
    'tekst plaatsen
    Call Ili9325_text( "AVR-DOS" , 5 , 20 , 2 , Black , White)

    Wait 5

    Call Ili9325_text( "Init File System..." , 5 , 60 , 1 , Black , White)
    Btemp1 = Initfilesystem(1) ' Partition 1
    ' use 0 for drive without Master boot record
    If Btemp1 <> 0 Then
    Call Ili9325_text( "Error:" , 5 , 80 , 1 , Black , White)
    Hulpstring = Str(btemp1)
    Call Ili9325_text(hulpstring , 40 , 80 , 1 , Black , White)
    Call Ili9325_text( "at Init file system" , 60 , 80 , 1 , Black , White)
    Else
    Call Ili9325_text( "OK" , 5 , 80 , 1 , Black , White)
    Call Ili9325_text( "Filesystem: " , 5 , 100 , 1 , Black , White)
    Hulpstring = Str(gbfilesystem)
    Call Ili9325_text(hulpstring , 170 , 100 , 1 , Black , White)
    Call Ili9325_text( "FAT Start Sector:" , 5 , 120 , 1 , Black , White)
    Hulpstring = Str(glfatfirstsector)
    Call Ili9325_text(hulpstring , 170 , 100 , 1 , Red , White)
    Call Ili9325_text( "Root Start Sector:" , 5 , 120 , 1 , Black , White)
    Hulpstring = Str(glrootfirstsector)
    Call Ili9325_text(hulpstring , 170 , 120 , 1 , Red , White)
    Call Ili9325_text( "Data First Sector:" , 5 , 140 , 1 , Black , White)
    Hulpstring = Str(gldatafirstsector)
    Call Ili9325_text(hulpstring , 170 , 140 , 1 , Red , White)
    Call Ili9325_text( "Max. Cluster Number:" , 5 , 160 , 1 , Black , White)
    Hulpstring = Str(glmaxclusternumber)
    Call Ili9325_text(hulpstring , 170 , 160 , 1 , Red , White)
    Call Ili9325_text( "Sectors per Cluster:" , 5 , 180 , 1 , Black , White)
    Hulpstring = Str(gbsectorspercluster)
    Call Ili9325_text(hulpstring , 170 , 180 , 1 , Red , White)
    Call Ili9325_text( "Root Entries:" , 5 , 200 , 1 , Black , White)
    Hulpstring = Str(gwrootentries)
    Call Ili9325_text(hulpstring , 170 , 200 , 1 , Red , White)
    Call Ili9325_text( "Sectors per FAT:" , 5 , 220 , 1 , Black , White)
    Hulpstring = Str(glsectorsperfat)
    Call Ili9325_text(hulpstring , 170 , 220 , 1 , Red , White)
    Call Ili9325_text( "Number of FAT:" , 5 , 240 , 1 , Black , White)
    Hulpstring = Str(gbnumberoffats)
    Call Ili9325_text(hulpstring , 170 , 240 , 1 , Red , White)
    End If
    Else
    ' Print #1 , "Error during Drive Init: " ; Gbdriveerror
    End If



    ' If you want to test with File-System Interpreter uncomment next line
    '$include "FS_Interpreter.bas"


    Wait 10


    Do
    'clear screen white
    Call Ili9325_clear(white , 0)
    'place text
    Call Ili9325_text( " 8-bit " , 5 , 30 , 2 , Black , White)
    Call Ili9325_text( " Demo of a " , 5 , 65 , 2 , Black , White)
    Call Ili9325_text( " 240x320 display " , 5 , 100 , 2 , Red , White)



    Wait 2

    Call Ili9325_clear(black , 0)
    Call Ili9325_draw_bmp( "demo.bmp" , 1 , 1) 'Shows 24bit windows BMP



    Wait 10

    Call Ili9325_clear(black , 0)
    Restore Aandelen
    Call Ili9325_showpicture(10 , 5)

    Restore Agenda
    Call Ili9325_showpicture(85 , 5)

    Restore Bascom
    Call Ili9325_showpicture(160 , 5)

    Restore Calculator
    Call Ili9325_showpicture(10 , 85)

    Restore Bens
    Call Ili9325_showpicture(85 , 85)

    Restore Contacten
    Call Ili9325_showpicture(160 , 85)

    Restore Fotos
    Call Ili9325_showpicture(10 , 164)

    Restore Pa0kn
    Call Ili9325_showpicture(85 , 164)

    Restore Kaarten
    Call Ili9325_showpicture(160 , 164)

    Restore Klok
    Call Ili9325_showpicture(10 , 240)

    Restore Sms
    Call Ili9325_showpicture(85 , 240)

    Restore Weer
    Call Ili9325_showpicture(160 , 240)

    Wait 10

    'scroll in two speeds
    For Wtemp1 = 1 To 320
    Call Ili9325_scroll(wtemp1)
    If Wtemp1 < 50 Then Waitms 100
    If Wtemp1 > 50 Then Waitms 5
    Next Wtemp1

    Wait 2

    '
    'composite screen
    Call Ili9325_negate(0)
    Wait 1
    Call Ili9325_negate(1)
    Wait 1
    Call Ili9325_negate(0)
    Wait 1
    Call Ili9325_negate(1)
    '

    Call Ili9325_clear(red , 0)
    Wait 2

    Call Ili9325_text( "Functions(1):" , 10 , 10 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_init" , 10 , 35 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_scroll" , 10 , 60 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_text" , 10 , 85 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_clear" , 10 , 110 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_moveto" , 10 , 135 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_lineto" , 10 , 160 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_negate" , 10 , 185 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_set_cursor" , 10 , 210 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_set_pixel" , 10 , 235 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_set_window" , 10 , 260 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_get_color" , 10 , 285 , 2 , White , Red)

    Wait 5

    'scroll
    For Wtemp1 = 1 To 320
    Call Ili9325_scroll(wtemp1)
    If Wtemp1 < 50 Then Waitms 100
    If Wtemp1 > 50 Then Waitms 1
    Next Wtemp1

    Wait 1

    For Wtemp1 = 320 To 1 Step -1
    Call Ili9325_scroll(wtemp1)
    If Wtemp1 < 50 Then Waitms 100
    If Wtemp1 > 50 Then Waitms 1
    Next Wtemp1
    Call Ili9325_scroll(0)
    Call Ili9325_clear(red , 0)

    Wait 2

    Call Ili9325_text( "Functions(2):" , 10 , 10 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_line" , 10 , 35 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_box" , 10 , 60 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_drawcircle" , 10 , 85 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_drawarc" , 10 , 110 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_drawrect" , 10 , 135 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_showpicture" , 10 , 160 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_..." , 10 , 185 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_..." , 10 , 210 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_..." , 10 , 235 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_..." , 10 , 260 , 2 , White , Red)
    Call Ili9325_text( "Ili9325_..." , 10 , 285 , 2 , White , Red)



    Wait 5

    'scroll
    For Wtemp1 = 1 To 320
    Call Ili9325_scroll(wtemp1)
    If Wtemp1 < 50 Then Waitms 100
    If Wtemp1 > 50 Then Waitms 1
    Next Wtemp1

    Wait 1

    For Wtemp1 = 320 To 1 Step -1
    Call Ili9325_scroll(wtemp1)
    If Wtemp1 < 50 Then Waitms 100
    If Wtemp1 > 50 Then Waitms 1
    Next Wtemp1

    Call Ili9325_scroll(0)

    Wait 4

    Call Ili9325_clear(blue , 0)
    Call Ili9325_text( "ili9325_moveto" , 10 , 10 , 2 , White , Blue)
    Call Ili9325_text( "ili9325_lineto" , 10 , 35 , 2 , White , Blue)
    Call Ili9325_set_window(1 , 1 , 240 , 320)
    For Wtemp1 = 1 To 320 Step 3
    Call Ili9325_moveto(10 , Wtemp1)
    Call Ili9325_lineto(240 , Wtemp1 , 1 , White)
    Next Wtemp1

    Wait 5

    'spagetti
    Call Ili9325_clear(white , 0)
    Call Ili9325_text( "ili9325_line" , 10 , 10 , 2 , Black , White)
    Call Ili9325_text( "Mikado" , 10 , 35 , 2 , Black , White)
    Call Ili9325_set_window(1 , 1 , 240 , 320)
    For Wtemp1 = 1 To 100
    Kleur = Rnd(10)
    Xx1 = Rnd(240)
    Xx2 = Rnd(240)
    Yy1 = 50 + Rnd(270)
    Yy2 = 50 + Rnd(270)
    Penwidth = Rnd(4)
    Call Ili9325_line(xx1 , Yy1 , Xx2 , Yy2 , Penwidth , Color_array(kleur))
    Next Wtemp1

    Wait 5

    Call Ili9325_clear(white , 0)
    Call Ili9325_set_window(1 , 1 , 240 , 320)
    For Wtemp1 = 1 To 65535
    Call Ili9325_write_reg(write_data_to_gram , Wtemp1)
    Next Wtemp1

    For Wtemp1 = 1 To 65535 Step 10000
    Wtemp2 = 65535 - Wtemp1
    Call Ili9325_text( " Kleurtje.." , 50 , 20 , 2 , Wtemp1 , Wtemp2)
    Next Wtemp1

    For Wtemp1 = 1 To 320
    Call Ili9325_scroll(wtemp1)
    If Wtemp1 < 50 Then Waitms 100
    If Wtemp1 > 50 Then Waitms 1
    Next Wtemp1

    Wait 1

    For Wtemp1 = 320 To 1 Step -25
    Call Ili9325_scroll(wtemp1)
    If Wtemp1 > 50 Then Wait 1
    Next Wtemp1

    Wait 1

    Call Ili9325_scroll(0)



    Wait 5

    ' *** partial Image ***
    Call Ili9325_clear(black , 0)
    Call Ili9325_text( "Graphic Sample" , 10 , 10 , 2 , Yellow , Black)
    Call Ili9325_text( "by six1" , 120 , 30 , 2 , Yellow , Black)
    Call Ili9325_text( "Partial Images" , 1 , 60 , 2 , White , Black)
    Wait 2
    Call Ili9325_clear(white , 0)

    Call Ili9325_write_reg(display_control_1 , &B001_0000_0111_0011)
    Call Ili9325_write_reg(partial_image_1_area_start_line , 0)
    Call Ili9325_write_reg(partial_image_1_area_end_line , 40)
    Call Ili9325_write_reg(partial_image_1_display_position , 319)
    Call Ili9325_text( "Dit is nog een scroll-test" , 10 , 280 , 1 , Black , White )
    Call Ili9325_text( "om te laten zien dat de" , 10 , 290 , 1 , Black , White )
    Call Ili9325_text( "ILI9325 ook bij scrollen" , 10 , 300 , 1 , Black , White )
    Call Ili9325_text( "tempo kan maken..." , 10 , 310 , 1 , Black , White )
    For Wtemp1 = 319 To 0 Step -1
    Call Ili9325_write_reg(partial_image_1_display_position , Wtemp1)
    Waitms 20
    Next Wtemp1

    Call Ili9325_clear(white , 0)
    Call Ili9325_write_reg(display_control_1 , &B000_0001_0111_0011)
    Call Ili9325_text( "...slaapverwekkend" , 10 , 50 , 2 , Red , White)
    Wait 1
    Call Ili9325_text( "dan maken we een" , 10 , 70 , 2 , Red , White)
    Call Ili9325_text( " beetje tempo" , 10 , 90 , 2 , Red , White)
    Wait 1

    Call Ili9325_write_reg(display_control_1 , &B001_0000_0111_0011)
    Call Ili9325_write_reg(partial_image_1_area_start_line , 0)
    Call Ili9325_write_reg(partial_image_1_area_end_line , 40)
    Call Ili9325_write_reg(partial_image_1_display_position , 319)
    Call Ili9325_text( "Dit is nog een scroll-testt" , 10 , 280 , 1 , Black , White )
    Call Ili9325_text( "om te laten zien dat de" , 10 , 290 , 1 , Black , White )
    Call Ili9325_text( "ILI9325 ook bij scrollen" , 10 , 300 , 1 , Black , White )
    Call Ili9325_text( "tempo kan maken..." , 10 , 310 , 1 , Black , White )
    For Wtemp1 = 319 To 0 Step -1
    Call Ili9325_write_reg(partial_image_1_display_position , Wtemp1)
    Waitms 2
    Next Wtemp1
    For Wtemp1 = 0 To 319
    Call Ili9325_write_reg(partial_image_1_display_position , Wtemp1)
    Waitms 2
    Next Wtemp1

    Wait 5

    Call Ili9325_init(2 , 2) '2 = beneden naar boven
    Call Ili9325_clear(white , 0)
    Call Ili9325_text( "ili9325_drawrect" , 10 , 10 , 2 , Black , White)
    Call Ili9325_set_window(1 , 1 , 240 , 320)
    For Wtemp1 = 1 To 100
    Kleur = Rnd(10)
    Xx1 = Rnd(240)
    Xx2 = Rnd(240)
    Yy1 = 50 + Rnd(240)
    Yy2 = 50 + Rnd(240)
    Penwidth = Rnd(4)
    Penwidth = Rnd(4)
    Waitms 150
    Call Ili9325_drawrect(xx1 , Yy1 , Xx2 , Yy2 , Penwidth , Color_array(kleur))
    Next Wtemp1
    Wait 5

    Call Ili9325_clear(white , 0)
    Call Ili9325_text( "ili9325_showpicture" , 5 , 10 , 2 , Black , White)
    Call Ili9325_set_window(1 , 1 , 240 , 320)

    Restore Plaatje
    Call Ili9325_showpicture(50 , 50)
    Wait 5

    Call Ili9325_draw_bmp( "babe.bmp" , 20 , 100) 'Shows 24bit windows BMP
    Wait 25

    Call Ili9325_clear(blue , 0)
    Wait 2

    Call Ili9325_clear(red , 1)
    Wait 2

    Call Ili9325_clear(green , 2)
    Wait 2

    Call Ili9325_clear(black , 3)
    Wait 2

    Call Ili9325_text( "That's all" , 60 , 210 , 2 , White , Black)
    Call Ili9325_text( " folks!!" , 60 , 250 , 2 , White , Black)

    Wait 5

    Loop
    End


    Declare sub ili9325_init(byval Modus as Byte, Byval Direction as Word)


    Sub Ili9325_init(byval Modus As Byte , Byval Direction As Word)
    'reset
    Res_disp = 1
    Waitms 5
    Res_disp = 0
    Waitms 15
    Res_disp = 1
    Waitms 15

    ' Modus:
    ' 1 - Vertical
    ' 2 - Horizontal
    ' Direction : 0 -3

    Display_modus = Modus
    Call Ili9325_write_reg(start_oscillation , &B0000_0000_0000_0001)
    Waitms 10
    ' the shift direction of outputs is from S1 to S720
    Call Ili9325_write_reg(driver_output_control , &B0000_0000_0000_0000 )
    ' the shift direction of outputs is from S720 to S1
    'Call Ili9325_write_reg(driver_output_control , &B0000_0001_0000_0000 )
    Call Ili9325_write_reg(lcd_driving_control , &B0000_0111_0000_0000 )
    Direction = Direction And 3
    Shift Direction , Left , 4
    'Horizontal left-upper to right-bottom
    If Modus = 1 Then
    Direction = Direction Or &B0001000000001000 '4104
    Call Ili9325_write_reg(entry_mode , Direction )
    X_pixel = 320
    Y_pixel = 240
    End If
    'Vertical left-upper to right-bottom
    If Modus = 2 Then
    Direction = Direction Or &B0001000000_00_0_000 '4096 &B0001000000000000 ' I/D[1:0] AM richting schrijven...
    Call Ili9325_write_reg(entry_mode , Direction)
    X_pixel = 240
    Y_pixel = 320
    End If

    Call Ili9325_write_reg(&He5 , &H7800) 'SRAM internal timing
    Call Ili9325_write_reg(resize_control , &H0000) 'resize register
    Call Ili9325_write_reg(display_control_2 , &H0207) 'set the back porch and the front porch
    Call Ili9325_write_reg(display_control_3 , &H0000) 'set non-display area refresh cycle ISC[3:0]
    Call Ili9325_write_reg(display_control_4 , &H0000) 'FMARK function
    Call Ili9325_write_reg(rgb_display_interface_control_1 , &H0000) ' RGB interface settings
    Call Ili9325_write_reg(frame_maker_position , &H0000) 'frame marker position
    Call Ili9325_write_reg(rgb_display_interface_control_2 , &H0000) 'RGB interface polarity
    Call Ili9325_write_reg(power_control_1 , &H0000) 'SAP, BT[3:0], AP, DSTB, SLP, STB
    Call Ili9325_write_reg(power_control_2 , &H0007) 'DC1[2:0], DC0[2:0], VC[2:0]
    Call Ili9325_write_reg(power_control_3 , &H0000) 'VREG1OUT voltage
    Call Ili9325_write_reg(power_control_4 , &H0000) 'VDV[4:0] for VCOM amplitude
    Call Ili9325_write_reg(display_control_1 , &H0001) 'discharge capacitor power voltage
    Waitms 50
    Call Ili9325_write_reg(power_control_1 , &H1090) '1490/SAP, BT[3:0], AP, DSTB, SLP, STB
    Call Ili9325_write_reg(power_control_2 , &H0227) 'DC1[2:0], DC0[2:0], VC[2:0]
    Waitms 50
    Call Ili9325_write_reg(power_control_3 , &H001F) 'internal reference voltage
    Waitms 50
    Call Ili9325_write_reg(power_control_4 , &H1500)
    Call Ili9325_write_reg(power_control_7 , &H0027)
    Call Ili9325_write_reg(frame_rate_and_color_control , &H000D)
    Waitms 50
    Call Ili9325_write_reg(horizontal_gram_address , &H0000)
    Call Ili9325_write_reg(vertical_gram_address , &H0000)
    Call Ili9325_write_reg(gamma_control_1 , &H0000)
    Call Ili9325_write_reg(gamma_control_2 , &H0707)
    Call Ili9325_write_reg(gamma_control_3 , &H0307)
    Call Ili9325_write_reg(gamma_control_4 , &H0200)
    Call Ili9325_write_reg(gamma_control_5 , &H0008)
    Call Ili9325_write_reg(gamma_control_6 , &H0004)
    Call Ili9325_write_reg(gamma_control_7 , &H0000)
    Call Ili9325_write_reg(gamma_control_8 , &H0707)
    Call Ili9325_write_reg(gamma_control_9 , &H0002)
    Call Ili9325_write_reg(gamma_control_10 , &H1D04)
    Call Ili9325_write_reg(horizontal_add_start_position , &H0000)
    Call Ili9325_write_reg(horizontal_add_end_position , &H00EF)
    Call Ili9325_write_reg(vertical_add_start_position , &H0000)
    Call Ili9325_write_reg(vertical_add_end_position , &H013F)
    Call Ili9325_write_reg(driver_output_control_2 , &B0010_0111_0000_0000)
    Call Ili9325_write_reg(base_image_display_control , &H0001)
    Call Ili9325_write_reg(vertical_scroll_control , &H0000)
    Call Ili9325_write_reg(partial_image_1_display_position , &H0000)
    Call Ili9325_write_reg(partial_image_1_area_start_line , &H0000)
    Call Ili9325_write_reg(partial_image_1_area_end_line , &H0000)
    Call Ili9325_write_reg(partial_image_2_display_position , &H0000)
    Call Ili9325_write_reg(partial_image_2_area_start_line , &H0000)
    Call Ili9325_write_reg(partial_image_2_area_end_line , &H0000)
    Call Ili9325_write_reg(panel_interface_control_1 , &H0013)
    Call Ili9325_write_reg(panel_interface_control_2 , &H0000)
    Call Ili9325_write_reg(panel_interface_control_3 , &H0003)
    Call Ili9325_write_reg(panel_interface_control_4 , &H0110)
    Call Ili9325_write_reg(panel_interface_control_5 , &H0000)
    Call Ili9325_write_reg(panel_interface_control_6 , &H0000)

    Call Ili9325_write_reg(display_control_1 , &B0000_0101_0011_0011)
    Cs_disp = 0
    Rs_disp = 0
    End Sub


    Declare sub ili9325_write_reg(byval Index as Byte, Byval Daten as Word)



    '-------------------------------------------------------------------------------
    ' Ili9325_write_reg Write 16 Bit Data to Index Register
    '-------------------------------------------------------------------------------
    Sub Ili9325_write_reg(byval Index As Byte , Daten As Word)
    Cs_disp = 0
    Rs_disp = 0
    Data_disp = &H0 'VH
    NOP : NOP
    Wr_disp = 0
    NOP : NOP
    Wr_disp = 1
    Data_disp = Index 'VL
    NOP : NOP
    Wr_disp = 0
    NOP : NOP
    Wr_disp = 1
    Rs_disp = 1
    Data_disp = High(daten) 'VH
    NOP : NOP
    Wr_disp = 0
    NOP : NOP
    Wr_disp = 1
    Data_disp = Low(daten) 'VL
    NOP : NOP
    Wr_disp = 0
    NOP : NOP
    Wr_disp = 1
    Cs_disp = 1
    End Sub


    Declare sub ili9325_write_data(byval Daten as Word)


    '-------------------------------------------------------------------------------
    ' Ili9320_write_data Write 16 Bit Data to Display
    '-------------------------------------------------------------------------------
    Sub Ili9325_write_data(byref Daten As Word)
    Cs_disp = 0
    Rs_disp = 1
    Data_disp = High(daten)
    NOP : NOP
    Wr_disp = 0
    NOP : NOP
    Wr_disp = 1
    Data_disp = Low(daten)
    NOP : NOP
    Wr_disp = 0
    NOP : NOP
    Wr_disp = 1
    Cs_disp = 1
    End Sub


    Declare sub ili9325_select_reg(byval Index as Byte)



    '-------------------------------------------------------------------------------
    ' ILI9320_select_reg Select an index register
    '-------------------------------------------------------------------------------
    Sub Ili9325_select_reg(byval Index As Byte )
    Cs_disp = 0
    Rs_disp = 0
    Data_disp = 0
    NOP : NOP
    Wr_disp = 0
    NOP : NOP
    Wr_disp = 1
    Data_disp = Index
    NOP : NOP
    Wr_disp = 0
    NOP : NOP
    Wr_disp = 1
    Cs_disp = 1
    End Sub


    Declare sub ili9325_exit_sleep()



    '-------------------------------------------------------------------------------
    'Ili9325_exit_sleep Exit Sleep Mode
    '-------------------------------------------------------------------------------
    Sub Ili9325_exit_sleep()
    'Power On sequence
    Call Ili9325_write_reg(power_control_1 , &H0000)
    Call Ili9325_write_reg(power_control_2 , &H0000)
    Call Ili9325_write_reg(power_control_3 , &H0000)
    Call Ili9325_write_reg(power_control_4 , &H0000)
    Waitms 200
    Call Ili9325_write_reg(power_control_1 , &H1590)
    Call Ili9325_write_reg(power_control_2 , &H0007)
    Waitms 50
    Call Ili9325_write_reg(power_control_3 , &H013A)
    Waitms 50
    Call Ili9325_write_reg(power_control_4 , &H1500)
    Call Ili9325_write_reg(power_control_7 , &H0000)
    Waitms 50
    Call Ili9325_write_reg(display_control_1 , &H0133)
    End Sub


    Declare sub ili9325_enter_sleep()


    '-------------------------------------------------------------------------------
    'Ili9320_enter_sleep Enter Sleep Mode
    '-------------------------------------------------------------------------------
    Sub Ili9325_enter_sleep()
    'Power Off sequence
    Call Ili9325_write_reg(display_control_1 , &H0000)
    Call Ili9325_write_reg(power_control_1 , &H0000)
    Call Ili9325_write_reg(power_control_2 , &H0000)
    Call Ili9325_write_reg(power_control_3 , &H0000)
    Call Ili9325_write_reg(power_control_4 , &H0000)
    Waitms 200
    Call Ili9325_write_reg(power_control_1 , &H0002)
    End Sub


    Declare sub ili9325_scroll(byval lines as word)



    '-------------------------------------------------------------------------------
    ' Ili9325_scroll
    '-------------------------------------------------------------------------------
    Sub Ili9325_scroll(byval Lines As Word )
    Call Ili9325_write_reg(base_image_display_control , &B0000_0000_0000_0011 )
    Call Ili9325_write_reg(vertical_scroll_control , Lines)
    End Sub


    Declare sub ili9325_set_window(byval xpos as word, byval ypos as word, byval xsize as word, byval ysize as word)


    '-------------------------------------------------------------------------------
    ' Ili9325_set_window Set Window Area to write
    '-------------------------------------------------------------------------------
    Sub Ili9325_set_window(byval Xpos As Word , Byval Ypos As Word , Byval Xsize As Word , Byval Ysize As Word)
    Local X_add As Word , Y_add As Word

    Y_add = Y_pixel - Ypos
    Ypos = Y_add - Ysize

    X_add = X_pixel - Xpos
    Xpos = X_add - Xsize

    Incr Xpos
    Incr Ypos

    Call Ili9325_write_reg(horizontal_add_start_position , Xpos)
    ' Horizontal GRAM Start Address-----HSA[7:0]
    Call Ili9325_write_reg(horizontal_add_end_position , X_add)
    ' Horizontal GRAM End Address-----HEA[7:0]
    Call Ili9325_write_reg(vertical_add_start_position , Ypos)
    'Vertical GRAM Start Address-----VSA[8:0]
    Call Ili9325_write_reg(vertical_add_end_position , Y_add)
    'Vertical GRAM Start Address-----VEA[8:0]

    Call Ili9325_write_reg(horizontal_gram_address , X_add)
    Call Ili9325_write_reg(vertical_gram_address , Ypos)
    Call Ili9325_select_reg(write_data_to_gram)
    End Sub


    Declare sub ili9325_negate(byval art as word)



    '-------------------------------------------------------------------------------
    ' Ili9325_negate art=0 -> negative art=1 -> normal
    '-------------------------------------------------------------------------------
    Sub Ili9325_negate(byval Art As Word )
    If Art = 1 Then
    Art = 1
    Else
    Art = 0
    End If
    Call Ili9325_write_reg(base_image_display_control , Art )
    End Sub


    Declare sub ili9325_set_pixel(byval x1 as word, y1 as word, byval color as word)



    '-------------------------------------------------------------------------------
    ' ILI9325_set_pixel Set one Pixel in given color
    '-------------------------------------------------------------------------------
    Sub Ili9325_set_pixel(byval X1 As Word , Y1 As Word , Color As Word)
    Call Ili9325_set_cursor(x1 , Y1)
    Call Ili9325_write_reg(write_data_to_gram , Color)
    End Sub


    Declare sub ili9325_set_cursor(byval x as word, byval y as word)


    '-------------------------------------------------------------------------------
    ' ILI9325_Set_Cursor(X, Y) 1-240; 1-320
    '-------------------------------------------------------------------------------
    Sub Ili9325_set_cursor(byval X As Word , Y As Word )
    If Display_modus = 1 Then
    Swap X , Y
    X = X_pixel - X
    End If
    If Display_modus = 2 Then
    X = X_pixel - X
    Y = Y_pixel - Y
    End If
    Call Ili9325_write_reg(horizontal_gram_address , X)
    Call Ili9325_write_reg(vertical_gram_address , Y)
    End Sub


    Declare sub ili9325_text(byval lcd_text as string, byval lcd_posx as word, byval lcd_posy as word, byval fontset as byte, byval forecolor as word, byval backcolor as word)


    '-------------------------------------------------------------------------------
    ' Ili9325_text
    '-------------------------------------------------------------------------------
    Sub Ili9325_text(byval Lcd_text As String , Byval Lcd_posx As Word , Byval Lcd_posy As Word , Byval Fontset As Byte , Byval Forecolor As Word , Byval Backcolor As Word)

    Local Pzeichen As String * 1
    Dim Zeichenarray(40) As Byte
    Local Zeichen_row As Word
    Local Ptemp As Word
    Local Ptemp2 As Word
    Local Px As Word
    Local Py As Word
    Local Char_rows As Byte
    Local Char_row_len As Byte
    Local Char_bytes As Byte
    Local Dummy As Byte
    Local String_pos As Byte
    Local Zeichen_code As Word

    For String_pos = 1 To Len(lcd_text) 'F\FCr jedes Zeichen im String
    If Fontset = 2 Then
    Restore Font12x16
    Else
    Restore Font8x8
    End If
    Read Char_rows : Read Char_row_len : Read Char_bytes : Read Dummy 'Read the first 4 bytes from the font file

    Pzeichen = Mid(lcd_text , String_pos , 1) 'Ein Zeichen aus String holen
    Zeichen_code = Asc(pzeichen) - 32 'Font files start with caracter 32
    ' move Pointer to char
    Zeichen_code = Zeichen_code * Char_bytes
    For Px = 1 To Zeichen_code 'Do dummie read to point to the correct line in the fontfile
    Read Dummy
    Next Px
    'Read Char Byte Array
    For Px = 1 To Char_bytes 'Do dummie read to point to the correct line in the fontfile
    Read Zeichenarray(px)
    Next Px
    'set canvas area
    Py = Char_rows * 8
    Incr Py
    Px = String_pos - 1
    Px = Px * Char_row_len
    Px = Px + Lcd_posx
    Ptemp = Char_row_len
    Call Ili9325_set_window(px , Lcd_posy , Ptemp , Py)
    Cs_disp = 0
    'Write Data
    Rs_disp = 1
    For Py = Char_rows To 1 Step -1
    Ptemp = Py - 1
    Ptemp = Ptemp * Char_row_len
    For Zeichen_row = 7 To 0 Step -1
    ' For Px = Char_row_len To 1 Step - 1
    For Px = 1 To Char_row_len
    Ptemp2 = Ptemp + Px
    If Zeichenarray(ptemp2).zeichen_row = 1 Then
    Data_disp = High(forecolor)
    NOP
    Wr_disp = 0
    NOP
    Wr_disp = 1
    Data_disp = Low(forecolor)
    NOP
    Wr_disp = 0
    NOP
    Wr_disp = 1
    Else
    Data_disp = High(backcolor)
    NOP
    Wr_disp = 0
    NOP
    Wr_disp = 1
    Data_disp = Low(backcolor)
    NOP
    Wr_disp = 0
    NOP
    Wr_disp = 1
    End If
    Next Px
    Next Zeichen_row
    Next Py
    'Topline in Backcolor
    For Px = 1 To Char_row_len
    Call Ili9325_write_data(backcolor)
    Next
    Next String_pos
    Set Cs_disp
    End Sub
    Declare sub ili9325_line(byval X1 as word, byval Y1 as word, byval X2 as word, byval y2 as word, byval pen_width as byte, byval color as word)


    '-------------------------------------------------------------------------------
    ' ILI9325_line pixel line left-top (x1,y1) right-bottom(x2,y2),
    ' Pen Width in Pixel(byte), color($0000-$FFFF)
    '-------------------------------------------------------------------------------
    Sub Ili9325_line(byval X1 As Word , Byval Y1 As Word , Byval X2 As Word , Byval Y2 As Word , Byval Pen_width As Byte , Byval Color As Word)
    Local Y As Word , X As Word , X_diff As Single , Y_diff As Single , Pos As Word
    Local X_factor As Single , X_pos As Word , Y_pos As Word , Base As Word , Pen_count As Byte

    If X1 > X_pixel Then X1 = X_pixel
    If X2 > X_pixel Then X2 = X_pixel
    If Y1 > Y_pixel Then Y1 = Y_pixel
    If Y2 > Y_pixel Then Y2 = Y_pixel
    Y_diff = Y2 - Y1
    X_diff = X2 - X1
    Pos = 0

    X_factor = Abs(y_diff)
    Y = X_factor
    X_factor = Abs(x_diff)
    X = X_factor

    If Y > X Then
    X_factor = X_diff / Y_diff
    If Y1 > Y2 Then
    Swap Y1 , Y2
    Base = X2
    Else
    Base = X1
    End If
    For Y = Y1 To Y2
    X_diff = Pos * X_factor
    X_pos = X_diff
    X_pos = X_pos + Base
    Call Ili9325_set_pixel(x_pos , Y , Color)
    For Pen_count = 2 To Pen_width
    Call Ili9325_write_data(color)
    Next Pen_count
    Incr Pos
    Next Y
    Else
    X_factor = Y_diff / X_diff
    If X1 > X2 Then
    Swap X1 , X2
    Base = Y2
    Else
    Base = Y1
    End If
    For X = X1 To X2
    Y_diff = Pos * X_factor
    Y_pos = Y_diff
    Y_pos = Y_pos + Base
    Call Ili9325_set_pixel(x , Y_pos , Color)
    For Pen_count = 2 To Pen_width
    Call Ili9325_write_data(color)
    Next Pen_count
    Incr Pos
    Next X
    End If
    End Sub


    Declare sub ili9325_box(byval X1 as word, byval Y1 as word, byval X2 as word, byval Y2 as word, byval Fill-color as word, byval border_color as word, byval fill as byte, byval showborder as byte)


    '-------------------------------------------------------------------------------
    ' ILI9325_box left-top (x1,y1) right-bottom(x2,y2)
    ' Fill_color, Border_color $0000-$ffff
    ' fill > 0 , Show_border > 0
    '-------------------------------------------------------------------------------
    Sub Ili9325_box(byval X1 As Word , Byval Y1 As Word , Byval X2 As Word , Byval Y2 As Word , Byval Fill_color As Word , Byval Border_color As Word , Byval Fill As Byte , Byval Show_border As Byte)
    Local X_counter As Word , Y_counter As Word , X_pos1 As Word , X_pos2 As Word
    If X1 > X2 Then Swap X1 , X2
    If Y1 > Y2 Then Swap Y1 , Y2
    If Show_border > 0 Then
    Call Ili9325_line(x1 , Y1 , X2 , Y1 , 1 , Border_color)
    Call Ili9325_line(x1 , Y2 , X2 , Y2 , 1 , Border_color)
    Incr Y1
    Decr Y2
    Else
    X_pos1 = X1
    X_pos2 = X2 - 1
    End If
    For Y_counter = Y1 To Y2
    If Show_border > 0 Then
    Call Ili9325_set_cursor(x1 , Y_counter)
    Call Ili9325_write_reg(write_data_to_gram , Border_color)
    End If
    If Fill > 0 Then
    If Show_border > 0 Then
    X_pos1 = X1 + 2
    X_pos2 = X2 - 1
    Call Ili9325_write_reg(write_data_to_gram , Fill_color)
    Else
    Call Ili9325_set_cursor(x1 , Y_counter)
    Call Ili9325_write_reg(write_data_to_gram , Fill_color)
    End If
    For X_counter = X_pos1 To X_pos2
    Call Ili9325_write_data(fill_color)
    Next X_counter
    If Show_border > 0 Then
    Call Ili9325_write_reg(write_data_to_gram , Border_color)
    End If
    Else
    If Show_border > 0 Then
    Call Ili9325_set_cursor(x2 , Y_counter)
    Call Ili9325_write_reg(write_data_to_gram , Border_color)
    End If
    End If
    Next Line_counter
    End Sub


    Declare sub ili9325_lineto(byval x as word, byval y as word, byval pen_width as byte, byval color as byte)



    '-------------------------------------------------------------------------------
    ' ILI9325_Lineto x,y screen pos, pen width, color border
    '-------------------------------------------------------------------------------
    Sub Ili9325_lineto(byval X As Word , Byval Y As Word , Byval Pen_width As Byte , Byval Color As Word)
    Call Ili9325_line(move_x , Move_y , X , Y , Pen_width , Color )
    Move_x = X
    Move_y = Y
    End Sub


    Declare sub ili9325_moveto(byval x as word, y as word)


    '-------------------------------------------------------------------------------
    ' ILI9325_Moveto x,y screen pos
    '-------------------------------------------------------------------------------
    Sub Ili9325_moveto(byval X As Word , Byval Y As Word)
    Call Ili9325_set_cursor(x , Y)
    Move_x = X
    Move_y = Y
    End Sub


    Declare sub ili9325_drawcircle(byval centerx as word, byval centery as word, byval radius as word, byval sides as word, byval pen_width as byte, byval color as word)


    '-------------------------------------------------------------------------------
    ' ILI9325_circle centerX, centerY, radius, sides, pen width, color Border
    '-------------------------------------------------------------------------------

    'deze routine nog in orde maken

    Sub Ili9325_drawcircle(byval Centerx As Word , Byval Centery As Word , Byval Radius As Word , Byval Sides As Word , Byval Pen_width As Byte , Byval Color As Word)
    Local I As Word
    Local Pointratio As Single
    Local Xsteps As Single , Ysteps As Single
    Local Pointx As Single , Pointy As Single
    Local X As Word , Y As Word

    I = Centerx + Radius

    Call Ili9325_moveto(i , Centery)
    Out_of_range = 0

    For I = 0 To Sides
    Pointratio = I / Sides
    Xsteps = Ili9325_trigfunctionx(pointratio)
    Ysteps = Ili9325_trigfunctiony(pointratio)
    Pointx = Xsteps * Radius
    Pointx = Centerx + Pointx
    X = Pointx
    Pointy = Ysteps * Radius
    Pointy = Centery + Pointy
    Y = Pointy

    If X < X_pixel And Y < Y_pixel Then
    If Out_of_range = 1 Then
    Call Ili9325_moveto(x , Y)
    Out_of_range = 0
    End If
    Call Ili9325_lineto(x , Y , Pen_width , Color)
    Else
    Out_of_range = 1
    End If
    Next
    End Sub

    Declare sub ili9325_drawarc(byval centerx as word, byval centery as word, byval radius as word, byval startangle as word, byval arcangle as word, byval steps as word, byval pen_width as byte, byval color as word)


    '-------------------------------------------------------------------------------
    ' Ili9325_drawarc centerX, centerY, radius, sides, pen width, color Border
    '-------------------------------------------------------------------------------
    '
    Sub Ili9325_drawarc(byval Centerx As Word , Byval Centery As Word , Byval Radius As Word , Byval Startangle As Word , Byval Arcangle As Word , Byval Steps As Word , Byval Pen_width As Byte , Byval Color As Word)
    Local Twopi As Single , I As Word
    Local Anglestep As Single , Tmp_single As Single
    Local X As Word , Y As Word
    Local Xx As Single , Yy As Single , Startangle_temp As Single , Arcangle_temp As Single , Angle As Single

    Startangle_temp = Startangle / 360
    'disabling following line gives great effects!
    Arcangle_temp = Arcangle / 360

    Twopi = 2 * Pi
    Anglestep = Arcangle_temp / Steps

    Tmp_single = Startangle_temp * Twopi
    Xx = Cos(tmp_single)
    Xx = Xx * Radius
    Xx = Xx + Centerx
    X = Xx

    Yy = Sin(tmp_single)
    Yy = Yy * Radius
    Yy = Yy + Centery
    Y = Yy

    Call Ili9325_moveto(x , Y)
    Out_of_range = 0

    For I = 1 To Steps
    Angle = I * Anglestep
    Angle = Angle + Startangle_temp
    Tmp_single = Angle * Twopi
    Xx = Cos(tmp_single)
    Xx = Xx * Radius
    Xx = Xx + Centerx
    X = Xx
    Yy = Sin(tmp_single)
    Yy = Yy * Radius
    Yy = Yy + Centery
    Y = Yy
    If X < X_pixel And Y < Y_pixel Then
    If Out_of_range = 1 Then
    Call Ili9325_moveto(x , Y)
    Out_of_range = 0
    End If
    Call Ili9325_lineto(x , Y , Pen_width , Color)
    Else
    Out_of_range = 1
    End If
    Next
    End Sub


    Declare sub ili9325_drawrect(byval x1 as word, byval y1 as word, byval x2 as word, byval y2 as word, byval pen_width as byte, byval color as word)


    '-------------------------------------------------------------------------------
    ' Ili9325_drawrect X, Y, Xx, Yy, pen width, color Border
    '-------------------------------------------------------------------------------
    '
    Sub Ili9325_drawrect(byval X1 As Word , Byval Y1 As Word , Byval X2 As Word , Byval Y2 As Word , Byval Pen_width As Byte , Byval Color As Word)

    If X1 > X2 Then
    Swap X1 , X2
    End If
    If Y1 > Y2 Then
    Swap Y1 , Y2
    End If

    Call Ili9325_line(x1 , Y1 , X2 , Y1 , Pen_width , Color) '------
    Call Ili9325_line(x2 , Y1 , X2 , Y2 , Pen_width , Color) ' !
    Call Ili9325_line(x1 , Y2 , X2 , Y2 , Pen_width , Color) '------
    Call Ili9325_line(x1 , Y1 , X1 , Y2 , Pen_width , Color) '!
    End Sub

    Declare sub ili9325_showpicture(byval xoffset as word, byval yoffset as word) ‘Draw an Bascom BGC image on the lcd


    '-------------------------------------------------------------------------------
    ' Ili9325_showpicture Xoffset, Yoffset
    '-------------------------------------------------------------------------------
    '
    ' Important that you first RESTORE the image before calling this sub. Examp: [ Restore Plaatje ]
    '
    Sub Ili9325_showpicture(byval Xoffset As Word , Byval Yoffset As Word) 'Draw an Bascom BGC image on the lcd
    Local Ysize As Byte , Xsize As Byte
    Local Imagesize As Word
    Local L As Word , Pixel As Byte ,
    Local Pixelword As Word , Prevpixel As Word , Repeat As Byte
    Local X1size As Word , Y1size As Word
    Call Ili9325_write_reg(entry_mode , &B0001000000_00_0_000 ) 'onderkant foto onder, kopje naar links

    Read Ysize 'Read the first 4 bytes from the BGC, this contains info about the image
    Read Xsize
    Read Imagesize 'Byte 3&4 contains the image size

    X1size = Xsize
    Y1size = Ysize

    Call Ili9325_set_window(xoffset , Yoffset , X1size , Y1size)

    Do
    Read Pixel 'Read the value for the pixel
    If Pixel = &HAA Then 'BGC file is rle coded &HAA represents this, the byte after &HAA is the number of times that the byte before &HAA wil be repeated
    Read Repeat 'Byte after &HAA contains the number of times to repeat
    Repeat = Repeat - 1
    For L = 1 To Repeat 'Loop the repeat
    Call Ili9325_write_data(prevpixel) 'Write the pixel data to the display
    Decr Imagesize 'Decrease the bytes still to be processed
    Next L 'Next repeat loop
    Else 'It's a regular byte, not LRE encoded
    Pixelword = Ili9325_rgb16(pixel) 'Convert the 8bit pixel to 16bit pixel
    Call Ili9325_write_data(pixelword) 'Write the pixel data to the display
    Prevpixel = Pixelword 'Store the pixel in a temp word, maybe we need it if the next byte is &HAA
    Decr Imagesize 'Decrease the bytes still to be processed
    End If
    Loop Until Imagesize = 0 'Do until all bytes are processed

    Modus = 2
    '4096 &B0001000000000000 ' I/D[1:0] AM richting schrijven...
    If Modus = 2 Then
    Direction = 2
    Direction = Direction Or &B0001000000_10_0_000 '4096 &B0001000000000000 ' I/D[1:0] AM richting schrijven...
    Call Ili9325_write_reg(entry_mode , Direction)
    X_pixel = 240
    Y_pixel = 320
    End If
    Call Ili9325_set_window(1 , 1 , 240 , 320)
    End Sub


    Declare sub ili9325_clear(byval color as word, byval direction as word)


    '-------------------------------------------------------------------------------
    ' ILI9325_Clear Clear LCD with color
    '-------------------------------------------------------------------------------
    Sub Ili9325_clear(byval Color As Word , Byval Direction As Word) 'direction = 0,1,2,3
    Local Ili9325_count_color As Long
    Local Flag As Byte
    Local Zz As Word
    If Direction = 2 Then Flag = 1
    Select Case Direction
    Case 0 : Direction = Direction Or &B0001000000_01_0_000
    Case 1 : Direction = Direction Or &B0001000000_10_0_000
    Case 2 : Direction = Direction Or &B0001000000_01_1_000
    Case 3 : Direction = Direction Or &B0001000000_10_1_000
    End Select
    Call Ili9325_write_reg(entry_mode , Direction)
    Call Ili9325_set_window(1 , 1 , X_pixel , Y_pixel)
    Cs_disp = 0
    Rs_disp = 1
    For Ili9325_count_color = 1 To 76800
    Data_disp = High(color)
    NOP
    !cbi portg,_Wr_disp '= 0
    NOP
    !sbi portg,_Wr_disp '= 1
    Data_disp = Low(color)
    NOP
    !cbi portg,_Wr_disp ' = 0
    NOP
    !sbi portg,_Wr_disp '= 1
    Next
    Cs_disp = 1
    Modus = 2
    '4096 &B0001000000000000 ' I/D[1:0] AM richting schrijven...
    Direction = 2
    Direction = Direction And 3
    Shift Direction , Left , 4
    Direction = Direction Or &B0001000000_00_0_000 '4096 &B0001000000000000 ' I/D[1:0] AM richting schrijven...
    Call Ili9325_write_reg(entry_mode , Direction)
    X_pixel = 240
    Y_pixel = 320
    End Sub


    Declare sub ili9325_draw_bmp(byval filename as string, byval xpos as word, byval ypos as word)


    '-------------------------------------------------------------------------------
    ' Ili9320_draw_bmp
    '-------------------------------------------------------------------------------
    '
    Sub Ili9325_draw_bmp(byval Filename As String , Byval Xpos As Word , Byval Ypos As Word)
    Dim Rgb_data(1500) As Byte
    Dim Palette(1024) As Byte At Rgb_data(400) Overlay
    Dim Rgb(3) As Byte
    Local X As Word
    'Dim Line_len As Word
    'Dim Line_byte As Word
    Local Y As Single , Z As Word , Line_count As Word
    'Dim Bmp_read_pos As Long

    ' Bitmap Info Header
    Local Bftype As Word
    Local Bfsize As Long
    Local Bfoffbits As Long
    Local Bisize As Long
    Local Biplanes As Word
    Local Bibitcount As Word
    Local Bicompression As Long
    Local Bisizeimage As Long
    Local Bixpelspermeter As Long
    Local Biypelspermeter As Long
    Local Biclrused As Long
    Local Biclrimportant As Long




    Für einen Arduino wirds da sicher schon eine Library geben , so das man mit der Hälfte auskommt an Befehlen.
    Aber , das ist nicht mein Ding mich da durch etliche Befehle kämpfen um einen Kreis oder Quadrat hinzu bekommen .

  • AVR für EinsteigerDatum20.05.2023 14:31
    Foren-Beitrag von BoomBoomMagic im Thema AVR für Einsteiger

    Ach , ich sach's Dir ....

    sind zwar "nur" sogen. AT-Befehle .... aber erst mal Wissen wie

    sitze da schon ne Woche dran , an verschiedenen Beispielen.

    Initialisieren geht ja , aber dann Pairen will noch net so richtig.

    Was hast denn für Sorgen mit dem Atmel ?
    Muss ja auch mal was anderes im Kopf haben ...

    Wenn's andere können , muss ich das auch hinbekommen ;-)

  • AVR für EinsteigerDatum20.05.2023 10:31
    Foren-Beitrag von BoomBoomMagic im Thema AVR für Einsteiger

    Na das is ja das wichtigste.
    Somit kannst immer Dir alles per LED oder sogar auf LCD anzeigen lassen.
    Als LCD sind tauglich : 8x1 / 8x2 / 16x1 / 16x2 /16x3 /16x4 / 16x4 / 20x2 / 20x4 / 40x2

    Grafik LCD' s würde ich ausschliesslich nur über seriellen Adapter nehmen. (wie vorgeschlagen von Digole)

    Ich kämpfe derzeit mit HC05 und Nextion und ELM327.
    HC05 erfolgreich aktiviert und ELM327 laufen ... müssen nur noch kommunizieren

    Einen PCF8575 hatte ich auch noch bestellt , .... aber der will noch so garnicht wie ich es will :-(
    Es hapert schon am Erkennen der Adresse ... naja, und auch wohl am Code.
    Vll. nehm ich dann doch wieder 2 Stk PCF8574 ?

Inhalte des Mitglieds BoomBoomMagic
Beiträge: 879
Ort: Bielefeld
Geschlecht: männlich
Picaxe Editor 5.5.5 Download
Update auf Picaxe Editor 5.5.6 Download
Picaxe Editor 6.x.x.x Download
Manual1.pdf        -      Grundwissen Download
Manual2.pdf        -      Befehle Download
Manual3.pdf        -      Beispiele Download


Press [Backspace] for back to Menu


Counter
Xobor Forum Software ©Xobor.de | Forum erstellen
Datenschutz