Variables y números binarios

Variables

Las variables contienen un valor representado por un código numérico o alfanumérico. El sistema de numeración que usamos las personas es un sistema decimal. Esto quiere decir que existen 10 símbolos diferentes los cuales son combinados para construir cualquier número. Estos 10 símbolos son los número del 0 al 9. Por ejemplo para representar el número 121 en decimal se hace la siguiente operación:

1×102+2×101+1×100=100+20+1=121

En el ejemplo se puede observar que para que para obtener el número se toma el símbolo de cada posición (que puede ser cualquiera entre 0 y 9), se multiplica por la base (10 para sistema decimal por sus 10 símbolos) elevada a la posición en que se encuentre el símbolo comenzando desde el número 0. En otras palabras el símbolo en la posición cero se multiplica por 1 (100 =1), el símbolo en la segunda posición se multiplica por 10 (101=10), el símbolo de la tercera posición se multiplica por 100 (102=100) y así sucesivamente.

Sistema de numeración binario

El sistema de numeración binario funciona de forma similar al sistema de numeración decimal, con la diferencia que en el sistema binario la cantidad de símbolos son dos, el 0 y el 1. Por ejemplo para representar el número 121 en binario se hace la siguiente operación:

1×26+1×25+1×24+1×23+0x22+0x21+1×20= 64+32+16+8+0+0+1=121

La representación del número 121 en binario es 1111001b. La “b” al final es para indicar que la representación está en binario y diferenciarlos de un millón ciento once mil uno en decimal. En este punto se pueden estar preguntando cómo se obtuvo el patrón de unos y ceros para la representación del 121 en binario, hay varias formas para hacer esto, una muy sencilla es ir colocando 1’s de izquierda a derecha progresivamente, si al colocar un 1 en determinada posición y el valor supera al valor buscado, entonces esa posición lleva un valor de cero. Para el ejemplo anterior si comenzamos con un 1 en la posición 7 el valor obtenido es 127 el cual es mayor que 121, por esa razón comenzamos con un 1 en la posición 6. La siguiente tabla resume el procedimiento

Posición Suma acumulada Valor en la posición
6 2posición=26=64 1
5 64+32=96 1
4 96+16=112 1
3 112+8=120 1
2 120+4=124 > 121 0
1 120+2=122 >121 0
0 120+1=121 1

 

Numero de bits

A cada posición (o dígito) de un número binario también se le llama bit, en el caso del ejemplo anterior el número 121 es representado con 7 bits. El número de bit es importante por determina el rango de valores que puede tener un número binario, por ejemplo, un número de 8 bits puede tener un valor que va desde 0 hasta 255 (2n-1), donde n es el número de bits). Desde el punto de vista de la electrónica, el hecho de que cada dígito o bit tenga sólo dos valores es muy importante, esto le da una simplicidad a cada dígito que puede ser representado como un interruptor abierto o cerrado, o con un transistor en corte o saturación, o con un LED prendido o pagado entre otras opciones.

Códigos

La combinaciones de 1’s y 0’s también sirven para representar códigos, como por ejemplo el código ASCII. Por ejemplo el número 01111001b representa el número 121, representa la letra “y” en el código ASCII y representa el número 79 en código BCD entre otros.

Tipos de variables

La importancia de los números binarios en el uso de los PLC radica en el hecho que los microprocesadores con los cual se construyen realizan todos sus operaciones usando como argumentos variables binarias. Estas variables binarias puede ser de diferentes tipos, los más usados son: booleana o bit, enteros, punto flotante y caracteres o cadena de caracteres. Las variables enteras y de punto flotante son llamadas variables analógicas.

Variables Booleanas

También llamadas lógicas o de bit, son representaciones binarias de un solo bit o con un solo dígito, en tal sentido, sólo pueden tener los valores de 0 o 1, que normalmente son interpretados como falso o verdadero respectivamente.

Enteros

Son registros de memoria que pueden almacenar números de n bit, donde n, típicamente, es múltiplo de 2. Así podemos tener variables enteras de 4 bits, 8 bits, 16 bits, 32 bits y 64 bits. El número de bits, como se mencionó antes, determina el rango de los valores que puede tener la variable.

Cuando se representa números binarios, a veces se representas números positivos y el cero, a este código se le denomina binario puro; pero también se pueden representar valores negativos, positivos y el cero, a este código se le denomina binario en complemento a dos. Dependiendo del número de bits se le puede asignar un nombre al entero, por ejemplo un entero de 8 bit es también llamado byte. La siguiente tabla muestra el un resumen de numero de bit y su rango.

Numero de bits Rango binario Rango binario complemento a dos
4 (nibble) 0 a 15 -8 a 7
8 (byte) 0 a 255 -128 a +127
16 0 a 65.535 -32,768 a +32,767
32 0 a 4.294.967.295 -2,147,483,648 a +2,147,483,647
64 0 a 18.446.744.073.709.551.615 -9.223.372.036.854.775.808 a +9.223.372.036.854.775.807

Punto flotante

También llamadas reales, pueden contener número con decimales. La representación en punto flotante se hace con estándares como IEEE 754. Con este estándar y precisión simple se pueden representar número desde  -1.17549449×10-38 hasta 3.40282346×1038.

Carácter

Un carácter es un símbolo de la tabla ASCII (letras, números, símbolos y caracteres de control) representado con 8 bits, a la concatenación de varios caracteres se le llama cadena de caracteres y se usan para formar palabra o frases.

132 Comentarios

  1. Moemate AI chat

    Hey, thanks for the blog.Really thank you! Great.

    Responder
  2. ميكنج ارت تمبلت

    I’d must examine with you here. Which isn’t one thing I normally do! I enjoy reading a submit that may make folks think. Also, thanks for permitting me to comment!

    Responder
  3. Danmajet

    Really informative blog article.Really looking forward to read more. Fantastic.

    Responder
  4. Status AI

    Thanks a lot for the blog.Much thanks again. Will read on…

    Responder
  5. Taxi san bay cam ranh

    It is actually nearly impossible to come across well-qualified men or women on this matter, even though you appear like you be aware of which you’re indicating! Excellent

    Responder
  6. 佳文网

    Enjoyed every bit of your article.Much thanks again. Awesome.

    Responder
  7. 云顶按摩

    Great blog.Thanks Again. Fantastic.

    Responder
  8. grinding machine

    I am so grateful for your blog post.Much thanks again. Really Cool.

    Responder
  9. Ajfeea

    buy prilosec generic – order generic prilosec 20mg buy tenormin

    Responder
  10. Plastic Mold manufavturer

    I loved your blog post.Really thank you! Fantastic.

    Responder
  11. Luoi Thep Han

    This is a topic that is close to my heart… Take care! Where can I find the contact details for questions?

    Responder
  12. leon arcade machine

    I think this is a real great article post.Thanks Again. Keep writing.

    Responder
  13. Jasa Kelola TikTok

    I am sure this article has touched all the internet visitors, its reallyreally pleasant post on building up new blog.

    Responder
  14. dich vu ke toan thue

    However, Leech Ninja is an efficient Premium link Generator, it supports NitroFlare, Keep2Share, and Uploaded.

    Responder
  15. Mjs Body Filler

    Major thankies for the article.Really looking forward to read more. Really Great.

    Responder
  16. Nha hang Nhat

    tamoxifen vs raloxifene nolvadex – tamoxifen for men

    Responder
  17. click here

    Hi there, yes this paragraph is genuinely fastidious and I have learnedlot of things from it concerning blogging. thanks.

    Responder
  18. SKIN BOOSTER

    This is one awesome blog article.Thanks Again. Want more.

    Responder
  19. than gao dua

    Has anyone ever tried Valhalla eLiquid Eliquid?

    Responder
  20. rotontek.com

    Thank you for your blog post.Thanks Again. Cool.

    Responder
  21. Prodentim

    ivermectin and covid 19 ivermectin horse wormer tractor supply

    Responder
  22. Tonic Greens

    store locator lloyds pharmacy online pharmacy no scripts

    Responder
  23. Mitolyn

    This is the perfect blog for anybody who hopes to find out about this topic.You definitely put a brand new spi on atopic which has been discussed for decades.Wonderful stuff, just excellent!

    Responder
  24. Prime Biome

    Thanks, I have just been searching for info approximately this topic for a long time and yours is the greatest I’ve found out so far. But, what concerning the bottom line? Are you positive concerning the source?

    Responder
  25. Radiant

    Muchos Gracias for your blog article.Really thank you! Fantastic.

    Responder
  26. Prime Biome

    I was recommended this blog by way of my cousin. I am no longer sure whether this submit is written via him as no one else realize such special about my trouble. You’re amazing! Thank you!

    Responder
  27. SciatiSoothe

    Hi there! Do you use Twitter? I’d like to follow you if that would be okay. I’m absolutely enjoying your blog and look forward to new posts.

    Responder
  28. fillersfairy Botulax

    Very good blog article.Thanks Again. Fantastic.

    Responder
  29. to learn more

    Hi there! This post could not be written any better!Looking at this post reminds me of my previous roommate!He constantly kept talking about this. I’ll send this articleto him. Pretty sure he’ll have a great read. Many thanks for sharing!

    Responder
  30. ligong motor

    Major thankies for the article.Really looking forward to read more. Cool.

    Responder
  31. spark-bearing

    Im thankful for the article.Much thanks again. Great.

    Responder
  32. Huijue Energy

    I think this is a real great blog post.Thanks Again. Will read on…

    Responder
  33. Status AI

    Muchos Gracias for your article.Much thanks again. Fantastic.

    Responder
  34. volkswagen parts oem

    Wow that was unusual. I just wrote an very long comment but after I clicked submit mycomment didn’t appear. Grrrr… well I’m not writing all that over again. Regardless, just wanted to say great blog!

    Responder
  35. Status game

    I cannot thank you enough for the blog article.Really thank you! Want more.

    Responder
  36. Solar Panels

    A round of applause for your article.Much thanks again.

    Responder
  37. Solar Panels

    This is one awesome article post.Really looking forward to read more. Fantastic.

    Responder
  38. ip2world login

    Im obliged for the article. Cool.

    Responder
  39. ip2world login

    Major thankies for the blog article. Want more.

    Responder
  40. 實時博彩網站

    I really liked your blog. Really Cool.

    Responder
  41. 六合彩

    Appreciate you sharing, great blog post.Really thank you! Really Great.

    Responder
  42. Alphonso mango Online

    Appreciate you sharing, great blog article.Much thanks again. Fantastic.

    Responder
  43. Obpnee

    purchase cenforce generic – generic aralen oral metformin

    Responder
  44. togel4d register

    There is definately a great deal to find out aboutthis subject. I really like all of the points you made.

    Responder
  45. vw classic parts

    Hello i am kavin, its my first occasion to commentinganywhere, when i read this article i thought i could also create comment due to this goodparagraph.Feel free to visit my blog post … ac rentals

    Responder
  46. vw classic parts

    I will immediately seize your rss feed as I can not in finding youremail subscription link or e-newsletter service.Do you have any? Please allow me know in orderthat I may just subscribe. Thanks.

    Responder
  47. 网页版whatsapp

    Muchos Gracias for your blog post.Thanks Again. Keep writing.

    Responder
  48. vw classic parts

    Hello my family member! I want to say that this post is amazing, nice written and comewith almost all significant infos. I wouldlike to see extra posts like this .

    Responder
  49. whatsapp官网网页版

    Im thankful for the blog article. Really Cool.

    Responder
  50. Dich vu Tiktok

    Aw, this was an extremely nice post. Takingthe time and actual effort to generate a really good article… but what can I say… I hesitate a whole lotand never manage to get nearly anything done.

    Responder
  51. Laptop xach tay My

    I’d really like to be a part of onlinecommunity where I can get advice from other experienced people that share the same interest.

    Responder
  52. Original Plinko Game

    Major thanks for the article post.Really looking forward to read more. Will read on…

    Responder
  53. sex dolls

    A big thank you for your blog post.Really looking forward to read more.

    Responder
  54. 佳文网

    Im obliged for the post.Thanks Again. Cool.

    Responder
  55. 토지노솔루션

    Im grateful for the blog post.Thanks Again. Awesome.

    Responder
  56. 토지노솔루션임대

    Great, thanks for sharing this blog post.Really looking forward to read more. Cool.

    Responder
  57. Fdqzsl

    generic tadalafil 5mg – sildenafil pills viagra 100mg brand

    Responder
  58. gas mask

    Thanks for the blog. Fantastic.

    Responder
  59. 博彩广告

    Im obliged for the article post.Thanks Again. Will read on…

    Responder
  60. pubg uc buy

    I loved your blog post.Thanks Again. Awesome.

    Responder
  61. Pgtlug

    tizanidine uk – purchase hydrochlorothiazide pill purchase microzide pill

    Responder
  62. I really liked your article post. Will read on…

    Responder
  63. diwali scented diyas

    Thanks-a-mundo for the post.Thanks Again. Will read on…

    Responder
  64. welding kit

    I am so grateful for your blog post.Really thank you! Really Cool.

    Responder
  65. 오피스타 홈페이지

    Thank you ever so for you article post.Much thanks again. Great.

    Responder
  66. 오피스타 홈페이지

    Thanks a lot for the blog post.Thanks Again. Cool.

    Responder
  67. 深圳怡康婦產醫院地址

    Really enjoyed this article post. Want more.

    Responder
  68. Ctmsdm

    buy semaglutide 14mg generic – order levitra 20mg sale purchase cyproheptadine pill

    Responder
  69. Jinhong Gas products

    I truly appreciate this post.Thanks Again.

    Responder
  70. Best workout bike for home

    I appreciate you sharing this article post.Really thank you! Want more.

    Responder
  71. usmle step 2 ck prep course

    Excellent way of describing, and nice piece of writing to obtain facts about my presentation subject matter, which i am going to present in institution of higher education.

    Responder
  72. Explore now

    stromectol ebay – fda ivermectin ivermectin 1

    Responder
  73. nsfw ai

    Thank you ever so for you article.Really looking forward to read more. Great.

    Responder
  74. nsfw ai chat

    Hey, thanks for the blog. Really Great.

    Responder
  75. SheTopper Eyewear

    I am so grateful for your blog post. Fantastic.

    Responder
  76. pyproxy download

    I value the article. Want more.

    Responder
  77. Plate Compactor

    Im grateful for the article post.Thanks Again. Much obliged.

    Responder
  78. FTTx solution provider

    Very good blog.Really looking forward to read more.

    Responder
  79. 实用文

    Thank you ever so for you article.Really looking forward to read more. Cool.

    Responder
  80. Vmjddf

    buy clavulanate sale – buy cymbalta for sale buy cymbalta online cheap

    Responder
  81. ice water hack recipe

    What’s up mates, its fantastic paragraph about teachingand fullyexplained, keep it up all the time.

    Responder
  82. Ikugxt

    order neurontin 100mg for sale – anafranil 25mg generic buy generic sporanox

    Responder
  83. best security systems for homes in indianapolis

    Some times its a pain in the ass to read what people wrote but this web site is rattling user friendly! .

    Responder
  84. 派傳單

    What’s up, its fastidious post about media print, we all understand media is a wonderful sourceof data.

    Responder
  85. Desierto de la Tatacoa con niños

    Looking forward to reading more. Great article.Really looking forward to read more. Keep writing.

    Responder
  86. best geek bar flavors

    Enjoyed every bit of your article post.Thanks Again. Want more.

    Responder
  87. Commodore 64 Games

    Wow that was unusual. I just wrote an really long comment but after I clicked submit my comment didn’t show up. Grrrr… well I’m not writing all that over again. Anyhow, just wanted to say fantastic blog!

    Responder
  88. gas mask

    Thank you ever so for you blog.Really thank you!

    Responder
  89. Wkqktc

    order prednisolone 40mg without prescription – buy azipro 250mg pills generic prometrium

    Responder
  90. 출장마사지

    Major thanks for the article.Really looking forward to read more. Awesome.

    Responder
  91. Betty and Veronica

    Howdy! This post couldn’t be written any better!Reading this post reminds me of my good old room mate! He always kept talking about this.I will forward this post to him. Fairly certain he will have a good read.Thanks for sharing!

    Responder
  92. Wnayoc

    buy azithromycin 250mg – cheap tinidazole order nebivolol 20mg online cheap

    Responder
  93. salt trick for men reviews

    chloroquine otc hydroxychloroquine update today hsq medical abbreviation

    Responder
  94. onlyfans 18+

    I’ll right away clutch your rss as I can’t find your e-mail subscription link or newsletter service. Do you’ve any? Please let me recognize so that I may subscribe. Thanks.

    Responder
  95. togel4d register

    I like what you guys are usually up too. Such clever work and exposure!Keep up the excellent works guys I’ve included you guys toour blogroll.

    Responder
  96. 18+ porn

    What’s Hot On MediaKombat: Video – Famous Dex – Crazy me(shot by @cadencampise)

    Responder
  97. crazy porn

    Its actually a great and helpful piece of information. I am happy that you just shared this useful information with us. Please keep us up to date like this. Thanks for sharing.

    Responder
  98. usa porn

    Bardzo interesujące informacje! Idealnie to, czego szukałem! przenośny generator tlenu.

    Responder
  99. Baixi Can Industry

    I really liked your blog article.Thanks Again.

    Responder
  100. Zhenxi Metal Packaging

    This is one awesome blog.Thanks Again. Fantastic.

    Responder
  101. Mua like

    These are genuinely wonderful ideas in aboutblogging. You have touched some pleasant things here. Any waykeep up wrinting.My blog – MaxBHB

    Responder
  102. water bong

    Im obliged for the blog post.Much thanks again. Keep writing.

    Responder
  103. squid porn

    That is a very good tip especially to those fresh to the blogosphere. Short but very precise infoÖ Thanks for sharing this one. A must read post!

    Responder
  104. Hack like

    I like foregathering useful information, this post has gotme even more info!My blog post … Instant Keto Review

    Responder
  105. Najlepsze kasyna online w Polsce

    Hey, have you ever before wondered to write regarding Nintendo or PS handheld?

    Responder
  106. fillersfairy

    Looking forward to reading more. Great article.

    Responder
  107. therapeutic and regular massagers

    Really appreciate you sharing this blog article.Really looking forward to read more.

    Responder
  108. linkin love ai

    Fantastic blog article. Cool.

    Responder
  109. bokep jahanam

    I’m truly enjoying the design and layout of your blog. It’s a very easy on the eyes which makes it much more pleasant for me to come here and visitmore often. Did you hire out a designer to createyour theme? Exceptional work!

    Responder
  110. linkin love

    Awesome blog.Really looking forward to read more. Awesome.

    Responder
  111. Dumpster rental near me

    Very neat blog article.Thanks Again. Awesome.

    Responder
  112. china Dropshipping

    Major thankies for the article post.Much thanks again. Keep writing.

    Responder
  113. biyapay官网

    This is one awesome blog post.Really thank you! Will read on…

    Responder
  114. Distribution Transformer

    wow, awesome article.Really looking forward to read more.

    Responder
  115. CNC Milling Parts

    I really liked your article post.Much thanks again. Great.

    Responder
  116. xxx porn

    Thanks for finally talking about >Qui Chế của Diễn Đàn Vijaya – ILIMOCHAMPA

    Responder
  117. cheap seo

    fantastic issues altogether, you simply won a new reader.What could you suggest about your submit that you just made some days ago?Any positive?

    Responder
  118. mua like facebook

    These are genuinely great ideas in concerning blogging. You have touched some pleasant points here. Any way keep up wrinting.

    Responder
  119. 貼街招

    It’s hard to come by knowledgeable people for this subject, however, you sound like you know what you’re talking about! Thanks

    Responder
  120. bokep mantap

    chloroquine otc hydroxychloroquine update today hsq medical abbreviation

    Responder
  121. cod voucher

    I do not even know how I stopped up right here, but I believed this publish was once good. I don’t understand who you might be however definitely you’re going to a famous blogger for those who are not already 😉 Cheers!

    Responder
  122. medartix.com

    Really enjoyed this post.Much thanks again. Want more.

    Responder
  123. Fosdyb

    amoxil online buy – amoxicillin tablets order ipratropium without prescription

    Responder
  124. social anxiety treatment

    F*ckin’ tremendous issues here. I am very glad to peer your article. Thank you so much and i am looking forward to contact you. Will you kindly drop me a e-mail?

    Responder
  125. Nuateo

    purchase isotretinoin – buy zyvox 600 mg pills oral linezolid 600mg

    Responder
  126. Tnttjq

    ivermectin cost – carbamazepine 400mg price order carbamazepine pill

    Responder
  127. conversion probability

    Hi, just required you to know I he added your site to my Google bookmarks due to your layout. But seriously, I believe your internet site has 1 in the freshest theme I??ve came across. It extremely helps make reading your blog significantly easier.

    Responder
  128. la olada

    A powerful share, I just given this onto a colleague who was doing a little bit evaluation on this. And he in truth bought me breakfast as a result of I discovered it for him.. smile. So let me reword that: Thnx for the treat! However yeah Thnkx for spending the time to debate this, I feel strongly about it and love studying more on this topic. If possible, as you grow to be experience, would you mind updating your blog with extra details? It is extremely useful for me. Big thumb up for this blog put up!

    Responder
  129. lawn mow near me

    Hello there, I found your blog via Google while looking for a related topic, your site came up, it looks good. I have bookmarked it in my google bookmarks.

    Responder
  130. Branko Kajtazi

    I conceive this website holds some real superb information for everyone : D.

    Responder
  131. gelules cannabidiol

    It’s really a great and useful piece of information. I am glad that you simply shared this helpful information with us. Please stay us informed like this. Thanks for sharing.

    Responder
  132. zoritoler imol

    I always was interested in this subject and stock still am, thanks for putting up.

    Responder

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *