![]() |
||
|
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
| ||
New Here? Please read this important info!!!
|
|
#1 |
|
Member
![]() Join Date: Jun 2011
Location: MI
Posts: 2
|
Omron Function Block
First time with structured text and something isn't working correctly. Simple block, copy of the SCP in Allen Bradley (scale with parameter). The math is off, I think its syntax. Driving me nuts.
Its a CJ2M series. Thanks.
|
|
|
|
#2 |
|
Member
|
see attached file for my version for scaling int to real
hooey |
|
|
|
#3 |
|
Member
![]() Join Date: Jun 2011
Location: MI
Posts: 2
|
Thanks Hooey,
The conversion to real was helpful. Getting roughly the same result. I'm running the simulator, here are the values I am using. In = 1000 InMin = 100 InMax = 20000 SclMin = 1 SclMax = 100 SclOut = -49597.80. My trusty excel sheet yields 5.48 This is only my second Omron project so I am still green on this. I attached the .cxp with the FB. Am I using the correct registers? Cheers. |
|
|
|
#4 |
|
Lifetime Supporting Member
|
Hear is a link to an Omron scale with parameters FB.
http://forums.mrplc.com/index.php?ap...s&showfile=523
__________________
The Old Pfhaart
|
|
|
|
#5 | |
|
Member
|
Quote:
you use of d registers might need reviewing, d registers are 16 bit storage locations so used to store a real type number will use 2 16 bit locations d0 and d1 and as you have used d1 as a input to the function block as constant you will end up with corrupted results . define symbols for inputs to the function block as type real ie. InMin type real, InMax type real, SclMin type real, SclMax type real, SclOut type real and give that a go. Hooey |
|
|
|
|
#6 |
|
Lifetime Supporting Member
|
I have basically given away using FBs for almost everything - too slow and painful. I used to use FBs for floating point maths. I often have to extract data from Caterpillar, and other brands, engines. It is extr5acted by Modbus RTU but is in J1939 format - absolute pain. Value, precision and offset. I have attached a routine I recently used on a job - fairly obvious what is going on. Admittedly not scale with parameters nut may help you get a handle on floating point in Omron.
It is part of a standard routine I developed - the engines all come with different information available. I stick in the standard routine and then delete what I do not get from the engine. The only other thing I do is use FIXL (fix long) to read the values in decimal. I then delete the FIXL function when I am happy with the readings I use the floating point values on Omron NS screens. Hope this helps you get a handle on things. Float all values first, including the constants you have to use for precision, multiples to make the values useful and offset values.
__________________
The Old Pfhaart
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Topics
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Create Function Block RS Logix 5000 | mrsoliveira | LIVE PLC Questions And Answers | 1 | September 10th, 2008 10:35 AM |
| Migrating VB6 IDEA app to VB.Net | Extrasoft | LIVE PLC Questions And Answers | 5 | November 4th, 2007 06:13 AM |
| ST Help, function & block function | najs | LIVE PLC Questions And Answers | 3 | February 24th, 2006 01:09 AM |
| Function block | irfan22in | LIVE PLC Questions And Answers | 0 | September 16th, 2005 07:05 AM |
| PID function block for sucosoft ver4.20 | sivakumar | LIVE PLC Questions And Answers | 0 | September 30th, 2002 02:49 PM |