Padam Posted February 10, 2012 Posted February 10, 2012 Hi, I have a question regarding Ones and Zeros, I assume everybody on this forum knows about binary code. But I'm interested where the binary streams are converted into real text. Let's say, I send a binary stream from my own made usb device to my computer. This binary stream contains: "001000001", this is the ASCII letter "A" (yes capital). So I'd like to know how and perhaps where the system converts "001000001" to "A". And if it might be possible to assign "001000001" to a different ASCII letter. Kindly regards, Padam
TonyMcC Posted February 10, 2012 Posted February 10, 2012 So I'd like to know how and perhaps where the system converts "001000001" to "A". In a very real sense it doesn't. The only thing the computer does is manipulate binary numbers which are stored in registers or memory. The place on the screen where you see the letter A occupies several pixels. Each pixel requires several bits of memory (probably 1 byte). You see A but all the computer did was respond to these memory locations to switch on or off the various pixels and set their colour so you see A on the screen. A different pattern of pixels, for instance, would put a number such as 2 on the screen. The link may make this more clear: - http://www.ucblueash.../comath/44.html
khaled Posted February 10, 2012 Posted February 10, 2012 (edited) And if it might be possible to assign "001000001" to a different ASCII letter. "0010 0001" is known as data (as represented in Binary), data which is stored over a medium (memory), A data representation is a function, that maps a domain of data to a range of outcomes, A data-type preserve a fixed amount of memory, with a built-in data-representation. Data is what is stored in memory, can be represented differently through different data representations. Data-Representations [C++]: Binary Code, Hexadecimal Code, Octal Code, Decimal Code, Ascii Code, Unicode, ..etc Data-Types [C++]: Boolean (bool), Integer (short, int, long), Real (float, double), Character (char), String (char*), ..etc ------------------ About your question: Yes you can, in computer science it's called Transliteration, where you represent same information using same representation, but with different scheme .. the method is simple, you need to define two things: the map table and the transliterate function .. the map table, is a table of size K x 2, symbols are paired with their mappings, the transliterate function takes data, and transliterate it, note that transliteration is not symmetric. Edited February 10, 2012 by khaled
Padam Posted February 11, 2012 Author Posted February 11, 2012 (edited) About your question: Yes you can, in computer science it's called Transliteration, where you represent same information using same representation, but with different scheme .. the method is simple, you need to define two things: the map table and the transliterate function .. the map table, is a table of size K x 2, symbols are paired with their mappings, the transliterate function takes data, and transliterate it, note that transliteration is not symmetric. Seems logic to me, one question though, do you perhaps know how and where exactly these map tables are stored. Because when I program a simple microchip to turn certain LEDs on or off while not connected to any computer, just to a battery. It knows what it does, it reads my software i wrote correctly, so i think those map tables are stored on every single microchip/controller/processor in the world. Correct me if i'm wrong. Would it be possible to manipulate a map table? For example, I send a data stream containing "01001000 01100101 01101100 01101100 01101111" (ASCII: "Hello") And my modified map table would translate this to ASCI: "icXMl" if I assign those 8 bit data stream to these ASCII letters. Is this possible you think? Edited February 11, 2012 by Padam
khaled Posted February 11, 2012 Posted February 11, 2012 (edited) Seems logic to me, one question though, do you perhaps know how and where exactly these map tables are stored. Because when I program a simple microchip to turn certain LEDs on or off while not connected to any computer, just to a battery. It knows what it does, it reads my software i wrote correctly, so i think those map tables are stored on every single microchip/controller/processor in the world. Correct me if i'm wrong. Would it be possible to manipulate a map table? For example, I send a data stream containing "01001000 01100101 01101100 01101100 01101111" (ASCII: "Hello") And my modified map table would translate this to ASCI: "icXMl" if I assign those 8 bit data stream to these ASCII letters. Is this possible you think? It seem you don't need Transliteration .. you need a Data Representation Scheme, which is simple here is an example: using char in C++, which preserves a single byte, we can caste it to int to deal with it as a decimal, for a data representation scheme for a byte, we need a 1-dim table of size [math]2^8 = 256[/math] cells // define your own schema, where data value X is represented as schema[X] char * schema [256] = { "alpha","beta","gamma", .. "OMEGA" }; // this is a simple function that takes a string of data bytes, represent it using our schema void myDataRepresent ( char * data ) { int i = 0; while ( data [ i ] != '\0' ) { cout << schema [ (int) data [ i ] ] << " "; } cout << endl; } ---------------------------------------- Note: Unlike transliteration schema, data representation schema doesn't have to be a unique mappings .. so for example two or more values can be mapped to the same representation. Edited February 11, 2012 by khaled
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now