Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20606

BASCOM-AVR : error 130, incorrect number of parameters must by[5] watch w : NEWTOPIC

$
0
0
I Am busy to make a RTC clock and a T6963c with big numbers to display the time inverted everything is looking good but one error is there this is my code watch wrong..... :roll: '------------------------------------------------------------ ' CLOCK RTClock.BAS '------------------------------------------------------------- $regfile = "M32def.dat" $hwstack = 80 $swstack = 64 $framesize = 64 Mcusr = &H80 Mcusr = &H80 Wait 1 Enable Interrupts $lib "eurotimedate.lbx" Dim Seconde As Integer Dim Dag(7) As String * 9 , Maand(12) As String * 10 , Flagj As Bit Dim D_g As String * 9 , Mnd As String * 10 , Indexdag As Byte , Indexmaand As Byte Dim J As Byte Config Pinc.0 = Input Config Pinc.1 = Input Config Graphlcd = 240 * 128 , Dataport = Portd , Controlport = Portb , Ce = 2 , Cd = 3 , Wr = 0 , Rd = 1 , Reset = 4 , Fs = 8 , Mode = 6 Config Date = Dmy , Separator = - ' ANSI-Format Config Clock = Soft ' , Gosub = Sectic (non use here) Declare Sub Lcdtext(byval S As String , Byval Xoffset As Byte , Byval Yoffset As Byte , Byval Inverse As Byte , Byval Rotation As Byte) Declare Sub Set_font(byval Fontset As Byte) Glcd_font Alias 2 Font8x8_font Alias 6 Inverted Alias 1 No_inverted Alias 0 Rotate_0 Alias 0 Rotate_90 Alias 1 Rotate_180 Alias 2 Rotate_270 Alias 3 '=== Variables declarations Dim Row As Byte , Colums As Byte , Byteseach As Byte , Blocksize As Byte Dim Font_adress As Word '---------------the main-------------------------------------------------- 'initialising Indexdag = 1 Indexmaand = 1 Seconde = _sec Cls Gosub Table Cursor On , Blink Gosub Setup Cls Cursor Off Locate 1 , 18 Lcd "Real Time Clock" Wait 2 Do If Pinc.0 = 0 Or Pinc.1 = 0 Then Cursor Off , Blink Off Gosub Setup Cls End If Gosub Disply Gosub Setup_data Loop '----gosub --------------------------------------- Sub Set_font(byval Fontset As Byte) Local Dummy_word As Word Select Case Fontset Case Glcd_font : Font_adress = Loadlabel(glcd) Case Font8x8_font : Font_adress = Loadlabel(font8x8) End Select ' --- Load font info needed for Lcdtext subroutine calculations --- Dummy_word = Font_adress : Row = Cpeek(dummy_word) Incr Dummy_word : Byteseach = Cpeek(dummy_word) Incr Dummy_word : Blocksize = Cpeek(dummy_word) ' ----- Colums = Blocksize / Row Row = Row * 8 Row = Row - 1 Colums = Colums - 1 Font_adress = Font_adress + 4 End Sub Sub Lcdtext(byval S As String , Xoffset As Byte , Yoffset As Byte , Inverse As Byte , Rotation As Byte) Local Tempstring As String * 1 , Temp As Byte 'Dim local the variables Local A As Byte , Pixels As Byte , Pixels_adress As Word , Carcount As Byte Local Columcount As Byte , Rowcount As Byte , Stringsize As Byte Local Xpos As Byte , Ypos As Byte , Pixel As Byte , Pixelcount As Byte Local Dummy_word As Word If Inverse > 1 Then Inverse = 0 If Rotation > 3 Then Rotation = 0 Stringsize = Len(s) - 1 For Carcount = 0 To Stringsize Temp = Carcount + 1 Tempstring = Mid(s , Temp , 1) Temp = Asc(tempstring) - 32 Dummy_word = Blocksize * Temp Pixels_adress = Font_adress + Dummy_word Temp = Carcount * Byteseach Select Case Rotation Case 0 '0 degrees rotation Temp = Temp + Xoffset For Rowcount = 0 To Row Step 8 'Loop for numbers of Row A = Rowcount + Yoffset For Columcount = 0 To Colums 'Loop for numbers of Colums Pixels = Cpeek(pixels_adress) Incr Pixels_adress If Inverse = 1 Then Toggle Pixels 'Read the byte from the file and if inverse = true then invert de byte Xpos = Columcount Xpos = Xpos + Temp 'Do rest of calculation to get the character on the correct X position For Pixelcount = 0 To 7 'Loop for 8 pixels to be set or not Ypos = A + Pixelcount 'Each pixel on his own spot Pixel = Pixels.pixelcount 'Set the pixel (or not) Pset Xpos , Ypos , Pixel 'Finaly we can set the pixel Next Pixel Next Columcount Next Rowcount Case 1 For Rowcount = Row To 0 Step -8 A = Rowcount + Xoffset A = A - 15 For Columcount = 0 To Colums Pixels = Cpeek(pixels_adress) Incr Pixels_adress If Inverse = 1 Then Toggle Pixels Xpos = Columcount Xpos = Xpos + Yoffset Xpos = Xpos + Temp For Pixelcount = 7 To 0 Step -1 Ypos = A + Pixelcount Pixel = Pixels.0 Pset Ypos , Xpos , Pixel Shift Pixels , Right Next Pixel Next Columcount Next Rowcount Case 2 For Rowcount = Row To 0 Step -8 A = Rowcount + Yoffset A = A - 7 For Columcount = Colums To 0 Step -1 Pixels = Cpeek(pixels_adress) Incr Pixels_adress If Inverse = 1 Then Toggle Pixels Xpos = Columcount Xpos = Xpos - Temp Xpos = Xpos - 8 Xpos = Xpos + Xoffset For Pixelcount = 7 To 0 Step -1 Ypos = A + Pixelcount Pixel = Pixels.0 Pset Xpos , Ypos , Pixel Shift Pixels , Right Next Pixel Next Columcount Next Rowcount Case 3 For Rowcount = 0 To Row Step 8 A = Rowcount + Xoffset For Columcount = Colums To 0 Step -1 Pixels = Cpeek(pixels_adress) Incr Pixels_adress If Inverse = 1 Then Toggle Pixels Xpos = Columcount Xpos = Xpos - Temp Xpos = Xpos - 8 Xpos = Xpos + Yoffset For Pixelcount = 0 To 7 Ypos = A + Pixelcount Pixel = Pixels.pixelcount Pset Ypos , Xpos , Pixel Next Pixel Next Columcount Next Rowcount End Select Next Carcount End Sub 'End of this amazing subroutine '=== Includes === $include "Glcd.font" $include "Font8x8.font" '----setup---------------------------------------- Setup_data: If _hour = 0 And Flagj = 1 Then Indexdag = Indexdag + 1 If Indexdag = 8 Then Indexdag = 1 End If D_g = Dag(indexdag) If _day = 1 And Indexmaand = 1 Then Mnd = Maand(2) Indexmaand = 2 Elseif _day = 29 And Indexmaand = 2 Then _day = 1 Mnd = Maand(3) Indexmaand = 3 Elseif _day = 1 And Indexmaand = 3 Then Mnd = Maand(4) Indexmaand = 4 Elseif _day = 1 And Indexmaand = 5 Then Mnd = Maand(6) Indexmaand = 6 Elseif _day = 1 And Indexmaand = 7 Then Mnd = Maand(8) Indexmaand = 8 Elseif _day = 1 And Indexmaand = 8 Then Mnd = Maand(9) Indexmaand = 9 Elseif _day = 1 And Indexmaand = 10 Then Mnd = Maand(11) Indexmaand = 11 Elseif _day = 1 And Indexmaand = 12 Then Mnd = Maand(1) Indexmaand = 1 Elseif _day = 31 And Indexmaand = 4 Then _day = 1 Mnd = Maand(5) Indexmaand = 5 Elseif _day = 31 And Indexmaand = 6 Then _day = 1 Mnd = Maand(7) Indexmaand = 7 Elseif _day = 31 And Indexmaand = 9 Then _day = 1 Mnd = Maand(10) Indexmaand = 10 Elseif _day = 31 And Indexmaand = 11 Then _day = 1 Mnd = Maand(12) Indexmaand = 12 End If End If Flagj = 0 D_g = Dag(indexdag) Mnd = Maand(indexmaand) D_g = Rtrim(d_g) D_g = D_g + " " Mnd = " " + Mnd Mnd = Rtrim(mnd) Flagj = 0 Return '--------------------------------------------------------------- Setup: Opnieuw: ' Day------------------------ Locate 1 , 29 : Lcd " " Locate 1 , 29 : Lcd " SETUP " Waitms 400 Do Locate 3 , 30 : Lcd Dag(indexdag) If Pinc.0 = 0 Then Indexdag = Indexdag + 1 Waitms 200 End If If Indexdag = 8 Then Indexdag = 1 Locate 3 , 30 : Lcd Dag(indexdag) End If Loop Until Pinc.1 = 0 D_g = Dag(indexdag) Waitms 300 Cls '- Month------------------------ Locate 2 , 30 : Lcd "Maand " Do Locate 4 , 30 : Lcd Maand(indexmaand) If Pinc.0 = 0 Then Indexmaand = Indexmaand + 1 Waitms 200 End If If Indexmaand = 13 Then Indexmaand = 1 Locate 4 , 30 : Lcd Maand(indexmaand) End If Loop Until Pinc.1 = 0 Mnd = Maand(indexmaand) Waitms 300 Cls '-Day of month-------------------- J = 1 Locate 2 , 30 : Lcd "Dag " Do Locate 4 , 30 : Lcd J If Pinc.0 = 0 Then J = J + 1 Waitms 200 End If If J = 32 Then Locate 4 , 30 : Lcd " " J = 1 End If Loop Until Pinc.1 = 0 _day = J Waitms 300 Cls '- Hours--------------------------- J = 0 Locate 2 , 30 : Lcd "uren " Do Locate 4 , 30 : Lcd J If Pinc.0 = 0 Then J = J + 1 Waitms 200 End If If J = 24 Then Locate 4 , 30 : Lcd " " J = 0 End If Loop Until Pinc.1 = 0 _hour = J Waitms 300 Cls '- Minutes------------------------- J = 0 Locate 2 , 30 : Lcd "Minuten" Do Locate 4 , 30 : Lcd J If Pinc.0 = 0 Then J = J + 1 Waitms 200 End If If J = 60 Then Locate 4 , 30 : Lcd " " J = 0 End If Loop Until Pinc.1 = 0 _min = J Waitms 500 Cls '- Seconde------------------------- J = 0 Locate 2 , 30 : Lcd "Seconde" Do Locate 4 , 30 : Lcd J If Pinc.0 = 0 Then J = J + 1 Waitms 200 End If If J = 60 Then Locate 4 , 30 : Lcd " " J = 0 End If Loop Until Pinc.1 = 0 _sec = J Waitms 500 ' Ok----------------------------- Do Locate 12 , 30 : Lcd "Goed=R" Locate 13 , 30 : Lcd "Fout=L" If Pinc.0 = 0 Then Cls Goto Opnieuw Waitms 200 End If Waitms 200 Loop Until Pinc.1 = 0 Cursor Off , Noblink Cls Return '----------------------------------------------- Table: Dag(1) = "MAANDAG " Dag(2) = "DINSDAG " Dag(3) = "WOENSDAG " Dag(4) = "DONDERDAG" Dag(5) = "FRIJDAG " Dag(6) = "ZATERDAG " Dag(7) = "ZONDAG " '----------------------- Maand(1) = "JANUARI " Maand(2) = "FEBRUARI " Maand(3) = "MAART " Maand(4) = "APRIL " Maand(5) = "MEI " Maand(6) = "JUNI " Maand(7) = "JULI " Maand(8) = "AUGUSTUS " Maand(9) = "SEPTEMBER" Maand(10) = "OKTOBER " Maand(11) = "NOVEMBER" Maand(12) = "DECEMBER" Return '------------------------------------------- Disply: Set_font Glcd_font Lcdtext , 64 , 20 , Inverted , Rotate_0 Locate 2 , 2 Lcd " " ; D_g ; "" ; _day ; "" ; Mnd 'Locate 3 , 2 ' Lcd " " ; _hour ; ":" ; _min ; ":" ; _sec Return [b:a5aa89929e][color=red:a5aa89929e](BASCOM-AVR version : 2.0.7.6 )[/b:a5aa89929e][/color:a5aa89929e]

Viewing all articles
Browse latest Browse all 20606

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>