On testing program, with your optimization 10 bytes are saved (maybe
more with the last one but not tested), and another 4 bytes with a
little one by me:
procedure temp_18B20_CRC(byte out inches, byte out fraction, bit out
signed, byte in max_crc_errors) is
--
var byte tmp[2] at temperature
var volatile bit tmp_1_7 shared at tmp[1] : 7
var byte i = 0
-- signed = 0
repeat
match_rom_18B20
send_ID_18B20
d1w_write_byte(0xBE)
read_18B20_with_CRC(9)
i = i + 1
until (GOOD_crc == 0) | (i == max_crc_errors)
tmp[0] = scratchpad[0]
tmp[1] = scratchpad[1]
-- if (tmp_1_7 == 1) then
-- signed = 1
-- end if
signed = tmp_1_7
inches = tmp[1]<<4 | tmp[0]>>4
fraction = byte((tmp[0] & 0x0F)* word(625)/1000)
end procedure
Is about signed parameter. Now, to modify the testing programs as
well.
On Dec 15, 2:41 pm, Oliver Seitz <[email protected]> wrote:
> > Thank you Kiste, your advices are
> > well received. My background is more
> > in Pascal and very little in C.
>
> Your're welcome!
>
> I hardly understand C at all, my favourite languages are JAL and assembler
> for PICs, and Pascal on PCs. Sometimes I have to use C, but it takes me days
> to even get a few lines to compile, let alone run ;-)
>
> Greets,
> Kiste
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en.