{"id":3577,"date":"2025-04-18T12:10:05","date_gmt":"2025-04-18T12:10:05","guid":{"rendered":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?post_type=spl_knowledgebase&#038;p=3577"},"modified":"2025-06-10T11:56:08","modified_gmt":"2025-06-10T11:56:08","slug":"semaphores-bits-and-bytes","status":"publish","type":"spl_knowledgebase","link":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/semaphores-bits-and-bytes\/","title":{"rendered":"Semaphores: Bits and Bytes"},"content":{"rendered":"\n<p>Each of the bytes that makes up the&nbsp;<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o414\">RAM<\/a>&nbsp;memory in SPLat consists of 8 bits. Bit stands for BInary digiT.<\/p>\n\n\n\n<p>One bit is the electronic equivalent of an on\/off switch. It can represent just two values, on and off (or yes\/no or true\/false). Very often the two values are referred to as the numbers 1 and 0.<\/p>\n\n\n\n<p>There are 8 bits in a byte. Why 8 was picked as the magic number is partly historic, partly technical, but that&#8217;s how it is. By convention the bits in a byte are numbered 0-7, starting from the right:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>7<\/td><td>6<\/td><td>5<\/td><td>4<\/td><td>3<\/td><td>2<\/td><td>1<\/td><td>0<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Similarly, the bytes within RAM memory are numbered from 0 up, so the first byte is 0, the 2nd is 1, etc. The number of a byte is called its address.<\/p>\n\n\n\n<p>Consider the following grid, which represents the first few bytes of memory.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>&nbsp;<\/td><td colspan=\"8\">Bit number<\/td><\/tr><tr><th>Byte address<\/th><th>7<\/th><th>6<\/th><th>5<\/th><th>4<\/th><th>3<\/th><th>2<\/th><th>1<\/th><th>0<\/th><\/tr><tr><td>0<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><\/tr><tr><td>1<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><\/tr><tr><td>2<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td><a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/glossary-of-terms\/#o3808\" target=\"_blank\" rel=\"noreferrer noopener\">X<\/a><\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><\/tr><tr><td>3<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The bit marked X is bit 4 in byte 2<\/p>\n\n\n\n<p>Imagine now if we start at the beginning of RAM and number the bits sequentially,&nbsp;<em>not<\/em>&nbsp;starting back at 0 for each byte.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Byte address<\/th><th>7<\/th><th>6<\/th><th>5<\/th><th>4<\/th><th>3<\/th><th>2<\/th><th>1<\/th><th>0<\/th><\/tr><tr><td>0<\/td><td>7<\/td><td>6<\/td><td>5<\/td><td>4<\/td><td>3<\/td><td>2<\/td><td>1<\/td><td>0<\/td><\/tr><tr><td>1<\/td><td>15<\/td><td>14<\/td><td>13<\/td><td>12<\/td><td>11<\/td><td>10<\/td><td>9<\/td><td>8<\/td><\/tr><tr><td>2<\/td><td>23<\/td><td>22<\/td><td>21<\/td><td>X<\/td><td>19<\/td><td>18<\/td><td>17<\/td><td>16<\/td><\/tr><tr><td>3<\/td><td>31<\/td><td>30<\/td><td>29<\/td><td>28<\/td><td>27<\/td><td>26<\/td><td>25<\/td><td>24<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The bit marked X is bit 20 in this new numbering scheme.<\/p>\n\n\n\n<p>Imagine now if we shift the point where we start counting bits from byte address 0 to byte address 2. We get the following table:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Byte address<\/th><th>7<\/th><th>6<\/th><th>5<\/th><th>4<\/th><th>3<\/th><th>2<\/th><th>1<\/th><th>0<\/th><\/tr><tr><td>0<\/td><td>?<\/td><td>?<\/td><td>?<\/td><td>?<\/td><td>?<\/td><td>?<\/td><td>?<\/td><td>?<\/td><\/tr><tr><td>1<\/td><td>?<\/td><td>?<\/td><td>?<\/td><td>?<\/td><td>?<\/td><td>?<\/td><td>?<\/td><td>?<\/td><\/tr><tr><td>2<\/td><td>7<\/td><td>6<\/td><td>5<\/td><td>X<\/td><td>3<\/td><td>2<\/td><td>1<\/td><td>0<\/td><\/tr><tr><td>3<\/td><td>15<\/td><td>16<\/td><td>14<\/td><td>13<\/td><td>12<\/td><td>10<\/td><td>8<\/td><td>8<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The X bit has now become number 4. The bits in bytes 0 and 1 no longer have numbers in this scheme, because negative numbers are too hard to contemplate.<\/p>\n\n\n\n<p>What we have done is to move the&nbsp;<em>base address<\/em>&nbsp;from byte 0 to byte 2. Every semaphore instruction in SPLat allows you to specify a base address as well as the bit number. However, the base address is an optional argument, and if you leave it out it defaults to 0. That means you can happily ignore it if you are content with accessing just the first 32 bytes of RAM (256 bits) as semaphores. If you do use the base address you will be able to get up to 1024 semaphores in 128 bytes of RAM, and you will be able to do interesting things like&nbsp;<a href=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/programming-reference\/instructions-arranged-by-function\/index-register-instructions\/\">indexed addressing<\/a>&nbsp;of semaphores.<\/p>\n\n\n\n<p>Obviously, if you explicitly state the base address you will have to do some advance planning of where you are going to place particular semaphores, both in terms of absolute memory address and relative to the base address you intend to use in your instructions. This applies doubly if you are going to index the base address.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Each of the bytes that makes up the&nbsp;RAM&nbsp;memory in SPLat consists of 8 bits. Bit stands for BInary digiT. One bit is the electronic equivalent&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3574,"menu_order":2,"template":"","class_list":["post-3577","spl_knowledgebase","type-spl_knowledgebase","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Semaphores: Bits and Bytes - SPLat Controls<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Semaphores: Bits and Bytes - SPLat Controls\" \/>\n<meta property=\"og:description\" content=\"Each of the bytes that makes up the&nbsp;RAM&nbsp;memory in SPLat consists of 8 bits. Bit stands for BInary digiT. One bit is the electronic equivalent...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/semaphores-bits-and-bytes\/\" \/>\n<meta property=\"og:site_name\" content=\"SPLat Controls\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-10T11:56:08+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/semaphores-bits-and-bytes\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/semaphores-bits-and-bytes\/\",\"name\":\"Semaphores: Bits and Bytes - SPLat Controls\",\"isPartOf\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\"},\"datePublished\":\"2025-04-18T12:10:05+00:00\",\"dateModified\":\"2025-06-10T11:56:08+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/semaphores-bits-and-bytes\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/semaphores-bits-and-bytes\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/semaphores-bits-and-bytes\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tutorials, application notes and white papers\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Tutorial: Semaphores\",\"item\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Semaphores: Bits and Bytes\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\",\"name\":\"SPLat Controls\",\"description\":\"OEM Embedded Machine Controllers\",\"publisher\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization\",\"name\":\"SPLat Controls\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg\",\"contentUrl\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg\",\"caption\":\"SPLat Controls\"},\"image\":{\"@id\":\"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Semaphores: Bits and Bytes - SPLat Controls","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Semaphores: Bits and Bytes - SPLat Controls","og_description":"Each of the bytes that makes up the&nbsp;RAM&nbsp;memory in SPLat consists of 8 bits. Bit stands for BInary digiT. One bit is the electronic equivalent...","og_url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/semaphores-bits-and-bytes\/","og_site_name":"SPLat Controls","article_modified_time":"2025-06-10T11:56:08+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/semaphores-bits-and-bytes\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/semaphores-bits-and-bytes\/","name":"Semaphores: Bits and Bytes - SPLat Controls","isPartOf":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website"},"datePublished":"2025-04-18T12:10:05+00:00","dateModified":"2025-06-10T11:56:08+00:00","breadcrumb":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/semaphores-bits-and-bytes\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/semaphores-bits-and-bytes\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/semaphores-bits-and-bytes\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/"},{"@type":"ListItem","position":2,"name":"Tutorials, application notes and white papers","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/"},{"@type":"ListItem","position":3,"name":"Tutorial: Semaphores","item":"https:\/\/webprojects.cloud\/wordpress\/splatco\/knowledgebase\/tutorials-application-notes-and-white-papers\/tutorial-semaphores\/"},{"@type":"ListItem","position":4,"name":"Semaphores: Bits and Bytes"}]},{"@type":"WebSite","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#website","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/","name":"SPLat Controls","description":"OEM Embedded Machine Controllers","publisher":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webprojects.cloud\/wordpress\/splatco\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#organization","name":"SPLat Controls","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/","url":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg","contentUrl":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-content\/uploads\/2024\/10\/logo.svg","caption":"SPLat Controls"},"image":{"@id":"https:\/\/webprojects.cloud\/wordpress\/splatco\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase\/3577","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase"}],"about":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/types\/spl_knowledgebase"}],"author":[{"embeddable":true,"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/users\/1"}],"up":[{"embeddable":true,"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/spl_knowledgebase\/3574"}],"wp:attachment":[{"href":"https:\/\/webprojects.cloud\/wordpress\/splatco\/wp-json\/wp\/v2\/media?parent=3577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}