Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How a Hex code is operated in u-controller?

Status
Not open for further replies.

ibrar0

New Member
it is known that hex file is short-representation of binary code. and it is loaded in micro-controller's Rom memory?
But
u-controller understands only 0-1 (binary or machine) form, How it understands hex codes which we embed on u-controller through programmer?

1) if controller converts hex code to binary code(machine understandable form), then how and at which stage this conversion is done?
 
ibrar0 said:
if controller converts hex code to binary code(machine understandable form), then how and at which stage this conversion is done?

Good question. I like that.

The programming software(WinPicProg, PonyPro, WinPic....) you run on the PC that controls the operation hardware programmer reads the hex file from disk or harddisk, then send the data out to its serial or parallel port pin, bit by bit for the PGD connection on the PIC.

So to the PIC, the data is coming to it bit by bit in binary form.
 
Hex code is a way of viewing binary data. They are all stored in 0-1 elements
on the part itself. A hex digit is just a way of looking a 4 binary bits.

The programming port takes in serial hex data and programs the program space's bits with them.
 
Yes the original Intel (or was it Motorola?) Hex Format was and is a very successful 'bridge format' that was readable and editable by simple text editors but easy to program for constructing and deconstructing the basic underlining binary data. It's been around now for decades and I'm sure will be viable for decades to come.

Lefty
 
HEX file is wht which is understandable by the programmer which programs the chip of u-controller and hence we need a driver too, but the programmer basically programs the chip in binary 1s and 0s format.

well, was a good question and goos thinkings of ur mind, really appreciable....

with regards,
 
Well...

ibrar0 said:
it is known that hex file is short-representation of binary code. and it is loaded in micro-controller's Rom memory?
But
u-controller understands only 0-1 (binary or machine) form, How it understands hex codes which we embed on u-controller through programmer?

Simple...

Say if you embed the hexadecimal value ' F4 ' then ... its binary equivalent is ' 1111 0100 ' ...

it is actually we use it as a hexadecimal value... actually it is binary value collection of 4 bits...

that is F = '1111' and 4 = '0100'

1) if controller converts hex code to binary code(machine understandable form), then how and at which stage this conversion is done?


No conversion is done...

the values that we put into the microcontroller are actually in ' binary form ' ... and four binary bits together form one hexadecimal bit...

It is we represent binary form into Hexadecimal form...


Regards,

Simran..:)
 
reply to thread!!!!

Hi, thanks a lot, i want to ask that when we write hex-code into controller it goes as binary.

But

when ever we read data from controller's rom , it shows us in hex format.
and when our file is finally compiled from assembly to binary, it again show in hex format,
upto now, i understand that, programe through which we read file from controller's rom, this programme converts binary 1111 into 'f' and same , when we compile assembly into hex, the writer software like "spi flash programmer v3.0" it converts from hex into binary micro-controller
 
ibrar0 said:
Hi, thanks a lot, i want to ask that when we write hex-code into controller it goes as binary.

But

when ever we read data from controller's rom , it shows us in hex format.
and when our file is finally compiled from assembly to binary, it again show in hex format,
upto now, i understand that, programe through which we read file from controller's rom, this programme converts binary 1111 into 'f' and same , when we compile assembly into hex, the writer software like "spi flash programmer v3.0" it converts from hex into binary micro-controller

Is there a question in there?
 
ibrar0 said:
Hi, thanks a lot, i want to ask that when we write hex-code into controller it goes as binary.

But

when ever we read data from controller's rom , it shows us in hex format.
and when our file is finally compiled from assembly to binary, it again show in hex format,
upto now, i understand that, programe through which we read file from controller's rom, this programme converts binary 1111 into 'f' and same , when we compile assembly into hex, the writer software like "spi flash programmer v3.0" it converts from hex into binary micro-controller

I've no idea what you're asking? - binary and hex are the same things, just a different way of expressing the exact same value. Hex is usually used for the display format simply because it's far easier to understand than binary.

The only place HEX is used is for YOU to read, everything in the PIC, and in your computer, is completely binary - HEX is simply a convenient human way of displaying a binary number.
 
Some times people think too hard and make a problem much more dificult to understand.

ibrar, this isn't a complex thing. It's like text codes in a computer. The letter "A" is represented in a computer as a binary number (0100 0001) yet it is printed as the letter "A". Or, you can look at that value as hex (0x41), decimal (65) or even octal (101). It's simply the way you decide to look at the value. The actual bits in the computer remain the same.

The same is true for microcontroller instructions. The hex format is more than just the actual values, it also contains instructions for the address where the values should be put. Your loader (or programmer) uses those instructions to load the actual values into the microtroller's memory.
 
Well again..

the value is same...

it is on us ... how we represent it...

when we take individual bit... we call it binary...

when we collect four bits together... it is called hexadecimal...

See,

1111 1011 - it is in binary...

while ,

1111 = F

1011 = B

Hence, it becomes FB ...

Regards,

Simran..:)
 
Thanks you all people,
i understand the problem and final result is that hex is nothing it just displayed to us by programe through which we interact with controller or any device for our convienience(easiness). thanks again
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top