You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old October 19th, 2011, 05:50 AM   #1
b16mcc
Member
United Kingdom

b16mcc is offline
 
Join Date: Jul 2006
Location: North West
Posts: 13
Question Siemens Step5 150u Analogue Output Scaling

Hi guys. I'm looking for a simple method of scaling an analogue output on a Siemens 150u.

On the 115u in comparison, I would simply use FB251, but as this is not available in the 150u I am somewhat stuck.

I simply want to provide a value from a data word and scale it to an analogue output.
Any help would be greatly appreciated, thanks.
  Reply With Quote
Old October 19th, 2011, 06:43 AM   #2
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 5,472
Which CPU are you using ?
  Reply With Quote
Old October 19th, 2011, 06:44 AM   #3
b16mcc
Member
United Kingdom

b16mcc is offline
 
Join Date: Jul 2006
Location: North West
Posts: 13
The 150u , 924, 925, 926 ,927 cards.
  Reply With Quote
Old October 20th, 2011, 08:02 AM   #4
b16mcc
Member
United Kingdom

b16mcc is offline
 
Join Date: Jul 2006
Location: North West
Posts: 13
The block is called RLG:AA it's part of the operating system of the 115u and available for the 135 and 155u in a file called S5AA20ST.S5D or S5AA60ST.S5D respectively.

As Siemens no longer acknowledge the existence of the 150u , its not listed on the page. This leaves me wondering , did it ever exist or not ?
I've logged a call with Siemens Tech Support and they usually ring back pretty quick.
Has anyone come across this FB for the 150u , or can anyone shed any light on how I might do it.
Thanks.
  Reply With Quote
Old October 20th, 2011, 10:25 AM   #5
parky
Member
United Kingdom

parky is offline
 
Join Date: Oct 2004
Location: Midlands
Posts: 971
Just create your own FB, all you need is parameters passed to it like value in (scaled to whatever i.e. 0-150.0) then offset for 4-ma (if used) span for 20ma (if used) then zero & span variables to scale up the analog raw value and the PW No.
the raw data is formatted as below

bit 0 to 3 not used in A/O
Bits 4 to 14 are the analog value 0-1024
Bit 15 is the sign bit
so once you convert your signal e.g 0-1500 (0-150.0) to 0-1024 you then shift it right 4 places.
(if 2 compliment +- 1024 then you need to set the sign bit as required)
This only applies to U range analog cards like 470 7LB11
The K range only has 0-255 i.e bits 0 to 7 & 8 is the sign bit.
The Analog inputs use a similar process however the least significant bits 0-2 are error/status bits so to convert the raw you shift left 3 places (store lower bits for status/errors) the raw value is +-2047.
Bit 0 is Overflow bit Bit 1 is Fault (open circuit) Bit 2 is Busy

Last edited by parky; October 20th, 2011 at 10:40 AM.
  Reply With Quote
Old October 20th, 2011, 10:39 AM   #6
b16mcc
Member
United Kingdom

b16mcc is offline
 
Join Date: Jul 2006
Location: North West
Posts: 13
Thanks for the reply parky. I'm in the process of building a rig to develop this on. I can't afford to crash the actual machine whilst I'm putting this together.

I kind of understand your description, but I'm not sure I can implement it. I'm gonna get a rig running then start throwing some STL together. Now I know the bit pattern of the word I need I can at least make a start.
Thanks again.
  Reply With Quote
Old October 20th, 2011, 01:46 PM   #7
b16mcc
Member
United Kingdom

b16mcc is offline
 
Join Date: Jul 2006
Location: North West
Posts: 13
Update:- I've managed to realise the basics of the code required is actually very very simple. The 3 lines of code achieved exactly what I was looking for. Knowing the required bit pattern makes the job a whole lot easier.

I'm happy to use a reference value of 0-1024 and so there's no scaling as such required. I simply write a value of 0-1024 to my Flag word and then shift it, before sending it out.

L FW200 (Load my reference value 0-1024)
SLW 4 (Shift left word 4 to match the required bit pattern)
T PW160 (Transfer modified word to my analogue output)

It works perfectly as proven on my 155u test rig.
  Reply With Quote
Old October 21st, 2011, 12:15 PM   #8
parky
Member
United Kingdom

parky is offline
 
Join Date: Oct 2004
Location: Midlands
Posts: 971
Glad to help, it's been 11 years since I last used S5 but somewhere I have blocks that contains all the functions you would require for both AI & AO but I do not have S5 anymore so unable to post the code.
If I find it & manage to find my old S5 disks I will post it.
  Reply With Quote
Old October 21st, 2011, 01:11 PM   #9
b16mcc
Member
United Kingdom

b16mcc is offline
 
Join Date: Jul 2006
Location: North West
Posts: 13
Sounds good mate. I can fix you up with S5 if you really want it.
I've just put this code into my 150u when production finished today. So far, its NOT working. Not sure why yet, not sure if its something else in the code, a bad card perhaps. I don't know yet. After getting it to work very easily last night on a 155u test rig I'm somewhat disappointed at it not working on the 150u.
Gonna sleep on it.
  Reply With Quote
Old October 22nd, 2011, 06:17 AM   #10
parky
Member
United Kingdom

parky is offline
 
Join Date: Oct 2004
Location: Midlands
Posts: 971
Is the card an existing card? if not & the card was not recognised then you should get an error QVZ I think (I/O)
Is the card the same as the card used in the 155 We never used the 150/155 type racks only the main rack then 115 I/O racks for digital & Analog cards with IM??? interface
Also not knowing the configuration of your system have you got the right PW etc.
  Reply With Quote
Old October 22nd, 2011, 12:56 PM   #11
KalleOlsen
Member
Norway

KalleOlsen is offline
 
Join Date: Oct 2008
Location: Norway (moustache area)
Posts: 1,749
Could it be that the AO is written to somewhere else in your program?

I don't remember exactly, but think the AO block was adressed by the start addres of the card (KF) and the channel/type (KNKT(KY)). If I am right, it is impossible to search for the start adress in S5. But you could print all blocks to a text file and search the file for the start adress number.

Btw, you could probably check this by putting your new code at the very end of OB1. If it works now, but not if you put it at the start of OB1, it is written to in the program before. If it is unstable, it could be written to from an interrupt OB.

Kalle

Edit: @ b16mcc. I just had a flashback - RLG:AA was FB41, wasn't it?

Last edited by KalleOlsen; October 22nd, 2011 at 01:34 PM.
  Reply With Quote
Old October 23rd, 2011, 05:15 AM   #12
KalleOlsen
Member
Norway

KalleOlsen is offline
 
Join Date: Oct 2008
Location: Norway (moustache area)
Posts: 1,749
Quote:
Originally Posted by KalleOlsen View Post

Btw, you could probably check this by putting your new code at the very end of OB1. If it works now, but not if you put it at the start of OB1, it is written to in the program before.
Normally I am far from quick, but this was still too quick and is not correct.

Writing to the AO (T PWx) addresses the output card directly and therefore this suggestion will not work reliably.


Kalle
  Reply With Quote
Old October 23rd, 2011, 02:20 PM   #13
parky
Member
United Kingdom

parky is offline
 
Join Date: Oct 2004
Location: Midlands
Posts: 971
Transferring to the PW directly should not be a problem in 150/155 Then again we only used 115 I/O racks for I/O with the interface cards, only comms/WF470 etc. were used in the main rack the only other thing I remember about the main rack was that only so many special function cards could be used without solder link changes on the backplane what is your I/O layout, are the I/O cards in the main rack etc.
  Reply With Quote
Old October 23rd, 2011, 03:38 PM   #14
KalleOlsen
Member
Norway

KalleOlsen is offline
 
Join Date: Oct 2008
Location: Norway (moustache area)
Posts: 1,749
Quote:
Originally Posted by parky View Post
Transferring to the PW directly should not be a problem in 150/155
Sorry for using a wrong word. "Directly" should be "instantly". In my stupid suggestion I forgot the difference between T PW (instantly) and T QW (QW->PW after OB1).

Kalle
  Reply With Quote
Old October 24th, 2011, 12:12 AM   #15
b16mcc
Member
United Kingdom

b16mcc is offline
 
Join Date: Jul 2006
Location: North West
Posts: 13
Right chaps, thanks for your input, it makes an interesting read. I'll try and clear up a few things for you.

I'm using 150u with 115u I/O racks. There is no I/O in the main rack.
The card I'm using is an existing card but all Outputs are spare.
I've tried addressing to a single spare output on another card where some other outputs are used, but I get the same non responsive output.
It did cross my mind that the outputs could be referenced elsewhere in the program but I've been unable to prove this so far.
The outputs are referenced as OW , not PW. I've never seen this before. When writing the STL , S5 will not allow me to enter T PW or T QW.
The card I'm trying to use is a 6ES5 470-7LC11
It is the same card I used in the 155u test rig. (It worked ok in the 155u)

Kalle, yes it was FB41, I can't find it for the 150u.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Anyone pls help with Siemens Step 7 analogue signal Rolling average code/FB matt_sd LIVE PLC Questions And Answers 5 January 20th, 2010 09:47 AM
Siemens STEP5 Cable Needed sonofsiemen LIVE PLC Questions And Answers 8 May 14th, 2009 02:45 PM
Siemen's output card quandry ajbachhuber LIVE PLC Questions And Answers 3 September 6th, 2003 11:06 AM
Analogue scaling john clay LIVE PLC Questions And Answers 5 June 22nd, 2003 06:54 PM
Sequential Logic to AB PLC Tze LIVE PLC Questions And Answers 7 January 4th, 2003 11:41 AM


All times are GMT -5. The time now is 04:49 PM.


.