Siemens S7 data types - my brain has siezed!

Ned_Flanders

Member
Join Date
Oct 2008
Location
In hiding, England
Posts
535
I am trying to compare two values, one comes from modbus via a datablock in the range of 0 - 65535. "Int" in the datablock.
This is displayed on a Pro face gp3500 HMI correctly and in the program.

I am trying to compare this with a level set on the HMI and the HMI has 16 bit dec 0 - 65535, 0 - 200 as its range.

If I exceed 32768, by typing 100 on the HMI (Half "Full scale") the value displayed in the program becomes a minus value!

What am I doing wrong? I thought 16 bits would display 65535.
 
markie,

16 bits can represent 0 to 65535 or from -32768 to + 32767. There are always signed/unsigned types you need to think of. Probably, this is why you get negative value when you try to enter 32768 (which is above max positive value).

Regards,
Pandiani
 
Is this comparing the same like you a few posts before??
Then maybe you would need to compair for >I instead of >D
 
What a plank! Should have RTFM - on a INT the msb is the sign +/-, so if the msb goes to 1, the display shows a negative value.

Still had some maths to do , and reset my HMI inputs to 0-32767! D'oh.
 

Similar Topics

I've got some minimal C code that I wrote some time ago to talk to Siemens PLCs. I used it with a 1200. At the time I only hit I, M, and Q...
Replies
5
Views
1,826
I have just noticed after trying to figure out why my data is going into the wrong location that data blocks don't always align in sequential...
Replies
8
Views
3,083
Dear Experts, Please, kindly guide me through how to read data from ABB PLC to S7-1200 Siemens PLC. I want to use Siemens S7-1200 PLC to read data...
Replies
1
Views
443
Looking for options to write data to Siemens PLC. Looking for something closest to way we were doing it with AB PLC and excel sheet. Old way...
Replies
7
Views
889
Hi, I've created this 'report summary' page (see pic). Basically, this screen is a summary of all the tags saved (by pressing a SAVE button)...
Replies
78
Views
9,024
Back
Top Bottom