how to access the data in db(s7)

Mclean

Member
Join Date
Apr 2003
Posts
9
i know i can use dbx for bool in db,dbb for byte,and dbw dbd for word and double-word.but what if i want to read date_and_time,or string?what instruction should i use?
 
Hi,

Open the DB in "Declaration View" then..........

Under "TYPE" select "Complex Types" and then Select Date_And_Time

This uses 8 Bytes of the Data Block.

Hope this helps?
 
You can read complex types from a DB only by referring to them by their symbolic name. The catch in this is that you can only reach the variables by symbolic name if the DB also has a symbolic name.

Suppose you have a DATE_AND_TIME variable named Current_Time located in DB10. Give the DB a symbolic name eg. DB10 is called "DataBlock_10". Then you can access the DATE_AND_TIME variable by adressing it as "DataBlock_10".Current_Time

Beware: this only works with blocks or instructions who need this type of variable. You can never MOVE complex types with a simple MOVE command or a L and T combination.

Kind regards,

Jean Pierre Vandecandelaere
 
Another way would be to look at the "seperate" Bytes with in the Date_And_Time Parameter.

The Date_And_Time Parameter has the following format......


Byte 0 Year 1990 to 2089
Byte 1 Month 01 to 12
Byte 2 Day 1 to 31
Byte 3 Hour 0 to 23
Byte 4 Minute 0 to 59
Byte 5 Second 0 to 59
Byte 6 2 MSD of ms 00 to 99
Byte 7 (4 MSB) LSD of ms 0 to 9
Byte 7 (4 LSB) Day of week 1 to 7 (1 = Sunday)

You can once again use (for example) db2.dbb0 etc.
 
ok,the date_and_time problem is solved.thank you moggie and jvdcande.one more question:is that mean i can't use pionter to access string variable?
 

Similar Topics

Hello, all, total noob here hoping for a little guidance. I bought a new piece of printing equipment that has a Mitsubishi PLC and this Data...
Replies
7
Views
193
Data Acees Error for Alias A_THMC_REV_POL, controller PLC-1
Replies
2
Views
159
Hello all, PLC-programming noob here. I have multiple clients accessing some data on my Siemens S7 1211C PLC; some OPC clients and some direct...
Replies
30
Views
8,392
Hi everyone, I'm working with a company that is developing software that will be used to access and process sensor data from different process...
Replies
6
Views
1,911
So the micrologix 1100 has a built in web server. I have been following the user manual 1763-UM002. After I enter in my controller's IP address...
Replies
0
Views
1,210
Back
Top Bottom