Jump to content
Sign in to follow this  
VisSim Forum Archives

In the constant block I see the value 0x10 = 16. Why?

Recommended Posts

Submitted by Anders89 on Wed, 09/07/2011 - 18:18.

The constant blocks, like other VisSim blocks, accept C syntax. C uses a 0x prefix as indicating hex notation (a base 16 number). Base 16 can be useful when looking at bit patterns in binary words. Since 16 is a power of 2, each hex digit maps to the same 4-bit pattern shifted by 4*digit position. For instance, 0xF0F is 4 upper bits all 1, 4 middle bits zero and 4 lower bits all 1. This is handy when manipulating bits on an embedded target.
Also, hex numbers are always integer typed. So prefixing with 0x is an easy way to create an integer constant in VisSim.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...