S7 byte to integer

bosko1

Member
Join Date
Jun 2006
Location
Ontario
Posts
96
After twisting this way and that, I finally have the PLCs clock information in seperate bytes. Now to display this on an HMI, it should be an INT.

I used to push S7 on my clients over the AB stuff... but this is absurd. All I want to do is display the time! I don't use STL as it's not maintenance friendly, and I haven't had much exposure to it, and while I realize this kind of thing is elementary to some of you, please explain it to me like you would to a 4 year old.

Thanks.

Bosko
 
Hi, its quite easy, although you do have to do it in STL I'm afraid.

Ladder instructions ensure that both sides of the move instruction are the same format, in STL it doesn't.

L #Hour_byte // whatever you called your hour byte
T #Hour_word // whatever you called your hour word.

simple as that really, repeat for all parts of the time/date you want.
 
Try this, substitute mb1 + mw1 for your values!


move.JPG


You could also turn off the Type check as follows in LAD/FBD/STL editor

custom.JPG



Hope this helps

STL
 
thanks a lot guys. I didn't know you could turn off type check!


that should help. really though, am I the only one that thinks this information should be available in a usable format to begin with?
 
bosko

Just another little tip...

Instead of using SFC1 READ_CLK to read the real time clock, use the local temp data in OB1, this data is located in LB12 to LB20, this is the time that OB1 was called, so the only difference between this time and the real time clock called using SFC1 is only a few milliseconds, possible less.

Paul
 
thanks again, I saw the OB1 suggestion on one of the other threads, but I think the headache is still the same, getting the data into a format that is usable. Basically what I'm trying to do is to time stamp Min/Max values for an analog input such as a flow or chlorine residual. Later I will use excel to pull in the data into a report.
 
by the way, I just want to say, I like what this board has become over the last few years. The last time I checked here, there was hardly any user involvement. So thanks again guys
 
Instead of using SFC1 READ_CLK to read the real time clock, use the local temp data in OB1, this data is located in LB12 to LB20, this is the time that OB1 was called, so the only difference between this time and the real time clock called using SFC1 is only a few milliseconds, possible less.
Hi Paul,
Never thought to use OB1_DATE_TIME instead of SFC1, might try that from now on.

Regards STL
 
STL??? said:
Never thought to use OB1_DATE_TIME instead of SFC1,

Honest reply here....

Neither did I until I read it on this forum a couple of years ago (at least it seems a couple of years). I did have a quick search for the thread in question, but couldn't find it.

Paul
 
I guess the next question is, "is getting the data from S7 softnet the same as when you're getting it from RSlinx?". I've the RSLinx DDE connection thing a few times with great success.

Maybe this should be a new post?
 

Similar Topics

This morning I had a problem with a machine where I use BTI functions... This was what the diagnostics of the CPU gave me: This i my...
Replies
2
Views
4,611
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
386
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,032
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
931
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,473
Back
Top Bottom