s7 1200 indirect addressing using real data type

Rob.Hill

Member
Join Date
Dec 2009
Location
Yorkshire
Posts
47
Hi,

Im new to SCL, but decided to start learning it - if only to be able to do some simple jobs such as indirect addressing.

got some simple code to manipulate a local temporary register:

IF "Tonnage_Data".Cycle_Complete_Hour_Stamp=5 THEN
#East_Byte_Offsett_Address:= (#East_Current_Skip_Number_Converted-1) * 4 + 1318; // Calculating Dynamic Offsett Address To Tonnage Data DB
END_IF;

IF "Tonnage_Data".Cycle_Complete_Hour_Stamp=6 THEN
#East_Byte_Offsett_Address:= (#East_Current_Skip_Number_Converted-1) * 4 + 1414; // Calculating Dynamic Offsett Address To Tonnage Data DB
END_IF;

IF "Tonnage_Data".Cycle_Complete_Hour_Stamp=7 THEN
#East_Byte_Offsett_Address:= (#East_Current_Skip_Number_Converted-1) * 4 + 1510; // Calculating Dynamic Offsett Address To Tonnage Data DB
END_IF;

The above carries on, but follows the same theme.
I had hoped to use the #East_Byte_Offsett_Address as the ByteOffsett within the POKE command.

However the POKE command cannot transfer data types of real!

Hopefully someone has a suggestion of indirect addressing a real value?

Thanks
 
Hi,

you have to add the datatype to the POKE function. But there are only binary types possible, like POKE_BYTE, POKE_WORD, POKE_DWORD.
For real values you need an explicit typeconversion.
Code:
#realValue := DWORD_TO_REAL(PEEK_DWORD(area := 16#84, dbNumber := 42, byteOffset := #East_Byte_Offsett_Address));
should do the job.
 
Why not declare the DB using arrays etc and then use SCL to access data form the arrays by index. The SCL you have written should be ditched.
 

Similar Topics

Hello, I am currently forced to use s7-1200 (6ES7214-1AG40-0XB0) PLC for one small project. I do have some experience with S7-300/400 mostly in...
Replies
6
Views
5,104
Is it possible to Go Online or Download changes to a MicroLogix 1200 that's connected to a Panel View Plus 600 (without unplugging the Panel View...
Replies
4
Views
7,689
Hello, I have a question about an encoder that has absolute measurement. Specifically, it's the Lika SMA5, which I would like to connect...
Replies
2
Views
55
Hello, I have a question about an encoder that has absolute measurement. Specifically, it's the Lika SMA5, which I would like to connect...
Replies
0
Views
32
Hi all, Currently having trouble getting a speed reference to write over modbus to an Omron M1... I can successfully write a run command and...
Replies
6
Views
271
Back
Top Bottom