585,717 active members*
4,024 visitors online*
Register for free
Login
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2006
    Posts
    1792

    BIN and BCD functions

    I was trying to figure out what these are. I understand the following (from the manual):
    BIN: converts BCD (Binary Coded Decimal) format to binary format
    BCD: converts binary format to BCD format

    While experimentibg on 0iTC, I found the following:
    BIN [41] returns 29.000
    BCD [29] returns 41.000
    BIN [10] illegal argument
    BCD [1000] returns 4096.000
    BCD[1000000] returns 16777216.
    BCD[a negative value] illegal argument
    BCD [fractional value] rounding to the nearest integer is automatically done, and then function is evaluated.
    etc.

    I could not derive any logic out of it. Can somebody please these explain these function is some detail.

  2. #2
    Join Date
    Jan 2007
    Posts
    42
    In binary coding each bit represents a power of two. In BCD the bits are grouped in fours and each group of four represents a decimal digit.

    The numeric parameter is always converted to binary and then passed to the functions so:

    BIN[41]: 41 in binary is 101001, interpreted in BCD that is 0010, 1001 i.e. 29.
    BCD[29] 29 in BCD is 0010, 1001, intepreted in binary is 101001 , i.e. 32+9 =41
    BIN[10] is illegal because binary 10 is 1010 which is not a BCD digit.
    BCD[1000] is 0001 0000 0000 0000 which is 2^12 i.e. 4096 when interpreted in binary.
    BCD[1000000] is 2^24

  3. #3
    Join Date
    Feb 2006
    Posts
    1792
    Thanks.
    So, BIN converts a binary number to BCD
    and BCD converts a BCD to binary.
    Peter Smid also says the same thing in his book, but Fanuc manual says the opposite:
    (from Operator's Manual 0i Tc, page 266)
    Conversion from BCD to BIN, #i = BIN [#j];
    Conversion from BIN to BCD, #i = BCD [#j];

    This is the result of Japanese to English translation.

  4. #4
    Join Date
    Jan 2007
    Posts
    42
    No BIN converts a BCD number to binary. BCD converts binary to BCD.

    The really confusing thing is that your input and output functions in the examples are always converting ascii to binary and binary to ascii. When you do BCD[29] the text 29 is converted to binary 11101 (16 + 8 + 4 + 1). The BCD function converts it to the BCD representation of 29 which 0010 1001. That is converted back to ascii to print the result but the conversion does not know it should be interpreted in BCD so it shows its binary value which is 32 + 8 + 1 = 41.

    The BCD representation only makes sense if it is sent to something that expects it to be BCD, for example the BIN function.

  5. #5
    Join Date
    Feb 2006
    Posts
    1792
    Thanks again.
    Somebody told me that these functions have something to do with the interface signals, for the purpose of interacting with external devices connected to CNC. Can you please give just one example of these functions.

  6. #6
    Join Date
    Jan 2007
    Posts
    42
    Sorry I have no idea why CNC would need them, it must be to interface to something that uses BCD.

Similar Threads

  1. Many V23 Functions do not work
    By orbimachine in forum BobCad-Cam
    Replies: 3
    Last Post: 12-21-2008, 11:06 AM
  2. Mastercam X3 new functions
    By cnc metalcraft in forum Mastercam
    Replies: 11
    Last Post: 06-14-2008, 01:43 PM
  3. Spare M functions
    By 1ctoolfool in forum Haas Mills
    Replies: 5
    Last Post: 01-14-2008, 05:08 PM
  4. BP functions
    By Mr. Technical in forum Bridgeport / Hardinge Mills
    Replies: 6
    Last Post: 11-07-2007, 06:02 AM
  5. re-enter m-functions?
    By XXF in forum CNC (Mill / Lathe) Control Software (NC)
    Replies: 2
    Last Post: 08-08-2006, 04:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •