Joined: 10 Apr 2004 Posts: 8 Location: The Netherlands
Posted: Sun Apr 18, 2004 9:37 am Post subject: error in ip2str?
hello,
is it me or is there an error in the ip2str function? parameter should point to the last byte according to the comment in the .lib file, but then the ips are revsersed coz they need to be reversed in the 'long' var to (W3100A needs them LSB first instead of MSB first).
i added a 'adiw r30,4' before the 'ldi r22,4' in the ip2str function.
Look at the tcpip.bas sample.
It shows how the IP address is stored into a LONG.
The IPSTR() function works correct as far as i know.
The compiler handles the 4 byte offset. So it is not advised to put another 4 byte offset into the lib.
When something does not work as you expect, it is better to send a small sample that shows wnat you want and where it works different then expected. _________________ Mark
Joined: 09 Feb 2005 Posts: 17 Location: London, UK
Posted: Mon Mar 07, 2005 9:09 pm Post subject:
I was trying to display the IP address of a client on an LCD display and got the correct output using
Code:
Dim Ipcon AsLong Dim I AsByte'where I is socket number Dim Ip AsString*16
Ipcon =Getdstip(i)
Ip ="" For J =1To3
K = Ipcon And255
Ip = Ip +Str(k)+"." Shift Ipcon , Right Shift Ipcon , Right Shift Ipcon , Right Shift Ipcon , Right Shift Ipcon , Right Shift Ipcon , Right Shift Ipcon , Right Shift Ipcon , Right Next J
Ip = Ip +Str(ipcon) Lcd Ip
This produced 192.168.0.2 correctly.
I then found Ip2str in whilst looking at help but I do not think the IP2STR() works correctly
Code:
Dim Ipcon AsLong Dim I AsByte'where I is socket number
Ipcon =Getdstip(I) Lcd Ip2str(Ipcon)
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