Announcement

Collapse
No announcement yet.

Serial com with SK-43DT

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

  • Serial com with SK-43DT

    I am not familiar with graphics CPU’s or 4D systems. I design servo motion systems.

    We just ordered a SK-43DT.

    We currently have a hand held unit to program one of our control systems. There are about 70 setup and tuning parameters. I do this now with a LCD character display, keypad, and 8051 based CPU. The comm. Link is an RS422 running our own protocol. The same protocol can optionally be used with the Ethernet option. Our distributors are asking about a touch screen.

    I know I can do this using serial mode. That should be easy.

    I would like to get rid of the 8051 CPU and do the entire app in the SK-43DT. I would have to write the code to use the serial port to handle the protocol and get the variables into the 43DT for editing and then back out to our system. There are also status variables we would need updated to the screen when not in program mode. The screen has to poll the system using the protocol for this feature.

    Is this feasible to do easily? Or would I be better off to just use the serial mode and another processor. I plan to replace the 8051 with a Rabbit CPU if we go that route.

    Opinions/help appreciated.

  • #2
    It sounds like you could do the entire app using ViSi without any issues, other than the learning curve, which you would also have on the Rabbit, I guess
    Mark

    Comment


    • #3
      We use a lot of Rabbits, no learning curve there.

      I can't find much documentation about using Visi, namely sample programs showing how the serial port is used. The code appears to be a cross between C and Pascal. Without sample programs or phone support I doubt I'll have the time trying to figure this out.

      If I knew someone competent around here to sub it to, I might do that.
      Last edited by ccsial; 30 May 2015, 09:19 AM.

      Comment


      • #4
        If you create a 'simple' genie program and 'save it as a visi program' you will see plenty of serial port stuff.

        Since ViSi is 'on top of' designer all the designer samples are applicable, have a look at File, Samples, Picaso Designer, PICASO - SERIAL COMMS

        The Diablo16 Internal functions reference describes all the commands
        Mark

        Comment


        • #5
          Thanks Mark, I see the samples way down there now. I'll play around with it when it arrives.

          Comment


          • #6
            Got my unit today. I loaded the Picaso serial keypad program and played with, made some changes, all OK. I am going to start with that sample to build my app. I will use Designer. If I did in serial mode I’d have to do the screens manually anyway.

            Now for my question. The sample app is landscape mode. I need to be in portrait. How do I change the sample program to be in portrait? I know the buttons may be off but I will fix that. I need the text to print in portrait.

            Thanks.

            Comment


            • #7
              Not sure which sample app you mean, but for Genie programs the orientation is set in the Project, Display settings.

              For other platforms you use the gfx_ScreenMode() function or its variants
              Mark

              Comment


              • #8
                That was what I needed. It looks like this is going to work out quite well. I down loaded the 4DGL function document. It looks like a pretty comprehensive instruction set. It looks like I can do the project without the Rabbit. I'm sure I'll have another question sometime but for now I think I understand it pretty well. We'll see how it works out when I start writing functions for all the different pages.

                Thanks Mar, Al

                Comment


                • #9
                  Another question. Will the following code snippet receive data at 115200 baud with no delay between characters and not miss any data?

                  I have not tested this code, it is more of a sample of what I need to do, which is to receive a string at 115200. The Rabbit and 8051 have an interrupt driven serial port so this has not been an issue.

                  var ch;
                  var ptr;

                  ptr:=0;
                  repeat
                  ch := serin();
                  if (ch != -1)
                  str_PutByte([CHR] ch,ptr);
                  ptr++
                  endif

                  if (ch == 3) // ETX, end of message
                  str_PutByte(0,ptr); // terminate string
                  break; // Exit recieve loop
                  endif
                  forever

                  Comment


                  • #10
                    This is more of what I wanted. I don't want the ETX in the string. Does this code look correct? It does compile.

                    var ch;
                    var ptr;

                    ptr:=0;
                    repeat
                    ch := serin();
                    if (ch != -1)
                    if(ch == 3)
                    str_PutByte(0,ptr); // terminate string
                    break; // Exit recieve loop
                    else
                    str_PutByte(ch,ptr);
                    ptr++;
                    endif
                    endif
                    forever

                    Comment


                    • #11
                      That might, or might not work.

                      Use the buffered comms if you want to ensure that nothing is missed. see com_Init()
                      Mark

                      Comment


                      • #12
                        With buffered comms that code looks like it will work just fine
                        Mark

                        Comment


                        • #13
                          Hoe do I use a buffered comm?

                          I can't figure out how to convert a 16 bit word to a string. I found a fp version. How do you do this with an 16 bit integer?

                          Comment


                          • #14
                            No sure I understand your questions.

                            You use buffered comms just by setting it up using com_Init() as per the manual. Then you use serin 'as per normal'

                            you can convert a 16bit word to a string using print([UDEC5] vword) ; have a look in the manual. If you want to write that string to other than the display use the to() function
                            Mark

                            Comment


                            • #15
                              I have spent over an hour looking in the book. I guess I'm dumb.

                              Could you give me an example of using the to() Keep in mind I don't know this stuff as well as you.

                              var data[20];
                              var n;

                              I want to get the string number in 'data' to 'n'. Same as a C language atoi.

                              I have the serial port and keypad working but can't figure out this simple conversion.

                              I

                              Comment

                              Working...
                              X