Announcement

Collapse
No announcement yet.

newline "n| isn't a 0x0A

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CasaDelGato
    replied


    Arrgh, again.
    Sure would be nice if the compiler could actually find blatant compile time errors. (Like every other language compiler does.)

    Leave a comment:


  • meldavia
    replied


    as mentioned in the previous post, you are passing a string as an agument instead of a character constant, therefore, you are passing the low byte of the address of the string

    Leave a comment:


  • CasaDelGato
    replied
    The code was watching for a message from another device.
    var ch := serin();
    if (ch == "\n") dosomething(); // THIS FAILED
    if (ch == 0x0A) dosomething(); // THIS WORKED

    Same thing with serout();
    using "serout("\n");" - the other device didn't receive a 0x0A. (No, I don't have a convenient way to find out just what it did receive.)
    using serout( 0x0A); worked just fine.



    Leave a comment:


  • meldavia
    replied


    When I used serout("B"), the other equipment received a "@".
    thats because you are passing a string to serout, which only accepts a constant.

    try serout ('B');

    fair enough - it would be nice if the compiler warns you about things like this - it will one day...

    (to note, its actually sending the low byte of the pointer to the string with "B")

    Leave a comment:


  • meldavia
    replied
    Can you please explain a bit further what you mean?

    func main()

    var x;

    x := '\n';

    print(x);

    repeat forever

    endfunc

    Leave a comment:


  • CasaDelGato
    replied


    Oh, and another issue.
    When I used serout("B"), the other equipment received a "@".
    I had to change the "B" to 0x42, then it worked.

    Leave a comment:


  • CasaDelGato
    started a topic newline "n| isn't a 0x0A

    newline "n| isn't a 0x0A

    I just ran into a problem because "\n" isn't a newline char. (0x0A)
    I don't know what it is, but it's not the same as every other compiler I use.
    I had to go through all my code that was talking with another system via the serial port, and replace all the occurrences of "\n" with 0x0A.

Working...
X