Gray Code

In: Computers and Technology

Submitted By debarpandan
Words 1010
Pages 5
What is Gray code?

From Wikipedia
The reflected binary code, also known as Gray code after Frank Gray, is a binary numeral system where two successive values differ in only one bit.

The reflected binary code was originally designed to prevent spurious output from electromechanical switches. Today, Gray codes are widely used to facilitate error correction in digital communications such as digital terrestrial television and some cable TV systems.

One good way to explain the use of Gray code is to take a look at how a hard drive work, in extreme simplicity.
A hard drive contains a disc where information is stored. The information on the disc is stored in ones and zero´s, binaries. The disc is divided into sections which each has a binary signature.

Here is a picture to explain:

As we can see here, section 0 for example has the binary signature 0000 and section 15 has the binary signature 1111. When a hard drive is running it reads section by section and if the hard drive for some reason has a failure and the reader jumps from section 15 to section 0 the reading changes from 0000 to 1111 which means that every bit read is faulty.
This could change alot depending on how the information is parsed.

A hard drive could be exposed to a lot of external forces and the reader can jump and missread at any time. This cannot be forseen, but it can be prevented to some extent.
Enter Gray code.

Gray code is a way to sort the binaries so that one binary never differs more than one bit from another. This is good news compared to the drastic differance between 0000 and 1111.
If we look at a 4-bit value in ordinary binary form and in Gray code form we can see some patterns. The changes in each binary string is bolded:
Decimal Binary Gray code
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100…...

Similar Documents


...Pseudocode syntax, descriptions and examples Overview: This table provides a reference for commonly used pseudocode for introductory computer program design courses. You should use this as your reference and copy and paste code examples into your projects to ensure you are using proper syntax. Be sure to indent your code to make it more readable and use modify and enhance from the examples as needed. Also, capitalize the first letter of your pseudocode (e.g. While, not while). Pseudocode Write/Prompt Description Displays messages and other information on the screen Flowchart equivalent Write “What is your name?” Input Pauses execution, allowing the user to enter data Input FirstName Input FirstName Compute/Set Assigns a value to a variable Set Avg=(num1+num2)/2 Declare Example usage Write “What is your name?” Write “Your name is “ +YourName + “.” Prompt for ItemName, Price, Quantity Declares a variable to be of a specific type Input Number1, Number2 Compute average value: Set Avg= (num1 + num2)/2 Compute total cost: Set TotalCost= 1.25*Songs Declare FirstName As String Declare FirstName as String Declare Num1, Num2 As Integer Possible datatypes may include: String 1 Call Requests a module, subprogram, or function be executed Call WriteNums(num1, num2)) If End If Tests if a condition is met. If the test condition is true, the statements are executed. Enter Is Number < 5? Character Integer Float Main Module Write “Enter 2 numbers” Input Num1,Num2 Call......

Words: 712 - Pages: 3


...ALT Codes - Alt Codes for Maths / Mathematics Welcome to Useful Shortcuts, THE Alt Code resource! If you are already familiar with using alt codes, simply select the alt code category you need from the table below. If you need help using alt codes find and note down the alt code you need then visit our instructions for using alt codes page. List of Alt Codes for entering Mathematical Symbols ALT Codes for Mathematical Symbols | Alt Code | Symbol | Description | Alt 48 - 57 | 0 - 9 | zero to nine | Alt Codes for Basic Operators | Alt Code | Symbol | Description | Alt 43 | + | Plus Sign | Alt 45 | - | Minus Sign | Alt 0215 | × | Multiplication Sign | Alt 0247 | ÷ | Obelus / Division ign | Alt Codes for Pers | Alt Code | Symbol | Description | Alt 37 | % | Percentage Sign | Alt 0137 | ‰ | Per mille (per thousand) | Alt Codes for Bracketing | Alt Code | Symbol | Description | Alt 40 | ( | Open Bracket | Alt 41 | ) | Close Bracked | Alt Codes for Degree of Accuracy | Alt Code | Symbol | Description | Alt 241 | ± | Plus or Minus | Alt Codes for Fractions | Alt Code | Symbol | Description | Alt 47 | / | Fraction seperator | Alt 0188 | ¼ | Quarter | Alt 0189 | ½ | Half | Alt 0190 | ¾ | Three quarters | Alt 46 | . | Decimal Point | Alt Codes for Equality | Alt Code | Symbol | Description | Alt 240 | ≡ | Exactly Identical | Alt 61 | = | Equals ...

Words: 513 - Pages: 3

Ms. Gray

...Christie M. Gray Gray 01 Professor Wilkinson Summer Quarter 2013 24 July 2013 Descriptive Statics Being a former employee with the Secretary of State Driver Services Department, also known as the Driver’s License Facility. There are a number of ways in which the organization displays the use of descriptive statics. According to Lind, “descriptive statistics is defined as methods of organizing, summarizing, and presenting data in an informative way.” The Secretary of State’s office is one of the largest and most diverse offices of its kind. It provides more direct services to Illinois citizens than any other public agency. When an Illinois citizen comes in contact with the state government, it is most often through the Secretary of State’s office. Secretary White’s administration is committed to making the office’s services the most accessible and customer friendly in the nation. The Office of the Secretary of State is visited by more Illinois residents than any other in state government. The Driver Services Department issues licenses to more than 8.5 million drivers and more than 3 million photo identification cards to drivers and non- drivers at more than 130 locations. The office generates approximately $2 billion in annual revenue with about $1.2 billion a year designated for state highway construction funds. The office issues vehicle license plates, titles, and collects taxes for the Department of Revenue on vehicles and......

Words: 487 - Pages: 2

Essay on Gray Code

...Artificial Intelligence – Depth First Search(DFS) November 13, 2012 · by Siddharth Agrawal · in Artificial Intelligence Okay! So this is my first blog post! I will start by talking about the most basic solution to search problems, which are an integral part of artificial intelligence. What the hell are search problems? In simple language, search problems consist of a graph, a starting node and a goal(also a node). Our aim while solving a search problem is to get a path from the starting node to the goal. Consider the diagram below, we want to get to the node G starting from the node S. Which path will we get on solving the search problem? How do we get the path? This is where algorithms come into picture and answer all our questions! We will look at Depth First Search which can be seen as a brute force method of solving a search problem. Creating the search tree So how do we simplify this problem? If we reduce the graph structure to a tree(not particularly a binary tree!), the problem would be to find a node with a particular value starting from the root. So the tree would be as follows: S will be the root of the tree. S will have children A and G. A will have children B and C. B will have only one child D. C will have children D and G. D will have only one child G. Now you may ask which ‘D’ will have the child G, the one which is the child of B or the one which is a child of C? The answer is both. We want to consider all the possibilities and thus we have to show all the......

Words: 797 - Pages: 4


..."The code of the streets is actually a cultural adaptation to a profound lack of faith in the police and the judicial system. The police are most often seen as representing the dominant white society and not caring to protect inner- city residents. When called, they may not respond, which is one reason many residents feel they must be prepared to take extraordinary measures to defend themselves and their loved ones against those who are inclined to aggression. Lack of police accountability has in fact been incorporated into the status system: the person who is believed capable of "taking care of himself" is accorded a certain deference, which translates into a sense of physical and psychological control. Thus the street code emerges where the influence of the police ends and personal responsibility for one's safety is felt to begin. Exacerbated by the proliferation of drugs and easy access to guns, this volatile situation results in the ability of the street oriented minority (or those who effectively "go for bad") to dominate the public spaces." (Anderson, Code of the Street). Anderson main argument in his research is that the behavior of many youths is influenced by the street culture or code. This “code” governs how youth from the inner city will react in a violent manor when faced with impersonal attacks or any show of disrespect. Through Anderson’s study he was able to give us the day to day struggle for some inner city children, and why they were unable to express......

Words: 381 - Pages: 2

Dorian Gray

...Sparknotes – Dorian Gray • Written by Oscar Wilde in 1890. • Devoted to a school of thought and a mode of sensibility known as aestheticism, Wilde believed that art possesses an intrinsic value—that it is beautiful and therefore has worth, and thus needs serve no other purpose, be it moral or political. • Dorian is a cultured, wealthy, and impossibly beautiful young man who immediately captures Basil’s artistic imagination • Although Lord Henry is a self-proclaimed hedonist who advocates the equal pursuit of both moral and immoral experience, he lives a rather staid life. • The Victorians believed that art could be used as a tool for social education and moral enlightenment, as illustrated in works by writers such as Charles Dickens and George Gissing. The aestheticism movement, of which Wilde was a major proponent, sought to free art from this responsibility. • “We are punished for our refusals. Every impulse that we strive to strangle broods in the mind, and poisons us.” • The Picture of Dorian Gray has often been compared to the famous German legend of Faust. The legend tells of a learned doctor who sells his soul to the devil in return for knowledge and magical abilities. Although Dorian Gray never contracts with the devil, his sacrifice is similar: he trades his soul for the luxury of eternal youth. • He is the last Lord Kelso's grandson. His mother was a Devereux, Lady Margaret Devereaux. Poor chap was killed in a duel at Spa a few months after the marriage.......

Words: 3258 - Pages: 14

The Picture of Dorian Gray

...From the Writer “Dorian Gray the Escape Artist” is the culmination of my work in my WR100 seminar, Fantasy at the Fin-de-Siècle. The final assignment was to create a research paper based on an interesting problem or paradox I had found in Oscar Wilde’s book, The Picture of Dorian Gray. For me, one of the book’s most fascinating elements was Dorian’s immature behavior; though he grows older, he never seems to “grow up.” At first, I investigated how my idea related to aestheticism and what Dorian’s immaturity showed about aestheticism; however, I could not find a solid way to prove my thesis. My greatest problem was being unsure of how writing a paper based on a research problem in The Picture of Dorian Gray constituted a researchable argument and not just a literary analysis. Hoping to gain a different perspective on the assignment, I met with fellow classmates to talk out my problem. It turned out that they were having the same issue with their essays, and through discussing my paper with them, I realized that my topic was too narrow to be easily supported by sources; the idea of Dorian growing older without growing up was interesting but could not easily be supported with sources outside the novel itself. With this in mind, I modified my thesis, claiming that though Dorian Gray demonstrates aesthetic behavior in The Picture of Dorian Gray, his fascination with artistic things serves less to pursue aestheticism and more to evade his dark past. In this manner, I argued,...

Words: 2321 - Pages: 10

Dorian Gray Character Analysis

...Dorian Gray character analysis Dorian Gray is so many opposites at once that we can’t really understand them all. He’s good, he’s bad; he’s beautiful, he’s hideous; he’s perfect, he’s terribly flawed. Most importantly, he is literary two things at one – he’s himself, a living, a breathing human being, and he’s also the portrait, a visible reflection of the state of his soul. Dorian Gray within the novel At the opening of the novel, Dorian Gray exists as something of an ideal: he is the archetype of male youth and beauty. As such, he captures the imagination of Basil Hallward, a painter, and Lord Henry Wotton, a nobleman who imagines fashioning Dorian into a pleasure-seeker. Dorian is exceptionally vain and becomes convinced, in the course of a brief conversation with Lord Henry, that his most salient characteristics—his youth and physical attractiveness—are ever growing. The thought of waking one day without these attributes sends Dorian into a tailspin: he curses his fate and pledges his soul if only he could live without bearing the physical burdens of aging and sinning. He longs to be as youthful and lovely as the masterpiece that Basil has painted of him, and he wishes that the portrait could age in his stead. His vulnerability and insecurity in these moments make him excellent clay for Lord Henry’s willing hands. Dorian soon leaves Basil’s studio for Lord Henry’s parlor, where he adopts the tenets of “the new Hedonism” and resolves to live his life as a......

Words: 542 - Pages: 3


...Alasdair Gray depicts one simple theme in his piece with rather compact yet symbolic usage of words. The narrator, is looking at Duncan, Marjory, and Thaw as if one knows every moment within the novel. (third person omniscient) By observing specific moments of the characters, narrator indirectly implies the theme: we can overcome with emotion and be deceived. (over flow of emotion) (missing a topic sentence) In the first part, Gray portrays a mysterious atmosphere with ‘semi-duck’ church, where the story is fundamentally taking place. The ‘semi-dusk’ exemplifies the untouched and mysterious air that symbolizes the loneliness of Duncan rather than symbolizing an artisan. Nevertheless, Lenzie is the opposite place of happiness and delight. This is due to the fact that Lenzie is the place where Marjory and Thaw starts their life while Duncan is becoming miserable in the place of agony and reflection, the church. Moreover, the gallery is where the agony gets intensified, narrator describing Duncan more sympathetically, mentions the mirror as the medium that embodies the deception caused by heightened emotion, ensuring the theme once again. As previously stated, Duncan, Marjory, and Thaw foreseeing different futures, the narrator emphasizes that what we look may differ according to circumstances. More precisely, the way that Duncan sees the mural reflected on the mirror as rather weird and strange. ‘Not beauty’ best represents the way he depicts the mural. This can be deduced......

Words: 791 - Pages: 4

The Death of Freddie Gray

...Ethical Dilemma Week 8 The Death of Freddie Gray By Hope Schwegler May 4, 2015 Phil 2003 Principles of Ethics Professor Margaret De Alminana ‘On April 12, 2015, Freddie Gray, a 25 year old African American male, was arrested by the Baltimore Police Department. He had a known unethical character and had been involved in twenty criminal court cases, five of which were still active at the time of his death. He was due in court on a possession charge on April 24, 2015. Freddie Gray died on April 19, 2015, due to injuries to his spinal cord. On April 21, 2015, pending an investigation of incident, six Baltimore police officers were temporarily suspended with pay. On May 1, 2015, state prosecutors in Baltimore received a medical examiner’s report ruling Gray’s death as a homicide. Was it foul play that was intentional, gross negligence, or inflicted self harm by the prisoner? We identified “Rae’s first step in making a moral decision is to gather the facts.” Much of the other information had conflicting reports and statements. So what are the “ethical issues that Rae has for level two” in the model for making moral decisions? The formal charge filed by Office Garrett Miller accused Gray of violating statute 19 59 22, “unlawfully carry, possess, and sell a knife commonly called a switch blade knife, with an automatic spring or other device for opening and/or closing the blade within the limits of Baltimore City.” The prosecutor alleged that Gray’s arrest was......

Words: 5828 - Pages: 24


...This  is  CS50.   Harvard  College  Fall  2010   Problem  Set  3:  The  Game  of  Fifteen     due  by  7:00pm  on  Fri  10/1     Per  the  directions  at  this  document’s  end,  submitting  this  problem  set  involves  submitting  source  code   on  as  well  as  filling  out  a  Web-­‐based  form  (the  latter  of  which  will  be  available  after   lecture  on  Wed  9/29),  which  may  take  a  few  minutes,  so  best  not  to  wait  until  the  very  last  minute,     lest  you  spend  a  late  day  unnecessarily.     Be  sure  that  your  code  is  thoroughly  commented   to  such  an  extent  that  lines’  functionality  is  apparent  from  comments  alone.       Goals.     •   Introduce  you  to  larger  programs  and  programs  with  multiple  source  files.   •   Empower  you  with  Makefiles.   •   Implement  a  party  favor.       Recommended  Reading.     •   Section  17  of   •   Chapters  20  and  23  of  Absolute  Beginner’s ......

Words: 4248 - Pages: 17

Solution to Roger Gray

...Solution to Roger Gray ANALYSIS This is a very familiar problem to many purchasers and plant materials managers: incorrect and late information leading to poor supply performance. A common response is to blame the information system, and ask the IT group to fix it or design a new one. Others prefer to point to inaccurate records because those who use the system fail to record their transactions properly. Successful organizations find ways of dealing with these problems, as must Roger Gray. The problems experienced by Roger Gray are typical of MRP- and MRPII-type systems. These systems provide the benefits of planning what to order and produce and when, which helps to keep costs down by minimizing inventories and avoiding unnecessary set-ups. The difficulty is that they require accurate data. Using data that is not accurate or is outdated leads to bad decisions. The case also suggests that factors other than the materials management system were contributing to the problems. Therefore, focusing on IT issues alone will not adequately address the problems. An important factor here is the high cost of a stockout. Failure to meet delivery requirements would result in customer downtime, which carries tremendous costs, particularly for Anderson’s automotive customers. Automotive OEMs charge their suppliers $300,000 to $400,000 per hour of downtime. Consequently, control over inventories is essential. Perhaps the fact that delivery reliability is important is one......

Words: 1008 - Pages: 5


...States by corporations, institutions, and other organizations. For more information, please contact the Special Markets Department at the Perseus Books Group, 11 Cambridge Center, Cambridge MA 02142, or call (617) 252-5298, (800) 255-1514 or e-mail CIP catalog record for this book is available from the Library of Congress. ISBN-10: 0–465–03914–6 ISBN-13: 978–0–465–03914–2 06 07 08 09 / 10 9 8 7 6 5 4 3 2 1 Code version 1.0 FOR CHARLIE NESSON, WHOSE EVERY IDEA SEEMS CRAZY FOR ABOUT A YEAR. Code version 2.0 TO WIKIPEDIA, THE ONE SURPRISE THAT TEACHES MORE THAN EVERYTHING HERE. C O N T E N T S Preface to the Second Edition Preface to the First Edition Chapter 1. Code Is Law Chapter 2. Four Puzzles from Cyberspace PART I: “REGULABILITY” ix xiii 1 9 Chapter 3. Is-Ism: Is the Way It Is the Way It Must Be? Chapter 4. Architectures of Control Chapter 5. Regulating Code PART II: REGULATION BY CODE 31 38 61 Chapter 6. Cyberspaces Chapter 7. What Things Regulate Chapter 8. The Limits in Open Code PART III: LATENT AMBIGUITIES 83 120 138 Chapter 9. Translation Chapter 10. Intellectual Property Chapter 11. Privacy Chapter 12. Free Speech Chapter 13. Interlude PART IV: COMPETING SOVEREIGNS 157 169 200 233 276 Chapter 14. Sovereignty Chapter 15. Competition Among Sovereigns 281 294 PART V: RESPONSES Chapter 16. The Problems We Face Chapter 17. Responses Chapter 18. What Declan Doesn’t Get Appendix Notes......

Words: 190498 - Pages: 762

Stephen Gray, Cpa

...Case7.2:Stephen Gray, CPA Answer for Q1 Ethical codes create a boundary that members of a profession could act in to the professions highest beliefs. Where code of ethics is not enforced, a profession’s name could be tarnished by the wrong acts of some individuals that would affect all members of the profession and as the consequence the general public will also be affected. The main reason for the change of these codes overtime is the change in the culture or values systems and attitudes of the general public that pose a need for adjustment with change. The other reason is that the development or the growth of the profession some times faces challenges that require additional code or change of the previous one. Answer for Q2 Yes. Because the Mississippi state board of public accountancy dropped its ban on commissions at almost the same time with the court rulings of Stephen Gray case. The court ruling maintained the state board’s revocation of Stephen Gray's CPA license. However, the Mississippi state board of public accountancy chose not to revoke Gray’s CPA certificate, which was a wise and an appropriate decision to make. If the board revokes his license based on the ruling it would have been a public embarrassment for the board for acting upon a disregarded code of conduct. Answer for Q4 The AICPA is a national organization formed by CPAs in the public accounting profession. It plays a significant role in the standard-setting processes of the profession,......

Words: 340 - Pages: 2

The Gray Zone

...ships inside the Lager. In describing the gray zone, Levi discusses the different roles of prisoners assigned by the Nazi. The prisoners that did the work were seen as being more privileged which at the end of the day helped them get more food and live better. Therefore, the concept of the gray zone is analyzing the difference between the privileged and the non-privileged in the Lager. The difference can be seen by the tasks that the prisoners carried out, for example, one of the groups were seen as, “Low ranking functionaries... sweepers, kettle washers, night watchmen, bed smoothers... checkers of lice and scabies, messengers, interpreters, assistants’ assistants. In general, these people poor devils like ourselves, who worked full time like everyone else but who for an extra half liter of soup were willing to carry out these and other ‘tertiary’ functions.” This group was seen as harmless and not much different than the underprivileged. The other group of prisoners in the Lager was seen as the enemies to their own people. They were referred to as the Kapos who were “free to commit the worst atrocities on their subject as punishment for any transgressions, or even without any motive whatsoever: until the end of 1943 it was not unusual for a prisoner to be beaten to death by a Kapo without the latter having to fear any sanctions.” The prisoners that became part of the Kapo were seen as permanent. They were not accepted back by their people if they were willing to......

Words: 315 - Pages: 2