7 Replies Latest reply on Feb 23, 2016 2:08 PM by MagnusLundin

    serial communicate

    user_304190885

      hi i need to communicate USBUART (DMA, USUART_LoadInEP) to graph the data, but the program asks me the following configurations:

         

      ******************************************************************************************************
      h = openserial(p,smode,translation,handshake,xchar,blocking,timeout)
       

         

      p - port number, or port device name. Numbers are mapped in the following standard way    

         

      smode - string, communication parameters, in the form "baud,parity,data_bits,stop_bits"

         

      translation - string, either "auto", "binary", "cr", "crlf" or "lf". Default is "binary".

         

      handshak - string, either "none", "rtscts", "xonxoff" or "dtrdsr"

         

      xchar - xon and xoff characters

         

      timeout - timeout for reading? msec

         

      blocking - boolean, blocking mode of the serial channel. If %t, Scilab hangs until all the requested characters are read from or written to the serial port. Default is %f.

         

      h - string, handle to the serial port file returned by TCL    

         

      **********************************************************************************************************

         

      which is chosen for this type of data ???      

        • 1. Re: serial communicate
          MagnusLundin

          USBUART is not a UART, its a usb pipe 'pretending' to be a UART type searial port.

             

          Port number, thats for your operation system, where does the PSoC USBUART show up ?

             

          smode - you can probably say anything here, since the USB transmission doesnt use it.

             

          translation - thats between your PSoC code and the PC application (Scilab ?) what format is sent and how should it be interpreted. Dont ask us, what are you sending ?

             

          handshape is is none, unless you decide to read handshake signals in PSoC USBUART and implement the logic

             

          No handshake, no xon-xoff

             

          Timeout - How long should the Scilab wait for the PSoC before deciding it doesnt work

             

          Blocking - same thing, bot a PSoC issue, what should Scilab do if there is not data available ?

             

          h can be good if you want to refer to the openend connection to the PSoC device

             

          This type of data -- well  --  whatis YOU type of data?

             

           

             

          I dont want to be rude, but its your problem, you are trying to solve something, you write code on the PSoC, you select and configure components, you decide the data formats and data structures.

             

          When you are using readymade components with readymade datastructures, you must understand them, in order to connect other computers and software. We can help, but it is your problem.

          • 2. Re: serial communicate
            user_49271930

            It seems you can  not  enter all data.
            like this:
            h = openserial(1, "9600, n, 8, 1")

            • 3. Re: serial communicate
              user_304190885

              I send datas through a DMA psoc 5LP by this array of numbers but this program will receive as a string but the data are bad

              • 4. Re: serial communicate
                MagnusLundin

                That certainly looks like binary data interpreted by the receiver as numbers in text format. So the string, that doesnt really contain text or numbers in text format from the looks of it, must be interpreted by Scilab as data in binary format.

                   

                So first you should make Scilab take each received byte and print the decimal/headecimal value, not print it as a ascii character.

                   

                Then you can compare with what was sent to see how Scilab should be told to handle them.

                   

                At this point it is probably good to make a PSoC test project that sends a simple sequence of exactly known numbers.

                • 5. Re: serial communicate
                  user_304190885

                  the problem is to send data to the psoc 5LP by usbuart to scilab when converted to number sends me an error but a Scilab function (asciimat ()) sends me data. I have to check if they are numeric

                  • 6. Re: serial communicate
                    user_304190885

                    very interesting was saved as array and comply math

                    • 7. Re: serial communicate
                      MagnusLundin

                      This is the eternal fun of different (binary) representations of numbers. They are all sent as a sequence of bytes over the communications channel, but their meaning and interpretation are different. Mix them up the wrong way and you will suffer, make them work together and you will vbe happy.