Announcement

Collapse
No announcement yet.

Serial In Test

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

  • Serial In Test

    I am using the following program to try and test that when i recieve a serial command it displays what it is:
    #platform "GOLDELOX-GFX2"
    /* 4DGL Demo Application
    5 digit counter demo
    Custom Display Demo using the 7segOrange_18x36.gif
    custom graphics component. GFX2DEMO.GCI must be loaded
    onto the uSD card for this demo to work. This can be
    done from the media editor.
    */
    #inherit "4DGL_16bitColours.fnc"
    func main()
    var char;
    repeat
    char := serin(); // test the com port
    if (char >= 0) // if a valid character is received
    gfx_Set(OUTLINE_COLOUR, YELLOW);
    gfx_Cls();
    txt_MoveCursor(1,1);
    putstr("serial in\n"); // process the character
    endif
    txt_MoveCursor(2,2);
    gfx_MoveTo(20,20);
    txt_Set(TEXT_WIDTH, 2);
    txt_Set(TEXT_HEIGHT, 2);
    txt_Set(TEXT_COLOUR, ORANGE);
    putstr(char);
    txt_MoveCursor(4,4);
    gfx_MoveTo(40,40);
    txt_Set(TEXT_WIDTH, 1);
    txt_Set(TEXT_HEIGHT, 1);
    txt_Set(TEXT_COLOUR, ORANGE);
    putstr("program on\n");
    forever
    endfunc

    The program on works fine but the rest of it does nothing. Do you think it is a problem with the PIC i have it interfaced to not sending out a serial command or do you have any programming suggestions.
    Thanks

  • #2


    Not sure what you mean by "The program on works fine but the rest of it does nothing."

    An earlier version of you post had 'if (char = 0)', which would simply set char to 0 and be false, did you test again with the updated version?

    Also, try changing 'putstr(char);' to 'print([CHR] chr);' and maybe add 'to(COM0); print([CHR] chr);'
    Mark

    Comment

    Working...
    X