Joined

·
23 Posts

Thanks in advance for your help.

1 - 17 of 17 Posts

Joined

·
23 Posts

Thanks in advance for your help.

Now look for the box labeled radix and click the drop down. Change the radix from the default (bits) to integers. Now you see words, not bits. Nothing magic happened. Data monitor just lets you display tables in different formats. Structured for instance on timers shows the breakdown into words and bits.

Another hint. Remember how the SCAN works? The PLC reads and writes I/O into the input Image TABLE and out from the outout image TABLE. They are just memory tables. They are exactly like creating integer N tables except these are built in, like the S (system) image table. The PLC treats all these tables the same way.

Review the section of the user manual on data types.

As far as dealing with BCD arithmetic, there are commands for the conversion. If you have to do it manually find a copy of Donald Knuth, the Art of Computer Programming, volume 1. It is the “bible” for programmers.

Grab first 4 input bits and move, convert BCD to INT

repeat 3 times

Repeat in reverse to output

Joined

·
23 Posts

so when i use a mmv i can manipulate where in the 16 bit word i want the 4 desired bits to end up?

Grab first 4 input bits and move, convert BCD to INT

repeat 3 times

Repeat in reverse to output

Joined

·
23 Posts

Is there a way to do multiple bit shifts with one false to true transition. For instance how would I move the first four bits into the last four bits position.

Is there a way to do multiple bit shifts with one false to true transition. For instance how would I move the first four bits into the last four bits position.

Look up operators. Or do the math. Divide by 16, 256, or 4096 to right shift 4, 8, or 12 bits. The barrel shifter is just faster than the software divide but that’s a performance thing.

Sent from my iPhone using Tapatalk

Joined

·
23 Posts

looks like i will be stuck doing the math. Due to covid-19 I am limited to the use of the free software made available by the generous people at Allen Bradley.Look up operators. Or do the math. Divide by 16, 256, or 4096 to right shift 4, 8, or 12 bits. The barrel shifter is just faster than the software divide but that’s a performance thing.

Sent from my iPhone using Tapatalk

Joined

·
23 Posts

The program is for a 4 digit thumbwheel switch which is to be displayed on led output display. Im confused with how Im supposed to represent the thumbwheel switch in my ladder program. RSLogix lite using Micrologix 1000The FRD instruction takes up to four digits to convert from BCD. You might be juggling bits for nothing unless they are out of order or you need digits individually.

This whole covid-19 crap has in my opinion really hurt my educational progress. Going from actual classes and labs to what they fancy a "hybrid format" of me teaching myself online.

4 thumb wheels each using 4 bits wired correctly means you already have the bits stacked so it can be copied into a word.

With out seeing the problem its hard to know which ans you require as we have no idea how you are outputting the leds.

binary input to 7 segment would be something like this

https://www.sanfoundry.com/plc-program-operate-seven-segment-display/

but if you are using bcd to 7 segment decoders then a straight copy will work like this

https://www.chegg.com/homework-help...ladder-logic-program-l2-l1-inputs-o-q33177664

Machines don't read decimal so why bother converting it.

Joined

·
23 Posts

here is the problem.

4 thumb wheels each using 4 bits wired correctly means you already have the bits stacked so it can be copied into a word.

With out seeing the problem its hard to know which ans you require as we have no idea how you are outputting the leds.

binary input to 7 segment would be something like this

https://www.sanfoundry.com/plc-program-operate-seven-segment-display/

but if you are using bcd to 7 segment decoders then a straight copy will work like this

https://www.chegg.com/homework-help...ladder-logic-program-l2-l1-inputs-o-q33177664

Machines don't read decimal so why bother converting it.

https://sway.office.com/2g09MVWNm9YF3H8o?ref=Link

you input 1208 on the thumb wheel and the led displays show 1208 but when you press the button the light doesn't come on.

The display wheels each use 4 bits i presume bits 0-3 are referencing the first thumb wheel which is set to 1

0001 is binary for 1 thumb wheel 1

0010 is binary for 2 thumb wheel 2

0000 is binary for 0 thumb wheel 3

1000 is binary for 8 thumb wheel 4

these bit are being loaded into a word called TWS which is 16bits

Tws is a reference to a memory location it doesn't care whats in it or how it got there (plc's are not smart)

when the bits from the thumb wheels are loaded into TWS they equal 1000000000100001 when converted to decimal it equals 32801. plc doesn't care that you think it equals 1208 its all 1's and 0's as far as its concerned

Now we can do all sorts of fancy crap to convert 1000000000100001 into something we can read. Lets face it the plc has better things to be doing then breaking a word into 4 different words and doing a lot of math to reassemble it into something you can read. Plus its only being used once in equ statement so whats the point.

In this question they simply want you to compare the settings on the thumb wheels with decimal 1208 and turn on a light if it match's.

Add a note in the program that tws 32801 = 1208 decimal then replace the 1208 (source B) with 32801

If your using a emulator simply set 1208 on the thumb wheels and look at tws in decimal as its saves having to use a binary to decimal converter.

Joined

·
23 Posts

you input 1208 on the thumb wheel and the led displays show 1208 but when you press the button the light doesn't come on.

The display wheels each use 4 bits i presume bits 0-3 are referencing the first thumb wheel which is set to 1

0001 is binary for 1 thumb wheel 1

0010 is binary for 2 thumb wheel 2

0000 is binary for 0 thumb wheel 3

1000 is binary for 8 thumb wheel 4

these bit are being loaded into a word called TWS which is 16bits

Tws is a reference to a memory location it doesn't care whats in it or how it got there (plc's are not smart)

when the bits from the thumb wheels are loaded into TWS they equal 1000000000100001 when converted to decimal it equals 32801. plc doesn't care that you think it equals 1208 its all 1's and 0's as far as its concerned

Now we can do all sorts of fancy crap to convert 1000000000100001 into something we can read. Lets face it the plc has better things to be doing then breaking a word into 4 different words and doing a lot of math to reassemble it into something you can read. Plus its only being used once in equ statement so whats the point.

In this question they simply want you to compare the settings on the thumb wheels with decimal 1208 and turn on a light if it match's.

Add a note in the program that tws 32801 = 1208 decimal then replace the 1208 (source B) with 32801

If your using a emulator simply set 1208 on the thumb wheels and look at tws in decimal as its saves having to use a binary to decimal converter.

Thank you so much. That makes a lot of sense and really helps me. One more question: how do i represent a thumbwheel switch in my program? 4 seperate inputs?

A thumb wheel is simply 4 switch's hooked to 4 inputs (unless its analog).Thank you so much. That makes a lot of sense and really helps me. One more question: how do i represent a thumbwheel switch in my program? 4 seperate inputs?

0000=0

0001=1

0010=2

etc

there is no represent a thumbwheel switch in my program. The plc doesn't care whats hooked to the 4 inputs. If you want to make a note like

thumb wheel one is data 0-3

thumb wheel two is data 4-7

etc

but that's for the programmer as a code reference the plc wont use it.

use XIO addressed between TWS/00 to TWS/15

use n7:1/00 as the OTE for XIO tws/00 (up to /03)

use n7:2/00 as the OTE for XIO/04 (up to /07)

use n7:3/00 as the OTE for XIO/10 (up to /13) (not sure if its 0-15 or 0-17)

use n7:4/00 as the OTE for XIO/14 (up to /017)

Now you should end up with 4 words each with one number (call them thumb wheels 1-4)

before putting them back together you then need to move the numbers to there correct position so

n7:1 needs to be times 1000 so 1 becomes 1000 then stored in n7:5

n7:2 needs to be times 100 so 2 becomes 200 then stored in n7:6

n7:3 needs to be times 10 then stored in n7:7

Now n7:4+n7:5+n7:6+n7:7 = n7:8

n7:8 should now contain 1208 in decimal

if you get this piece then use what the others posted earlier about masked moves, bit shifting and math to figure out a better way to end up with the same result.

Joined

·
23 Posts

use XIO addressed between TWS/00 to TWS/15

use n7:1/00 as the OTE for XIO tws/00 (up to /03)

use n7:2/00 as the OTE for XIO/04 (up to /07)

use n7:3/00 as the OTE for XIO/10 (up to /13) (not sure if its 0-15 or 0-17)

use n7:4/00 as the OTE for XIO/14 (up to /017)

Now you should end up with 4 words each with one number (call them thumb wheels 1-4)

before putting them back together you then need to move the numbers to there correct position so

n7:1 needs to be times 1000 so 1 becomes 1000 then stored in n7:5

n7:2 needs to be times 100 so 2 becomes 200 then stored in n7:6

n7:3 needs to be times 10 then stored in n7:7

Now n7:4+n7:5+n7:6+n7:7 = n7:8

n7:8 should now contain 1208 in decimal

if you get this piece then use what the others posted earlier about masked moves, bit shifting and math to figure out a better way to end up with the same result.

Thanks for the tips. This forum by far has the most helpful people out of all that ive ever been on.

Thanks all for your help. Only hope I get the chance to return the deed someday!!!

1 - 17 of 17 Posts

Join the discussion

Electrician Talk

A forum community dedicated to professional electricians, contractors, and apprentices for residential and commercial work. Come join the discussion about trade knowledge, tools, certifications, wiring, builds, scales, reviews, accessories, classifieds, and more!

Full Forum Listing
Recommended Communities

Join now to ask and comment!