0x4c To Decimal

1 view
Skip to first unread message

Debra Necochea

unread,
Aug 5, 2024, 2:11:25 PM8/5/24
to stanearunstar
Ithink the issue is understanding how data is actually stored in memory, as opposed to how it's abstracted when using a high-level language. From your confusion over how the string is stored in memory, I think that's where you should start.

At the level you're operating on in MIPS, there is no "string" (only Zuul). There's not really an "int" or a "float" in the way you're used to thinking of them, either. There's just bits (1/0) which are grouped together in standard ways to compose the data types you're used to using. For reasons your professor will be telling you about, we use groups of 8 bits, which we call a "byte".


Each of those characters in your string can be represented in a byte. Take a look at to see the standard for how that is done. So the 'L' is represented by a string of bits that corresponds to the hex value 0x4c, which just happens to be decimal value 76.


That value is stored in a single byte in RAM. The next letter ('o', represented by hex value 0x6f) is stored in the next sequential byte. The next letter is stored in the next byte, all the way through the last one. If you had to come up with a name for that chain of sequential bytes, you might call it a "string" of characters. :)


As @Michael said, you need to know that a zero-terminated ASCII string (also called an ASCIIZ string) has an additional character at the end. That character is represented by hex value 0x00 (plain old zero), and you'll see it referenced as '\0'.


One other thing. You need to find a better ASCII-to-Hex translation tool. The one you used didn't treat the "space" character correctly. A space corresponds to ASCII character 0x20 (decimal 32). If you leave it out, your string is "LongNumbers". If you try putting 0x00 in there, your string will end after "Long".


For converting an integer value I'd do very similar to John Ripley's answer, but a slightly different mechanism. The same caveats apply - float and int must be the same size and endianness, and float must be IEEE if the initial hex value is to be treated as IEEE:


If you begin with an array of unsigned char rather than an int, then any direct-copying from the array needs the array to have been populated with the same endianness as on your platform. Your array is big-endian, but Intel is little-endian. So you could reverse the array as in JohnB's answer if you know the endianness of your platform is the opposite of the endianness of the array. If you know the array is big-endian, and you don't know what endianness your platform is, you can do this (assuming 8 bits per char in the char array):


Caveat: This is not guaranteed to work in Standard C (floating point numbers technically do not have to be IEEE754 binary32/64; they could be a decimal implementation). However, since C99, the standard has declared that IEEE754-style ("IEC 60559") floating point representation is normative and defines it in Annex F. (And in practice, most hardware you'll encounter uses IEEE754 already.)


edit: As pointed out in the comments, this code is unsafe as it creates two pointers aliasing the same memory but of different types. It may well work on a specific compiler & program, but isn't guarenteed to by the standard.


I have an Apple Airport Extreme router and I'm trying to use the DHCP Reservation Setup to create a static IP address that I can use for the Ethernet Shield but I need to list the MAC address for the shield in the setup along with the IP address.


I guess I'm asking for something a little deeper. I realized that for this example the letters just dropped down into a row. Thank you, I didn't know that prior to this. Now I'm just looking for more information on how to do a conversation that would cover all scenarios.


A mac address is always 6 bytes long, how they are seperated varies, but is usually colons. They are invariably expressed in hexdecimal notation (base 16, uses the characters 0-9 + A-F - each byte uses 2 characters since 16 * 16 is 256). Sometimes the letters are upper case, sometimes lower case, but never mixed. IP addresses on the other hand are now 4 bytes (until IPv6 happens) and almost always expressed in Decimal format as a number 0 - 255.


On a more involved level (which you don't really need to know for setting up routers and stuff) mac addresses are usually unique to a device and you can't have more than 1 of that number on a local (non routed) network. The first 3 bytes designate the manufacturer and the last three are a number given to it at manufacture by the maker. That doesn't mean to say they can't be changed or spoofed and often are. The mac address isn't routable over TCP/IP (the internet) so devices with the same mac address can exist on the internet at large. Real Mac addresses usually start with zero (00) since they haven't got past 65536 different manufacturers yet.


Thanks for that extra information. That is helpful. Just so that I understand, what number base is the sketch in? Is that hexadecimal? I guess I'm having a hard time understanding what the '0x' represents in front of the characters. I guess this isn't important now that I know I can simply change some of the letters to create another unique mac address for future ethernet shields.


Hello,



1)In official examples, there is Delay(100) between each send, what frequency do you need to send? You can test it by yourself.



2)Arduino boards are not so smart, the compiler completes do this step if your decimal values are no more than 255. There are many tricks for assigning unsigned char arrays to variables of other data types, such as writing memory directly with pointers. If you are interested in it, you can study the relevant books of C and C++. But if you are not so good at coding, do it in the method you familiar with.


Hi my server has been 1.8 for a while and Im using ViaVersion to make it compatible with 1.9 too. I've been joining with 1.9.2 perfectly well. Today when I was joining with 1.9.4 I got this error message.


Less short answer: Mojang changed their network protocol in 1.9.3-pre2 and switched places between several packet pairs, including 0x4b and 0x4c (which translates to packet 75 and packet 76 decimal) so anything from 1.9.3 and up will fail to connect with anything from 1.9.2 and down because they simply put don't speak the same language anymore.


Edit: After reading up on what ViaVersion is...scratch the short answer above, you have to update ViaVersion to allow 1.9.4 clients (for the same reasons as the less short answer above, the protocol changed so they had to add support for that in the plugin).


The ASCII (American Standard Code for Information Interchange) charset is used to represent letters, numbers and control signals in information processing systems by 7 bit binary values. This page shows all the information about 0x4c, with is the character 'L' including the HTML code, the key combination and the hexadecimal, octal and birary encoding of the value.

Lowercase L is 0x6c


This page describes the SGX-120L's fonts and instruction set. For hookup, configuration and specifications, please see the hardware reference. These instructions apply to SGX-120L, version 2.0 and later. For a summary of differences from the earlier versions, see the upgrade guide.


The SGX-120L is a 120x32-pixel graphics LCD with a 9600bps serial interface. It can store a customizable font and 15 full-screen bitmap images in its flash memory. The SGX has four font sizes that can be mixed on the screen, and can draw lines and plot points. This page describes the control codes that format text and the escape codes that download, draw and store graphics.


SGX-120Ls accept asynchronous serial at 9600bps, 8 data bits, no parity, 1 or more stop bit(s), often called "N81." They will accept RS-232 input, inverted TTL, or non-inverted TTL. Non-inverted TTL requires cutting the SPol jumper on the circuit board. See the hardware reference for further information.


SGX-120Ls accept character codes 32 to 191, with the lower codes (Any pair of stored bitmaps can be used as a font; the display controller selects a 6x8-pixel chunk of the selected bitmap according to the character code received and displays it on the screen in the current font size and position. See ESC-F in the Escape instructions below.


SGX-120L offers multiple font sizes, which can be freely mixed on the screen. The following screen layouts show position values for the various font sizes. Positioning (ctrl-P below) works in terms of the font-size in effect at the time. In the illustrations below, position = row + column.


SGX-120Ls understand a small set of control codes that format incoming text. Some are standard (carriage return, backspace, tab) and others are display-specific (position, right-align, backlight on/off). Codes not listed below (e.g., Null, 0) are ignored by the display.


Displays text (usually numeric) within a field 2 to 8 characters wide. The byte that follows ctrl-R is a text number from '2' to '8' (50-56 dec, 0x32-0x38 hex) that sets the field width. The text after that will be invisibly stored until one of the following is received:


These are multipart instructions that begin with the Escape character; 27 dec, 0x1B hex. Escape instructions work with graphics and/or memory: downloading/storing/recalling bitmaps, plotting points and lines, setting startup configuration.


Write a single byte (0-255 decimal, 0x00-0xFF hex) to the screen as a vertical column of eight pixels (lsb at the top). ESC B (uppercase B; 66 dec, 0x42 hex) byte. The byte is written to the location previously specified by Escape A. After this instruction, the write-byte address is incremented by 1. If your program requires writing bytes to sequential screen locations (left to right and top to bottom) you need only to set the starting address.

3a8082e126
Reply all
Reply to author
Forward
0 new messages