kevj
- 31st August 2007, 18:59
Thanks for the help so far everyone - I had a break through last night and got an LED to blink. Small victory but it's progress. lol.
I have a Q about syntax of writing data to paired bytes for example TMR1H and TMR1L - high/low pair.
Let's say I want to write a value of 48060. Right now I put that into my calc and convert it to binary - in this case 1011101110111100. I split that and write it into the variable pair like this:
TMR1H = %10111011 'Set timer to 48060
TMR1L = %10111100
This isn't easy though - time consuming, requires to enter and re-type a binary number, etc. I'd really like to write code that looks something like this:
TMR1H:L = 48060
... and have PBP figure it out for me.
The major complication is, what happens when I want to perform logic on this number such as {perform some calculation which may equal 100 to 30,000 and subtract that result from the value I'm going to place into TMR1} - I'm not sure how to do that, split out the binary components and assign those components to the H/L pair.
I wondered if I assigned the binary represnetation of "048" for the H, and "060" for the low byte - if that equals the same result.
Guidance?
And on a similar subject, what's the deal with HEX? I see a lot of code examples where people entere hex values - I understand it's the same thing, but is there some advantage to entering hex? Can I convert that 48060 value to hex them somehow assign it to the H/L pair in one shot and PBP will assign the right bits to the right bytes?
I'd like to perform the above assignment of TMR1 value as quickly as possible - as it's written it seems like 2 instructions (and probably a few more in ASM) but it seems there should be a way to assign both H/L in one shot and cut the instruction cycles in half.
Thanks everyone!! I would have thrown this stuff in the trash by now if it weren't for this forum. :)
I have a Q about syntax of writing data to paired bytes for example TMR1H and TMR1L - high/low pair.
Let's say I want to write a value of 48060. Right now I put that into my calc and convert it to binary - in this case 1011101110111100. I split that and write it into the variable pair like this:
TMR1H = %10111011 'Set timer to 48060
TMR1L = %10111100
This isn't easy though - time consuming, requires to enter and re-type a binary number, etc. I'd really like to write code that looks something like this:
TMR1H:L = 48060
... and have PBP figure it out for me.
The major complication is, what happens when I want to perform logic on this number such as {perform some calculation which may equal 100 to 30,000 and subtract that result from the value I'm going to place into TMR1} - I'm not sure how to do that, split out the binary components and assign those components to the H/L pair.
I wondered if I assigned the binary represnetation of "048" for the H, and "060" for the low byte - if that equals the same result.
Guidance?
And on a similar subject, what's the deal with HEX? I see a lot of code examples where people entere hex values - I understand it's the same thing, but is there some advantage to entering hex? Can I convert that 48060 value to hex them somehow assign it to the H/L pair in one shot and PBP will assign the right bits to the right bytes?
I'd like to perform the above assignment of TMR1 value as quickly as possible - as it's written it seems like 2 instructions (and probably a few more in ASM) but it seems there should be a way to assign both H/L in one shot and cut the instruction cycles in half.
Thanks everyone!! I would have thrown this stuff in the trash by now if it weren't for this forum. :)