Announcement

Collapse
No announcement yet.

Setting Up and Using UART in Diablo16

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

  • Setting Up and Using UART in Diablo16

    Originally posted by Mick Burian View Post

    Many thanks for all your assistance with this Paul!!
    Hi Paul,

    Many thanks again for your help in formatting the values in the string objects! I really appreciate the lesson
    In regards to my second challenge, I had a read of the 3 links you provided and I have a question for you relating to the serial functionality.
    There was a lot of Arduino host coding examples but I am in need of how to code the Display side.

    The project I am working on involves the connection of the display to a PCB via a serial port.
    The display needs to display 3 values sent from the Host and for these to constantly update so some sort of loop.

    I need to have the process update the string objects from the serial port values read in. Forms 2 and 3 will send the corresponding Frequency or Current value back to the Host when the ENTER keyboard button is pressed.

    The values will be sent to the Host which will then do some processing and continue sending the 3 values (Voltage, Frequency and Current) to the Forms.

    Sorry, but I could not see much of an example in the 4D connecting to Arduino host about this.

    Hoping you can help again?



  • #2
    Hi Mick,

    I moved this inquiry to a new forum thread since this new inquiry fall under a different topic. Paul will be notified about this and he'll be able to reply when he can.

    I'll also try to help as much as I can.
    Last edited by Juniel Cruz; 2 weeks ago.
    Juniel Cruz

    Comment


    • #3
      Based on what I understand from your inquiry, you'd like to connect an Arduino and write a cusom program for the display to communicate using UART. This led me to think that you plan on using Designer or ViSi environments. I didn't consider VISi Genie Magic since you already mentioned that you can't find much of an example and I figured this is not what your were looking for.

      If that is the case, see my initial comments below.

      To be able to communicate with an Arduino or any host controller of your choice, the simplest communication protocol you can programmatically configure is UART. As you already know, this is what ViSi Genie and SPE utilizes.

      Here are a couple of documents you will need to get started:When learning about programming the display, these two documents should help you about all the features supported.

      Once you've set up UART, the same resources discussing physical connection to external host or Arduino should still apply.

      I hope this helped.
      Juniel Cruz

      Comment


      • #4
        Originally posted by Juniel Cruz View Post
        Based on what I understand from your inquiry, you'd like to connect an Arduino and write a cusom program for the display to communicate using UART. This led me to think that you plan on using Designer or ViSi environments. I didn't consider VISi Genie Magic since you already mentioned that you can't find much of an example and I figured this is not what your were looking for.

        If that is the case, see my initial comments below.

        To be able to communicate with an Arduino or any host controller of your choice, the simplest communication protocol you can programmatically configure is UART. As you already know, this is what ViSi Genie and SPE utilizes.

        Here are a couple of documents you will need to get started:When learning about programming the display, these two documents should help you about all the features supported.

        Once you've set up UART, the same resources discussing physical connection to external host or Arduino should still apply.

        I hope this helped.
        No. I do not want to connect to an Arduino. I detailed the question to Paul already. I was given examples on how to write Arduino host programs but I do not want this. I have a host I want to connect to but I am not interested in how to program the host.

        I just need to learn how to read and write to the serial port using ViSi Genie and how to populate string objects using ViSi Genit

        Comment


        • #5
          Okay, so you'd like to:
          1. Use ViSi Genie without a host controller
          2. Add a custom UART routine with ViSi Genie Magic
          If that is the case, the two documents I sent should still be useful. These documents discuss 4DGL and UART functions you need to use.

          To add the Serial/UART code, you might also want to check out the ViSi Genie Reference Manual. You'll be interested in section Genie Magic. This section discusses about some useful functions including writing to widgets as well us the location of which the code will be added.

          For example, if you want part of your code to be running in a loop. you need to add a MagicCode written for the Main Loop. If you need to initialize / setup once, you need a MagicCode for Pre or Post Genie Init. If you need to define a custom function like a modified WriteStr function, best to add it in Constants/Global/Data.

          Click image for larger version  Name:	MagicCode.png Views:	0 Size:	39.3 KB ID:	73951

          There's a lot more ViSi Genie Magic discussion here that you can check out. But MagicCode seems to be what you'll need.

          I hope this helped.
          Last edited by Juniel Cruz; 2 weeks ago.
          Juniel Cruz

          Comment


          • #6
            Originally posted by Juniel Cruz View Post
            Okay, so you'd like to:
            1. Use ViSi Genie without a host controller
            2. Add a custom UART routine with ViSi Genie Magic
            If that is the case, the two documents I sent should still be useful. These documents discuss 4DGL and UART functions you need to use.

            To add the Serial/UART code, you might also want to check out the ViSi Genie Reference Manual. You'll be interested in section Genie Magic. This section discusses about some useful functions including writing to widgets as well us the location of which the code will be added.

            For example, if you want part of your code to be running in a loop. you need to add a MagicCode written for the Main Loop. If you need to initialize / setup once, you need a MagicCode for Pre or Post Genie Init. If you need to define a custom function like a modified WriteStr function, best to add it in Constants/Global/Data.

            Click image for larger version Name:	MagicCode.png Views:	0 Size:	39.3 KB ID:	73951

            There's a lot more ViSi Genie Magic discussion here that you can check out. But MagicCode seems to be what you'll need.

            I hope this helped.
            No, it didn't but thanks for trying.

            I checked out all the app notes and reference manuals and was hoping for examples ... code examples...
            My issue is knowing the code... syntax... etc. I know where to put the code but I don't know how to code the functionality I am having issues with

            Comment


            • #7
              Have you checked the first two documents I mentioned?

              Here are a couple of documents you will need to get started:
              The first document should cover the syntax as it discusses about the programming language itself.

              The second document should cover the specific features supported by the display processor. You mentioned that you are looking for code examples; this is actually where you'll be able to find them. Each function have an example provided. The section I specified includes:
              • Setting up the Serial/UART baudrate - see com_SetBaud
              • Setting up the TX and RX pins (if using COM1 to COM3) - see COMx_TX_pin and COMx_RX_pin
              • Setting up a receive buffer - see com_Init/comx_Init
              • Send and read data - see serout/seroutx and serin/serinx
              The functions above should be enough for most applications. If you are looking for any specific functionality and can't find it, please let us know. We'll be happy to point you to the right direction.


              Quick Tips:
              • While in the middle of typing a function, you can press Ctrl+Spacebar to show all functions related to that.
              • You can quickly open a discussion of a function by clicking the typed function so that the cursor is in it and pressing F1.
              Juniel Cruz

              Comment


              • #8
                Originally posted by Juniel Cruz View Post
                Have you checked the first two documents I mentioned?[/LIST]The first document should cover the syntax as it discusses about the programming language itself.

                The second document should cover the specific features supported by the display processor. You mentioned that you are looking for code examples; this is actually where you'll be able to find them. Each function have an example provided. The section I specified includes:
                • Setting up the Serial/UART baudrate - see com_SetBaud
                • Setting up the TX and RX pins (if using COM1 to COM3) - see COMx_TX_pin and COMx_RX_pin
                • Setting up a receive buffer - see com_Init/comx_Init
                • Send and read data - see serout/seroutx and serin/serinx
                The functions above should be enough for most applications. If you are looking for any specific functionality and can't find it, please let us know. We'll be happy to point you to the right direction.


                Quick Tips:
                • While in the middle of typing a function, you can press Ctrl+Spacebar to show all functions related to that.
                • You can quickly open a discussion of a function by clicking the typed function so that the cursor is in it and pressing F1.
                The Display will be connected to the Host with a serial cable.... What does setting up TX and RX pins mean? and is there some sort of a limitation to only using COM1 to COM3??? What if I connect with COM4???? I have a connection on my PC while I am programming and the COM = 6.

                I am confused.

                Comment


                • #9
                  Originally posted by Mick Burian View Post

                  The Display will be connected to the Host with a serial cable.... What does setting up TX and RX pins mean? and is there some sort of a limitation to only using COM1 to COM3??? What if I connect with COM4???? I have a connection on my PC while I am programming and the COM = 6.

                  I am confused.
                  COM1/COM2/COM3 in this context is about the Diablo16 processor, not about your Host or your PC. Diablo has the ability to use multiple UART (com ports), so in this context it is solely about the processor and the module itself, nothing to do with your PC or the host.

                  The only thing you care about with "COM = 6" in context of your PC, is selecting the correct com port on the programmer side of Workshop, when you go to load your program on to your module. This is different to the above.

                  The above is around how you set up the com buffer, port, baud rate etc inside the 4DGL code inside Workshop4, for your module.
                  James

                  Comment

                  Working...
                  X