I'd like the details.I can give details if anyone needs them.
Below is an example of writing Setup Record '0'. There are 7 setup records in all. You don't need to write to all of them every time, but you have to write an ENTIRE setup record each time you want to change even one byte.
For a better explanation, you will have to get a copy of "COBOX Setup Records" from Lantronix.
First, you have to pull the XPORT's RESET line low for 500mSec and release it, then you start feeding it a series of lower case "z"s through the serial port. It will respond with a string (I just look for ANY response, and throw the string away). The 'zzzzzzzz's" put it in Command MODE. After that, you send the setup records themselves.
Note that in the example below, I have "seeded" the Checksum register ("Z")
with a 128. This is necessary because I didn't run the whole string through my checksum calculation routine. I only need to change certain bytes, IP, Protocol (tcp/ip or UDP), etc. So I ran only those through the checksum calculator. Also note that this calls a routine "BIN2IHEX" which calculates the Intel Hex values needed.
------------------------------------------------------------------------
Z = 128
HSEROUT ["S0"] 'Setup Record '0'
PAUSE 150
HSEROUT [13]
Pause 550
HSEROUT [":20000010"] 'Prefix
FOR Y = 0 to 3 'IP address of unit
X = IP[Y]
Z = Z - X
GOSUB Bin2IHex
HSEROUT [MSN,LSN]
NEXT Y
Pause 10
HSEROUT ["0000000000000000000000004C020000"] '4C is line interface mode
'02 is baud rate. Last byte is
Pause 10 'byte number 19
X = LPortNo 'Port number of Xport LSByte
Z = Z - X
GOSUB Bin2IHex
HSEROUT [MSN,LSN,"00"] 'MSByte of port number (always 0)
X = RPortNo 'LSByte of Remote Port number
Z = Z - X
GOSUB Bin2IHex
HSEROUT [MSN,LSN,"00"] 'MSByte of Remote Port (always 0)
FOR Y = 0 to 3 'Remote IP address
X = IP2[Y]
Z = Z - X
GOsub Bin2IHex
HSEROUT [MSN,LSN]
NEXT Y
Pause 10
If PROT = 0 THEN
X = 192
ELSE
X = 204
ENDIF 'Connect Configuration and
Z = Z - X 'protocol - "0" for tcp, "1" for UDP
GOSUB Bin2IHex
HSEROUT [MSN,LSN,"010100"] 'Disconnect with 1 min of
X =Z 'inactivity
GOSUB Bin2IHex
HSEROUT [MSN,LSN,13] 'WRITE CHECKSUM, ADD CR
PAUSE 150
HSEROUT [":200020100000230000000000000000000000000000000000 0000000000000000000000008D",13]
Pause 150
HSEROUT [":200040104C0200001227000000000000C000000000000000 00000000000000000000000049",13]
Pause 150
HSEROUT [":180060100000000000000000000000000000000000000000 0000000078",13]
Pause 150
HSEROUT [":00000001FF"]
PAUSE 150
RETURN
Charles Linquist
Don't think anyone has mentioned it yet, but if you've got a spare PC that can be dedicated to the pic, you can write a client/server type application in whatever pc language you use and have the pc connected to the pic retrieve commands over the network, spit them out the serial port to the pic, then have the pic send the serial commands to the device. Kind of cheap and dirty, but does the job. I've done this easily in VB.... and who doesn't have an extra old pc laying around collecting dust?
Here is a link for another pc solution.
Wisdom is knowing what path to take next... Integrity is taking it.
Ryan Miller
i've done a job with this ones, prefered the sbc68ec with bootloader :
http://www.modtronix.com/index.php?cPath=1_36
they work now in this release very fine. be sure that you have a switch right before which select only the traffic you really need. don't use a hub!
i know it's only microcontrolling, but i like it!
Bookmarks