Re: [bascom] SV: I2C problem


From Brent Nelson <spock50@gte.net>
Date Mon, 27 Sep 1999 07:10:47 -0700

Hi Michael,

    I was looking over your program, and I have a suggestion for creating the 
Lm75temp variable.

"Michael W. Akers" wrote:'
Create temperature word

> '   Put Lm75high in high byte position in word.
>     Lm75temp = Lm75high * 256
>

mov  { Lm75temp + 1} , Lm75high   ' mov data into high byte

>     Lm75temp = Lm75temp Or Lm75low

mov {Lm75temp} , Lm75low    ' mov data into low byte

>
> Shift everything 6 bits right!

>   Lm75value = Lm75temp * 64

Rotate Lm75temp , right , 7    ' shift everything 7 bits

The extra shift was added to perform

    Dispval = Lm75value * 0.5

Your answer is now in Lm75temp.

I just thought I would show you a different way to do the same thing using 
less code.

Regards,

Brent Nelson