Hello Mark
Yes I am trying to use Settcp but it was not working but after moving the line up in the code it works but why and it still means I can not get settings from SD card.
In the code below you can see where it works and then does not after reading the SD card. The code is Ben's web-server example so I have just posted the section I am working on/changed.
Regards Paul
[code:1:28001a06e4]
'*******************************************************************************
'Init Wiz
Waitms 100
Enable Interrupts
Config Tcpip = Noint , _
Mac = 12.128.12.33.46.74 , _
Ip = 192.168.0.222 , _
Submask = 255.255.254.0 , _
Gateway = 192.168.0.250 , _
Localport = 1000 , _
Tx = $55 , Rx = $55 , _
Chip = W5100 , _
Spi = 1 , _
Cs = Portb.4
Print "done init Wiz"
'*******************************************************************************
'Init SD Card
'WORKS HERE!!!!!!!!!!!!!
Settcp 12.128.12.33.46.74 , 192.168.0.221 , 255.255.255.0 , 192.168.0.254
Call Activate_sdcard()
Call Init_sd_card() 'Init SD Card
'Ok we want to check if the file contains the written lines
Ff = Freefile() ' get file handle
Open "settings.txt" For Input As #ff ' we can use a constant for the file too
'Print Lof(#ff) ; " length of file"
'Print Fileattr(#ff) ; " file mode" ' should be 1 for input
Do
Line Input #ff , S ' read a line
' line input is used to read a line of text from a file
Count = Split(s , Work1(1) , "=")
Work1(1) = Trim(work1(1))
Work1(1) = Lcase(work1(1))
Work1(2) = Trim(work1(2))
Select Case Work1(1)
Case "ip"
Count = Split(work1(2) , Work(1) , ".")
If Count = 4 Then
B(1) = Val(work(1))
B(2) = Val(work(2))
B(3) = Val(work(3))
B(4) = Val(work(4))
Else
End If
Case "gateway"
Count = Split(work1(2) , Work(1) , ".")
If Count = 4 Then
B(5) = Val(work(1))
B(6) = Val(work(2))
B(7) = Val(work(3))
B(8) = Val(work(4))
Else
End If
Case "mac"
Count = Split(work1(2) , Work(1) , ".")
If Count = 6 Then
B(13) = Val(work(1))
B(14) = Val(work(2))
B(15) = Val(work(3))
B(16) = Val(work(4))
B(17) = Val(work(5))
B(18) = Val(work(6))
Else
End If
Case "submask"
Count = Split(work1(2) , Work(1) , ".")
If Count = 4 Then
B(9) = Val(work(1))
B(10) = Val(work(2))
B(11) = Val(work(3))
B(12) = Val(work(4))
Else
End If
End Select
Print S ' print on terminal emulator
Loop Until Eof(ff) <> 0
'The EOF() function returns a non-zero number when the end of the file is reached
'This way we know that there is no more data we can read
Close #ff
' Settcp B(13) . B(14) . B(15) . B(16) . B(17) .b(18) , B(1) . B(2) . B(3) . B(4) , B(9) . B(10) . B(11) . B(12) , B(5) . B(6) . B(7) . B(8)
'DOES NOT WORK HERE!!!!!!!!!!
' Settcp 12.128.12.33.46.74 , 192.168.0.221 , 255.255.255.0 , 192.168.0.254
Call Activate_wiz812()
Waitms 100
Spsr = 1 'set the SPI double speed bit
[/code:1:28001a06e4]
↧