Byte this IP to HEX

Orn Jonsson

Member
Join Date
Apr 2002
Location
Boise Idaho
Posts
125
Hi partners,

I an using an Automation Direct DL06 with ECOM module to send data to a data logging software called Data Worx.
The data is transmitted via ethernet, and for the setup parameters in the PLC I plug in the Ethernetnet address and IP address of the PC. The problem is that if the network adninistrator chances the IP on the PC, the PLC cant find it and I have to drag out the lap top and update the IP in a hex format in the PLC.
I want to be able to enter the IP in the decimal format 192.168.000.100 (four separate single word fields), on the touch screen and have the Logic convert it to hex. This IP number converts to C0 A8 00 64 hex.

The problem is that the first two bytes of the IP hex code HAVE TO go to one word. And the last two bytes HAVE TO go to another word.
For example V2013 = C0 A8 and V2014 = 00 64

How do I get 192 and 168 converted to hex so both results end up in one word. The BIN instruction converts BCD to HEX but I get stuck with C0 in one word and A8 in another.

Thanks,
OJ
 
You should be able to do this by multiplying the most significant of the pair by 100h. I am going to assume that the entered IP address is in V3000 - V3003 with V3000 being the most significant value. I will use V2013 and V2014 as the result addresses with V2013 the most significant. I am also assuming the IP adress values are entered in BCD. Try this:



LD V3000 Value = 192 BCD Enter high value
BIN Value = C0 Hex Convert to binary
MULB K100 Value = C000 Hex Multiply by 100h to shift up
LD V3001 Value = 168 BCD Enter low value of pair
BIN Value = A0 Hex Convert to binary
ADDBS Value = C0A8 Add first two accumulator levels
OUT V2013 Send result out

LD V3002 Value = 000 BCD Enter high value
BIN Value = 00 Hex Convert to binary
MULB K100 Value = 0 Hex Multiply by 100h to shift up
LD V3003 Value = 100 BCD Enter low value of pair
BIN Value = 64 Hex Convert to binary
ADDBS Value = 64 Add first two accumulator levels
OUT V2013 Send result out




I hope this helps.
Keith
 
HEXED OUT. Thanks Keith

Thanks a bunch.

That did the trick.
Shifting the first 2 hex nubers to the left by multiplying with K100 and then adding the second word with the hex in the lower byte gave me 4 hex numbers in one word. (used MULB insted of MULBS).

Here is another one which I would like to get in the bag.
ENTER 0050 hex to V2010, DAE9 TO V2011, 49EB TO V2012. From an Automation Direct (EZ TOUCH) AVG, screen.

Using Integer tag would get me the number in hex I presume. But what about the LETTERs should I be looking at ASCII to HEX?

Thanks,

Orn
 
Hex uses digits 0-9 and letters A-F.
I'm not an Automation Direct expert but I think
all you need is go to menu "Objects" and choose "Numeric Entry..."
Next window to open will have Format pull down list.
Change from Decimal to HEX.
 

Similar Topics

Our system utilises INPUT_BYTE to capture NMEA0183 ASCII stream which sends data to the NOM multiple times a second. The NOM module can either be...
Replies
0
Views
365
Hello everyone, friends. I need help with something. I want to read and change Bit and Byte numbers via HMI. I found a code snippet for this as...
Replies
18
Views
3,010
Hello everyone :) I just want to start with learning PLC programming, so I need advice. I have SIMATIC S7-1200, CPU with integrated memory...
Replies
5
Views
907
I have a C-More HMI that changes my PLC String from "Machine Status" to "aMhcni etStasu" . There is an option with other objects that have string...
Replies
15
Views
3,413
Hello I have got a problem with positive edge from "system clock memory byte" in Tia Portal. I would like to change byte"system clock memory"...
Replies
27
Views
3,537
Back
Top Bottom