Announcement

Collapse
No announcement yet.

Clarification on IDE and Serial Communication

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

  • Clarification on IDE and Serial Communication

    Hello,

    So I've been working with this Software for a couple weeks and I'm still stuck. I think I'm missing something important that will help me finalize this. A little bit of background: essentially I'm having a really hard time actually talking the LCD as a slave. I've been able to use both ViSi and ViSi Genie to play the video that I want, all I want to do is have a MCU pass a string of data through UART to the LCD and give the LCD simple logic, If recieve data A play 1, if data B play 2.

    Designer is for strictly coding in 4DGL

    ViSi Genie is purely drop and drag, there is no coding involved.

    Visi is the in between where you can drop and drag and still modify the 4DGL source code.

    Now I get confused between these 3 and their relation to the Serial IDE.

    Serial "transforms the display into a slave module". I grasp that concept. What I don't get is how is that different than the other IDEs. For almost every application the LCD will be controlled by another MCU, and act like a slave, so what's the point of Serial IDE? How do I work with it. Do I need to take my other projects and re-transform it to C code that a MCU will control as a master?

    What I would like to do is take my ViSi code, and implement UART communication in it, but I'm having a hard time getting it to work and I feel like I'm spinning my wheels. Below is my source code. Any and all help will be appreciated.

    #platform "Gen4-uLCD-70D"
    #inherit "4DGL_16bitColours.fnc"
    #inherit "VisualConst.inc"
    #inherit "UART_TRY1Const.inc"

    func config()

    com_SetBaud(COM0, 1920); //Sets baud rate
    //com_Mode(8,'N', 1 COM0); //declare communication mode DEFAULT NOT NEEDED

    //Do I need anything for my UART configuration?

    putstr("Mounting...\n");
    if (!(file_Mount()))
    while(!(file_Mount()))
    putstr("Drive not mounted...");
    pause(200);
    gfx_Cls();
    pause(200);
    wend
    endif

    hndl := file_LoadImageControl("UART_T~1.dat", "UART_T~1.gci", 1);
    gfx_Set(SCREEN_MODE,LANDSCAPE);

    endfunc

    func main()

    config();

    var check;
    var frame;

    while(!com_Full()) //wait for full bus/communication from
    wend

    check := serin();

    if(check == 0xAA) //Display Option A

    gfx_Cls(); //clear screen

    img_SetWord(hndl, iVideo1, IMAGE_INDEX, frame) ; // where frame is 0 to 148
    img_Show(hndl,iVideo1) ;

    putstr("we are here") ;

    endif

    if(check == 0xBB) //Display Option B

    gfx_Cls();

    for(frame := 0; frame <= 148; frame ++)
    img_SetWord(hndl, iVideo1, IMAGE_INDEX, frame) ; // where frame is 0 to 148
    img_Show(hndl,iVideo1) ;
    pause(33);
    next

    endif

    repeat
    forever
    endfunc

    Thanks for the help in advanced





  • #2
    Hi

    The problem is in the while --- wend command,

    I have taken that out of your code and put everything in the repeat --- forever loop

    #platform "Gen4-uLCD-70D"
    #inherit "4DGL_16bitColours.fnc"
    #inherit "VisualConst.inc"
    #inherit "UART_TRY1Const.inc"

    func config()

    com_SetBaud(COM0, 1920); //Sets baud rate
    //com_Mode(8,'N', 1 COM0); //declare communication mode DEFAULT NOT NEEDED

    //Do I need anything for my UART configuration?

    putstr("Mounting...\n");
    if (!(file_Mount()))
    while(!(file_Mount()))
    putstr("Drive not mounted...");
    pause(200);
    gfx_Cls();
    pause(200);
    wend
    endif

    hndl := file_LoadImageControl("UART_T~1.dat", "UART_T~1.gci", 1);
    gfx_Set(SCREEN_MODE,LANDSCAPE);

    endfunc

    func main()

    config();

    var check;
    var frame;

    //while(!com_Full()) //wait for full bus/communication from
    //wend

    repeat

    check := serin();

    if(check == 0xAA) //Display Option A

    gfx_Cls(); //clear screen

    img_SetWord(hndl, iVideo1, IMAGE_INDEX, frame) ; // where frame is 0 to 148
    img_Show(hndl,iVideo1) ;

    putstr("we are here") ;

    endif

    if(check == 0xBB) //Display Option B

    gfx_Cls();

    for(frame := 0; frame <= 148; frame ++)
    img_SetWord(hndl, iVideo1, IMAGE_INDEX, frame) ; // where frame is 0 to 148
    img_Show(hndl,iVideo1) ;
    pause(33);
    next

    endif

    forever
    endfunc


    Which works.

    There is the Serial SPE environment which gives you great flexibilty in being able to do pretty much the same as you can in Visi but acts just like a serial slave.
    http://www.4dsystems.com.au/productp...nual_R_2_0.pdf

    There are Serial libraries available for Arduino and other MCU's here.
    https://github.com/4dsystems?tab=repositories

    I hope this helps.

    Best regards

    Paul

    Comment


    • #3
      Also, in the Visi environment, there is no serial handling so you will not get an ACK or a NACK returned. You have to create all serial handling yourself.

      Comment

      Working...
      X