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.

hi byte,low byte

Status
Not open for further replies.

poppy2008

New Member
I don't understand the purpose of the high and low bytes. I've searched high and low for an answer, but no luck so far. What is the relation between the high byte and the low byte ? any one explain me
 
These terms are only really useful when you have a 16 bit number that you want to split into 2 bytes.

Say you want to set timer1 (or any other 16 bit register) to 25,000 then you would do,
Code:
	movlw	high d'25000'
	movwf	TMR1H
	movlw	low d'25000'
	movwf	TMR1L
This saves you the trouble of converting 25000 to hex =0x61ad and putting the individual bytes into the register.
I.E.
Code:
	movlw	0x61
	movwf	TMR1H
	movlw	0xad
	movwf	TMR1L

OTOH, if your question is how 2 bytes can be combined to make a word variable then that is a different question.

Mike.
 
The first time I needed to deal with values higher than 255, I run across the "high" / "low" option.

What confused me was that the MPLAB's help explained them as used for memory addresses only. Just by experiment, using the simulator I saw it was applicable to any 16-bit value.
 
I don't understand the purpose of the high and low bytes. I've searched high and low for an answer, but no luck so far. What is the relation between the high byte and the low byte ? any one explain me

I'm not exactly sure what your referring to, but in general terms, say for a 16 bit address bus, the low byte would be A0-A7 and the high byte A8-A15.
 
As Pommie explained.

Basically with a byte (8 bits) you can count from 0 to 255. But what if you want to count more, simple add more bits.
To keep things clean, you would add another 8 bits, and any multiples of that as you need more. Have a look at the history of the PC, you'll even find it there.
The problem is, an mcu is not a 64 bit device like your modern cpu.
So you are required to split up your large number to fit into two bytes.
The low byte and high byte, together giving you 16 bits, but they are separate, remember.
So what it means is that your mcu is only an eight bit device, so the internal registers are 8 bit, and therefore can only handle eight bit calculations etc.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top