Shop OBEX P1 Docs P2 Docs Learn Events
Full Duplex Serial Problem — Parallax Forums

Full Duplex Serial Problem

John AbshierJohn Abshier Posts: 1,116
edited 2006-08-03 03:47 in Propeller 1
I want to capture some numbers in binary.· I can capture them in decimal or hex OK.· Here is the code fragment (Complete program attached):

· repeat idx from 1 to 256
··· num ?
··· sio.tx(byte[noparse][[/noparse]num][noparse][[/noparse]0])
··· sio.tx(byte[noparse][[/noparse]num][noparse][[/noparse]1])
··· sio.tx(byte[noparse][[/noparse]num][noparse][[/noparse]2])
··· sio.tx(byte[noparse][[/noparse]num][noparse][[/noparse]3])

I capture the output into a file with hyperterm.· Using a hex editor the first 4·byest are:
8C 6C 8C 96
If I write the values·out in hex, the first 4 bytes are
72E5E5E9 which is the hex value for the decimal output 1927669225

When I write the bytes I get lots of 0x00 values, often more than 4 in a row.· I also used [url=mailto:Br@y]Br@y[/url]++ terminal to capute the bytes and get the same results as with hyperterm.
I am using 8 data bits, no parity, 1 stop bit.· I also tried slowing the baud down to 1200 with no difference than at 115200.

The goal is to capture mega bytes of the results of the random operator to test its properties.

I haven't a clue as to what is happening when I try to write and capture the bytes.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-08-02 14:53
    You need to use "byte[noparse][[/noparse]@num]". The way you wrote it, you are outputting the number at the random memory address contained in num. For your program, most of memory is not used and is initialized to zero. That's why you're getting all the zeroes.
  • John AbshierJohn Abshier Posts: 1,116
    edited 2006-08-03 03:47
    Thanks, I thought I had tried that, but I must have done something else.
Sign In or Register to comment.