Announcement

Collapse
No announcement yet.

Serial communication

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

  • Serial communication

    Hi,
    I'm using GEN4-ULCD-43DCT-CLB in Visi-Genie environment. In particular, I'm using a keyboard, kbCrl and Magic code to print numbers on the screen. This is the code and it is working:

    func rMagicKbClrEvent0(var reportID, var objType, var objHash, var value)
    var i ;
    if (value == 8) // 'back'
    if (chars)
    respchp-- ;
    chars-- ;
    txt_MoveCursor(6,lft+chars); // text starts from 'lft'
    putch(' ') ;
    txt_MoveCursor(6,lft+chars);
    endif
    else if (value == '*') // 'enter'
    str_PutByte(respchp++, 0) ;
    i := str_Ptr(Response) ;
    txt_MoveCursor(6,lft);
    if (str_Match(&i, "1234"))
    ActivateForm(1) ;
    else
    txt_FGcolour(RED); // 0 text foreground colour
    txt_MoveCursor(7,lft);
    print("wrong password") ;
    txt_FGcolour(LIME); // 0 text foreground colour
    sys_SetTimerEvent(TIMER0, resetchars);
    sys_SetTimer(TIMER0,500) ;
    endif
    respchp := str_Ptr(Response) ;
    chars := 0 ;
    else if (chars < maxresp)
    str_PutByte(respchp++, value) ;
    txt_MoveCursor(6,lft+chars);
    chars++ ;
    putch(value) ;
    endif
    endfunc

    Now, I'd like to send the variable 'value' to a Texas Instrument board using the UART. Is it possible to use 'serout(value);' after 'str_PutByte(respchp++, value) ;' ? If so, how? I tried to use "KeyboardSerialConst.inc" but it is not working.
    Thank you.

    Best regards,

    Sam

  • #2
    Hi Sam,

    You should be able to add serout(value); after str_PutByte(respchp++, value); which will send out the char to COM0 and then to your TI board if you are using COM0 of the display.

    When you said you were using "KeyboardSerialConst.inc" and it didn't work, how were you using it ?

    Best regards

    Paul

    Comment


    • #3
      Hi,
      thanks for your reply. Sorry I misspoke. I can see that something is transmitted to the TI board by oscilloscope. But anyway using serout() in Visi, everything works (so, the TI part is fine). This is the function I used in Visi:
      func KbHandler(var Key)
      serout(Key) ;
      endfunc
      But when I try to move to Visi Genie using MagicKbClr, something goes wrong and I don't understand the difference. I'm using a different keyboard and that's all. Can you provide me with an example in which there is the MagicKbClr object, a keyboard and an UART communication used to transmit numbers and also print numbers received from the host?

      Best regards,

      Sam
      Last edited by Sam93; 21 November 2019, 08:09 PM.

      Comment

      Working...
      X