PLC generating 0-255 in hex with 8 DO's

Lamboom

Lifetime Supporting Member
Join Date
Mar 2014
Location
Fallbrook, Ca
Posts
350
AS a newbie with PLCs .. I'm curious how I could get 8 Digital Outputs (24VCD) to send a number from 0 to 255 to a LinMot Linear Motor Driver .. which has a command table of 255 lines, each of which can launch a motion curve. Works great using 8 toggle switches to simulate the PLC's output. Not sure how to research this trick, using a PLC .. where to start.. Thanks, Regards, Michael PS: (Using Siemens S7 1200)
 
In the Siemens PLC's, it is possible to address the output area as both a bool and a byte at the same time. If your digital outputs are assigned to addresses Q0.0 - Q0.7 (output byte 0, bits 0 through 7), that is the same as QB0 (output byte 0). If you declare the tag you want to pass as a USInt (unsigned short integer) then it will take up one byte and have a range from 0-255. All you need to do is MOVE the appropriate value into QB0, and the appropriate outputs will turn on.

That's just one solution, I'm sure there are others.
 
Hi MK42 .. That's brilliant! I think I actually understood you .. Thanks much! .. Methinks, such a solution would be obvious to a well trained scholar of PLC's, ... I have a long way to go :) Glad you found a solution so quickly. Regards, Michael
 
On your Laptop use the scientific calculator, and using binary option type in the bit pattern number you want, then change that to decimal display and it will show the decimal number to type in
 
Thanks for the reply Gil47... But, I guess I wasn't real clear here. I know how to convert from integer base 10 to Binary, and count to 255 using 8 bits. (one Byte) There are 8 digital outputs, sometimes 16, on Siemens PLCs & modules. I needed to know how to program the PLC to create the binary word (QB0 in this case) which is the input for a LinMot Linear Motor Command Table. For example, I wish to to touch or select a number from 0 to 255 on an HMI ..say 27 ... The PLC must convert 27 to 11011000 in the 8-bit byte OB0, which is then input to Linmot driver, and the driver instantly runs the operation on row 27 in the drivers table. This is how a newbie explains it ... :)
 
The convention is to show binary numbers msb...lsb so,

27 dec = 1B Hex = 0001 1011 bin

The number is already in binary in the plc so no conversion is required, move the byte written by the HMI to QB0
 
Thanks LD ... It's my subject (title) .. I wasn't thinking when I used "Hex" . that base isn't used here at all. DUH! We're just writing an 8 bit word in binary here .. sorry for the unintended misdirection . Regards, Michael
 
On your Laptop use the scientific calculator, and using binary option type in the bit pattern number you want, then change that to decimal display and it will show the decimal number to type in

Yes.. Thanks for the hint.. I wouldn't have thought to use the calculator
 

Similar Topics

Hello Guys, I spent some time searching the web to learn how to generate the report (to be printed out or to be saved as pdf file) which would...
Replies
0
Views
1,206
So when going through creating logs of all our safety signatures for tracking purposes. I found one PLC without a safety signature. This one is...
Replies
7
Views
8,999
I'm still in the early days of working with a CompactLogix PLC here, but I wanted to see if any of you had some suggestions on how I could get a...
Replies
4
Views
4,450
Hi All, I am looking at creating a Macro to generate the bulk or repetitive PLC code and SCADA objects and was wondering what advise or...
Replies
10
Views
7,079
Good Day to all of you, this is my first post, i will try to explain as best as possible, english is not my natural language. I am performing an...
Replies
0
Views
26
Back
Top Bottom