Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7557257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:05:08+00:00 2026-05-30T12:05:08+00:00

This question is derived from my previous SO question’s commends . I am confused

  • 0

This question is derived from my previous SO question’s commends.

I am confused with PLC’s interpretation of BCD and decimal.
In a PLC documentation, it somehow implies BCD = decimal:

enter image description here

The instruction reads the content of D300, 0100, as BCD. Referring to Cyber Slueth Omega’s answer and online BCD-Hex converter, 0100 (BCD) = 4 (Decimal) = 4 (Hex), but the documentation indicates 0100 (BCD) = 100 (Decimal).

Why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:05:11+00:00Added an answer on May 30, 2026 at 12:05 pm
    • BCD is HEX
    • BCD is not binary
    • HEX is not binary
    • BCD and HEX are representations of binary information.

    The only difference is in how you decide to interpret the numbers. Some PLC instructions will take a piece of word memory and will tell you that “I, the TIM instruction, promise to treat the raw data in D300 as BCD data”. It is still HEX data, but it interprets it differently.

    If D300 = [x2486] –> the timer (as example) will wait 248.6 seconds. This even though HEX 2486 = 9350 decimal. You can treat hex data as anything. If you treat hex data as encoded BCD you get one answer. If you treat it as a plain unsigned binary number you get another, etc.

    If D300 = [x1A3D] –> TIM will throw an error flag because D300 contains non-BCD hex digits

    Further, the above example is showing HEX digits – not BINARY digits. It is confusing because they chose [x0100] as their example – only zeroes and ones. When you are plugging this into your online converter you are doing it wrong – you are converting binary 0100 to decimal 4. Hexadecimal is not binary – hex is a base16 representation of binary.

    Anatomy of a D-memory location is this

    16 Bits     | xxxx | xxxx | xxxx | xxxx |  /BINARY/
       --->        |      |      |      |
    4 bits/digit   D4     D3     D2     D1     /HEX/
    
    example 
    D300 = 1234 | 0001 | 0010 | 0011 | 0100 |
       ---->       1      2      3       4
    
    example 
    D300 = 2F6B | 0010 | 1111 | 0110 | 1011 |
       ---->       2      F      6       B
    
    example (OP!)
    D300 = 0100 | 0000 | 0001 | 0000 | 0000 |
       ---->       0      1      0       0
    

    A D-memory location can store values from x0000 -> xFFFF (decimal 0-65535). A D-memory location which is used to store BCD values, however, can only use decimal digits. A->F are not allowed. This reduces the range of a 16-bit memory location to 0000->9999.

    Counting up you would go :

    Decimal    BCD      HEX
    1         0001      0001
    2         0002      0002     
    3         0003      0003
    4         0004      0004
    5         0005      0005
    6         0006      0006
    7         0007      0007
    8         0008      0008
    9         0009      0009
    10        0010      000A
    11        0011      000B
    12        0012      000C
    13        0013      000D
    14        0014      000E
    15        0015      000F
    16        0016      0010
    17        0017      0011
    18        0018      0012
    19        0019      0013
    20        0020      0014
    ...etc
    

    Going the other way, if you wish to pass a decimal value to a memory location and have it stored as pure hex (not BCD hex!) you use the ‘&’ symbol.

    For example -> [MOV #123 D300]

    This moves HEX value x0123 to memory location D300. If you use D300 in a future operation which interprets this as a hexadecimal number then it will have a decimal value of 291. If you use it in an instruction which interprets it as a BCD value then it will have a decimal value of 123.

    If instead you do [MOV &123 D300]

    This moves the decimal value 123 to D300 and stores it as a hexadecimal number -> [x007B]! If you use D300 now in a future operation which interprets this as a hexadecimal number it will have a decimal value of 123. If you try to use it in an instruction which interprets it as a BCD value you will get an ERROR because [x007B] contains the hex digit ‘B’ which is not a valid BCD digit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is derived from: How to get this Method object via reflection? I'm
This question is derived from the topic: vector reserve c++ I am using a
derived from this question , is it possible to use HQL or Criteria for
This question is a follow up to my previous question about getting the HTML
This question is about removing sequences from an array, not duplicates in the strict
This is a follow-on question to C++0x rvalue references and temporaries In the previous
Simplified from this question and got rid of possible affect from LinqPad(no offsensive), a
Generally this question comes from Eclipse suggesting to add a serial version UID on
This must be a classic .NET question for anyone migrating from Java. .NET does
Following on from my previous question I have been working on getting my object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.