[C.CC USERS] bug?

Patrick J.G.C. Weemeeuw pweemeeuw at telenet.be
Wed Aug 11 14:06:57 BST 2010


When executing the following program:

=======================================================

#INCLUDE "plumbing.module"

-- from serial.write.int32, adapted for 64 bit:
PROC write64 (VAL INT board.pin, VAL INT64 clock)
  VAL INT port IS board.to.serial.port (board.pin):
  VAL []BYTE digits IS "0123456789abcdef":
  SEQ i = 15 FOR 16 STEP -1
    serial.byte.out (port, digits[INT ((clock >> (i * 4)) /\ #F)])
:

PROC main ()
  INT16 a:
  INT16 b:
  INT64 diff:
  SEQ
    a := -32000
    b := 32000
    diff := ((INT64 a)  + 65536) - (INT64 b)
    write64(TX0, diff)
    serial.write.newline(TX0)
:

========================================================

I get as result:


Any output from the connected device will appear below
(hit stop to disconnect)
------------------------------------------------------
ffff000000000600
tvm-arduino: end of program


I would have expected 0000000000000600 (1536), or did I make a mistake somewhere?

Thanks

-- patrick




More information about the users mailing list