Omron long divide probs...

Steve Kemp

Member
Join Date
Nov 2003
Posts
122
Hi All. I would welcome suggestions as to the error of my ways regarding the following: I'm trying to display a 4-digit (1 dec. place) number on a NS5 HMI. The source for the data is a 4-digit integer (channel; output to a D/A module), namely CIO2001, which I'm presenting to an unsigned long binary divide instruction (/UL433) as the first dividend word. The first divisor word is a constant, &10, and the output word to the HMI is D201. The data types as shown within the instruction's dialogue box are... CIO2001: Channel; &10: UINT; D201: REAL. The output value remains obstinately at zero until the input is at least 10 (that's got to be a clue), and the HMI display for D201 (set up as REAL) remains at zero at all times. I've checked for accidental use of adjacent registers and they're all clear.

Is this perhaps a dog's dinner of incompatibility, requiring some pre-instruction conversion? Unless there's a hidden way to put a decimal place into a NS5 numeric display field without it expecting REAL type data...I don't think so.

Thanks for the use of your collective brains.
 
Hi Steve

I would have thought the channel would be an unsigned integer as would be D201. REAL is normally only available if all are REAL.

Can you not read CIO2001 straight into the NS5 and scale it there? Why divide it in the PLC if you do not have too? Also, why a long divide? Output cards are normally 16 bit max and therefore long divide should not be required.
 
Hello Steve,

Can you not use "FLT" - 16 Bit integer to Float (or FLTL), whereby if CIO2001 has a value of (say) 3, D201 (REAL) will be 3.0.
You could then use Floating Point divide instruction to achive the resolution required.

Regards
Paulus
 
Steve, I did not interpret your question correctly. Paulus is correct - use FLT or FLTL to convert data to floating point and then use floating point divide. The conversion is necessary as all values in floating point maths have to be in floating point format. Just beware that floating point maths use 2 channels for all values so that the first FLT may be to D0 and the second to D2 etc. Then specify D0 and D2 in the floating point divide instruction.

Converting the value of a channel to REAL in CX-Programmer does not really convert the number to a REAL value - only how CX-Programmer interprets the value.
 

Similar Topics

Replies
1
Views
1,415
Hey guys, I can't find an example of the long-timer instruction. I tried implementing one today and the first word was flipping between two values...
Replies
3
Views
3,043
I need a timer that count at least 30-40 min. I know that it is possible to put 2-3 timers after each other, but i want to be able to see the...
Replies
10
Views
7,464
Hi all, I need help on converting a long to float. Also I find the below misleading. Is long and double the same? Pls advice. Thanks.
Replies
1
Views
2,370
Has anyone done SMS messaging from an Omron CJ2J-CPU31 PLC? If so could you help please. Omron here in Oz have not had any experience doing this...
Replies
5
Views
120
Back
Top Bottom