Sign in to follow this  
Followers 0
axledeep

BCD to Binary - Double Word Conversion CPM1A

9 posts in this topic

Hi folks! Is there a long-hand way to do BINL (double BCD to double BIN) conversion in the CPM1A? CPM1A only has the BIN instruction. Regards, Axle

Share this post


Link to post
Share on other sites
Hi, Is your BCD dble word higher than 65535? Just curious, what do you want to do with dble binary word? In CPM1A there is no dble binary math...

Share this post


Link to post
Share on other sites
Yes, the BCD number can get as high as 10 million. This number will represent number of parts produced in a batch. Then, I have to convert the 2 BCD words to 2 BIN words for QuickPanel read. The QP is expecting 2 words in binary format. Regards, Axle

Share this post


Link to post
Share on other sites
Maybe that it is possible, but not easy because, like i said, there is no dble binary math available in it. I think i can help but i have some more questions: Where come from your BCD value? Is it result of incrementing instruction, result of BCD math, or something else? Can you work it as hex value instead of BCD ?....this way you could increase of 1 the "high" word each time that the "low" word reach #FFFF Edited by pfort

Share this post


Link to post
Share on other sites
Maybe you could break the values up into 1000ths? Then have the display read 2x words instead?

Share this post


Link to post
Share on other sites
I am incrementing a counter. Counter is expressed in BCD (1 word only). To get a count greater than 9999, I am incrementing a secondary counter that increments every 10,000 parts counted. In other words, when the primary counter reaches 9999BCD, then I increment secondary counter by one, reset the primary counter, then start counting again. For the total count in BCD, I multiply 9999BCD with the secondary counter number then add the primary counter number. This gives me a total part count in double word BCD. However, I need to convert the double word BCD to BIN so that the Quickpanel can read properly.....Now, as I am writing this and review your questions, it reminded me of something I learned a few weeks ago while studying the QuickPanel manual. For every tag defined, you need to enter the address AND the data type...that is, integer, bit, etc. Well, lo and behold, there is also one for 32-bit BCD. So, although I found a solution, it probably would not have been found if I did not bounce the ideas of of you guys. BTW, I have already decided to go with the CPM2A as an upgrade since it allows BINL and has an RS232 port which frees up my peripheral port. LIFE IS GOOD Thanks much Axle

Share this post


Link to post
Share on other sites
I would consider going to the CP1L rather than the CPM2A - it has an awesome list of functions - same as the CS1 and CJ1 - even includes 64 bit floating point. You can also make all your counters and timers binary rather than BCD. The CP1L is also cheaper in Ozz than the CPM1A let alone the CPM2A. The future not the past. Edited by BobB

Share this post


Link to post
Share on other sites
200Thanks for the advice BobB. Footprint is extremely tight....and what we have in stock is also a point I need to weigh in. We have C20's (ick), CPM1/2, C200H's, and CJ1's on our production floor and stocked. I wanted to go with the CJ1 initially but after loading up the stack with I/O's, I'd be out of room, not to mention the special high speed counter I need in my application. The CPM2A-30 gives me the tight footprint and an RS 232 port which will be connected to the QuickPanel. Regards, Axle Edited by axledeep

Share this post


Link to post
Share on other sites
Hi Axle The CP1 is the same footprint as the CPM1A - even uses CPM1A expansion blocks. You can mount either 1 or 2 serial ports in the front of the unit - dependant on the unit. With some of them you can even use some of the CJ1 cards as expansion. USB cable for programming - use it and you will never want to go back to plain serial. The CJ2M is also on the way - have not seen full specs yet but will probably be very good. Recommend you at least have a good look. Edited by BobB

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0