Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

How can i write New IP in EEPROM

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP
View previous topic :: View next topic  
Author Message
katipefendi

Bascom Member



Joined: 24 Oct 2013
Posts: 30

blank.gif
PostPosted: Thu Jul 05, 2018 10:51 am    Post subject: How can i write New IP in EEPROM Reply with quote

I send from VB.NET Application the new data of IP, SUBMASK, GATEWAY and store it in EEPROM but after stored i received only 0
What is wrong here?


Code:

Dim Setip As Eram Long
Dim Setsubmaske As Eram Long
Dim Setgateway As Eram Long

Dim Setip_r As String * 16
Dim Setsubmaske_r As String * 16
Dim Setgateway_r As String * 16

Setip_r = Maketcp(setip)
Setsubmaske_r = Maketcp(setsubmaske)
Setgateway_r = Maketcp(setgateway)

 Settcp 0.8.220.77.05.11 , Setip_r , Setsubmaske_r , Setgateway_r

Config Tcpip = Int0 , Mac = 0.8.220.77.05.11 , Ip = 192.168.178.29 , Submask = 255.255.255.0 , Gateway = 192.168.178.1 , Localport = 2005 , Chip = W5500 , Spi = 1 , Cs = Portb.4
 


Code:

Do
 Select Case Data

  Case "2"
                        'TCP/IP, GateWay, Submaske Einstellungen in den Speicher schreiben
                        Reset Watchdog
                        Gosub Setnewip
           
            Case Else

  End Select

Loop

 



Code:

Setnewip:
   'Die Daten erst in eine Variable schreiben
   Setip_r = Command_array(3)
   Setsubmaske_r = Command_array(4)
   Setgateway_r = Command_array(5)

   'Jetzt die Daten vom Variablen in den EEPROM schreiben
   Setip = Setip_r
   Setsubmaske = Setsubmaske_r
   Setgateway = Setgateway_r

   Stored = "NewIP|" + Str(deviceadresse)
   Result1 = Tcpwritestr(idx , Stored , 255 )

Return
 
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1257
Location: SYDNEY

australia.gif
PostPosted: Fri Jul 06, 2018 12:28 am    Post subject: Reply with quote

Hello katipefendi

In the project blog section of the forum you will find my " Building a Webserver with a Wiznet W5100" blog
In this you will find the code to write all the IP address needed >gateway, server IP , mask , NTP server
It is built in project mode so each function is a file on its own which you can put into your project
It provides a full server which has web pages to change the settings.
In the other blog "Build a Webserver with ENC28J60" you will find
how to put web pages into the AVR flash memory using as little space as possible
Again it also saves setting to eeprom

I am happy to help you all I can so just ask me about the code
You will find I have put lots of comments in the code to help

Reegards Paul
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum