Navigation

    REXYGEN Community Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. reitinge
    3. Posts
    R
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by reitinge

    • RE: ALBI FB inside SubSystem

      Hi Kris,
      thanks for reporting this bug. The same behaviour occurs to me. I'll send this error to developers.

      Cheers,
      Jan

      posted in Bug reports
      R
      reitinge
    • RE: Increase HMI size.

      Hi Bruno,
      you can change the size of your HMI in HMI Designer with File -> Document Properties -> Custom size. Please note that the aspect ratio is especially important. The width and height adapt to the monitor to some extent. The aspect ratio remains the same.

      posted in REXYGEN HMI Designer
      R
      reitinge
    • RE: REX Studio Slows PC Performance

      Hi Mike,
      we're sorry you have these problems with Rexygen. We have seen similar behaviour in our larger projects. That is why we are currently working on a new version of Rexygen Studio based on newer technologies. This version should be released soon and should have known bugs from the old version fixed. Please wait for the new version, which should be faster.

      Cheers,
      Jan

      posted in Bug reports
      R
      reitinge
    • RE: RC Servo PWM control.

      You are welcome πŸ™‚

      posted in Monarco HAT
      R
      reitinge
    • RE: Python FB

      @belgacom
      Hi Arnaud, was this problem caused by downloading to a local computer instead of a Raspberry too? Btw. when you installed Rexygen studio, did you check the Python function blocks option?
      54ccfd91-5ecc-41a7-83f4-1ad29fea161d-image.png

      posted in REXYGEN Studio
      R
      reitinge
    • RE: I2C EZO component

      @belgacom
      Happy new year to you too. You are welcome. I'm sorry for decadic <-> hexadecimal converting trouble. I usually send values as a hex, but I thought the decimal values would work as well.

      1. For converting DEC/HEX values into string, you can use something like this:
          int i;    
          char message[5];    
          /*bufRx[1] = 51;    
          bufRx[2] = 46;    
          bufRx[3] = 56;    
          bufRx[4] = 57;    
          bufRx[5] = 54;*/    
          for (i=1; i<6; i++)    
        	message[i-1] = bufRx[i];    
          Trace(1,message); 
        
      2. Yes, you can use one Rexlang block for reading / writing. The easiest way is to use some type of simple if-else or switch-case structure in the main() function. Rexlang provides functions as Sleep() or Suspend() (see documentation https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/REXLANG.html#x270-26900015) but I think the right way is to send a request and periodically checking if the answer received. You should change the period of your task where the Rexlang block is too. https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/EXEC.html The Rexlang block source code (and all others blocks in the task) are executed only once per period time.

      Best regards,
      Jan

      posted in Communication (RS232
      R
      reitinge
    • RE: I2C EZO component

      Error -106 means Invalid parameter. Error codes are documented here: https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/BRef_ENGap3.html

      • Please, delete the space between Trace and (.
      • Check value of the parameter p0 in the Rexlang block (attached figure). 24b4564a-93f8-4b58-8b55-551866ceadce-image.png
        This is the value which is set into the variable i2c_dev. In my case, it is the bus /dev/i2c-1. This depends on your wiring.
      • Are you sure, you are running the Rexygen program on your Raspberry? The Error: REXLANG open this file type is not possible on this platform indicate, that you might run on your local PC and there is no I2C bus.

      Cheers,
      Jan

      posted in Communication (RS232
      R
      reitinge
    • RE: I2C EZO component

      @belgacom I'm sorry, decadic ASCII value for "d" is 100, not 64.

      i2c_bufTx[3] =100;   //d
      
      posted in Communication (RS232
      R
      reitinge
    • RE: I2C EZO component

      Trace() function has capital T. Find Rexlang documentation for details (https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/REXLANG.html#x270-26900015).

      The start and stop of each message is generated automatically with the I2C command. In main() method, you should need to specify only i2c_bufTx array and number of bytes from this array, which will be send. You can try following for Find example:

      i2c_bufTx[0] = 70;   //F
      i2c_bufTx[1] = 105;  //i
      i2c_bufTx[2] = 110;  //n
      i2c_bufTx[3] = 64;   //d
      i2c_write_count = 4; 
      i2c_read_count = 0; //nothing to read
      //Sending data via I2C
      i2c_ret_fun = I2C(i2c_bus_handle, i2c_chip_address, i2c_bufTx, i2c_write_count, i2c_bufRx, i2c_read_count);
      

      The init () method does not change, nor does the exit() method.

      posted in Communication (RS232
      R
      reitinge
    • RE: Can driver

      Hi Toni,
      FilterIdMask can be used for filtering messages from more devices. In your case, there is only one device, so you can set FilterIdMask as 0xfff. For message decomposing, use the INTSM blocks (www.rexygen.com/doc/ENGLISH/MANUALS/BRef/INTSM.html). The basic example of using INTSM block can be found in this thread: https://forum.rexygen.com/topic/174/reading-and-writing-4-byte-floating-point-from-modbus?_=1609251284153
      For decomposing a byte value into bits can be used block BDOCT(www.rexygen.com/doc/ENGLISH/MANUALS/BRef/BDOCT.html).

      Cheers,
      Jan

      posted in Communication (RS232
      R
      reitinge
    • RE: I2C EZO component

      Hi Arnaud,
      it's always a little bit tricky to get communication done without testing and remotely, but I'll do my best.

      At beginning, it is handy to enable Information messages from Rexygen block in the system log:

      1. Open RexDraw and connect to your Target device (in the menu Target -> Connect or F7 key).
      2. Click on Target menu again and select Configure System Log.
      3. Check the Function block messages -> Information box (as marked on attached figure) and hit the OK button.
        55921c75-19ac-40f6-84e8-c733dd528a1c-image.png

      For I2C communication you should:

      1. Firstly, you should open communication channel on specific bus. This is done only once in the init() method in Rexlang with command i2c_bus_handle = OpenI2C(deviceName);, where deviceName is name of the bus you want to communicate on. For example /dev/i2c-1:
        i2c_bus_handle = OpenI2C("/dev/i2c-1");
        Please check, if communication was established successfuly. You can do that with the Trace() command:
        Trace(traceID,value);
        For example:
        Trace(1,i2c_bus_handle);
        If you run your script, you should see in the Log something like this:
        a719830f-3a01-42c6-a6a1-077d36422833-image.png
        The 0001 value is the traceID and 1 (0x1) is value of i2c_bus_handle. If i2c_bus_value is negative, something went wrong.

      2. Next step is setting address of your device (0x63 for you). This step is done only once too in the init() method: i2c_chip_address = 0x63;

      3. You have to prepare data which you want to send. Use the i2c_bufTx array variable which is prepared in the MCP3422 example. For example on this image
        ad6c2c12-0275-4551-a838-b771f624625d-image.png
        you should set following values to i2c_bufTx array: i2c_bufTx[0] = 1; i2c_bufTx[1] = 57; i2c_bufTx[2] = 46; i2c_bufTx[3] = 53; i2c_bufTx[4] = 54; i2c_bufTx[5] = 48; i2c_bufTx[6] = 0;
        Be aware, in the Example the array has length only 3 bytes and you need 7 bytes. So enlarge the array in Declaration variables section.

      4. Use the I2C() method. This method will send and receive data in one step. You can modify the main() method of MCP3422 example as follow:

      i2c_bufTx[0] = 1;
      i2c_bufTx[1] = 57;
      i2c_bufTx[2] = 46;
      i2c_bufTx[3] = 53;
      i2c_bufTx[4] = 54;
      i2c_bufTx[5] = 48;
      i2c_bufTx[6] = 0;
      
      i2c_write_count = 7; // you are sending 7 bytes
      i2c_read_count = 5; // you are expecting receive 5 bytes long (you probably need to modify it!!!)
      //Sending data via I2C
      i2c_ret_fun = I2C(i2c_bus_handle, i2c_chip_address, i2c_bufTx, i2c_write_count, i2c_bufRx, i2c_read_count);
      

      The answer of your device should be stored in the i2c_bufRx array now. Make sure you read the correct number of bytes and have a long enough array.

      Try some easy write/read command first and let me know, if it works!

      Cheers,
      Jan

      posted in Communication (RS232
      R
      reitinge
    • RE: Python FB

      Hi Arnaud,
      can you post the Log of your Target device here, please? After an unsuccessful download, click on Target -> Connect-> connect to your device. Click on Target again and then Show System Log. You should see something like this:
      1ce0f8c1-e7c9-4702-93a1-b0934b4393ad-image.png

      posted in REXYGEN Studio
      R
      reitinge
    • RE: Reading and Writing 4 byte floating point from modbus

      @brunofporto Hi Bruno,
      you can read and write into one register simultaneously, but you need two items in the Modbus Master registers table. Rexygen doesn't support Read and Write flags at one Master Item. You should set something like this into your table for one register value:
      8b435268-4377-45db-8768-4a04c4dc68a5-image.png

      You can also look here, where similar problem was solved:
      https://forum.rexygen.com/topic/23/read-write-modbus/9?_=1608627568594

      posted in Modbus RTU
      R
      reitinge
    • RE: Can driver

      Hi, yes, it's almost certainly a licensing issue. Please check your mail. I will send you further instructions.

      posted in Communication (RS232
      R
      reitinge
    • RE: Reading and Writing 4 byte floating point from modbus

      Dear Bruno,
      in my opinion, Rexygen does not natively support the string type in Modbus registers. If reading ASCII values ​​is enough for you, use several REGISTER_16 or REGISTER_32 items and INTSM blocks (www.rexygen.com/doc/ENGLISH/MANUALS/BRef/INTSM.html). Use settings:

      • shift = 0, mask = 255 for reading LSB
      • shift = 8, mask = 255 for second byte, etc.

      For example REGISTER_16 (UINT16) value 0x4272 = 17010 will be divided to LSB = 0x72 = 114 and MSB = 0x42 = 66.
      d7b31cfd-ce43-4622-aca5-bf2cd8f42914-image.png

      If you want to convert ASCII characters into a string, you should use a Python block (https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/PYTHON.html).

      Cheers,
      Jan

      posted in Modbus RTU
      R
      reitinge
    • RE: Can driver

      Hi Toni,
      your settings in the 80-candrvt.sh file is correct. Please follow these steps:

      1. Open RexDraw and connect to your Raspberry Pi (in the menu Target -> Connect or F7 key).
      2. Click on Target menu again and select Configure System Log.
      3. Check the I/O driver messages -> Information box (as marked on attached figure) and hit the OK button.
        67fc1e1a-a716-45fc-bca7-34c59b0fd859-image.png
      4. Download your project again to your Raspberry Pi (Project -> Compile and Download or F6 key)
      5. Open Target -> Show System Log, make a printscreen of this log and post it here.

      That should show us what's going wrong.

      Thanks for your cooperation,
      Jan

      posted in Communication (RS232
      R
      reitinge
    • RE: Reading and Writing 4 byte floating point from modbus

      Hi Bruno,
      how did you set your Modbus RTU registers at Monarco HAT? Please, open your MBM driver block in the Exec file of your project. Click on Configure button and Modbus registers editor will appear. For reading a 4 byte floating point real number, you should add an Item with proper Item Address, Type REGISTER_DOUBLE and marked Readable. The MSB first format should be the native format of Rexygen numbers, so you don't need to check the Swap Bytes box, but maybe the Swap Words box will be useful. With a right configuration of this two boxes (Swap Bytes and Swap Words), you should observe correct real numbers direct at the output of the MBM__FLWF_TEMPERATURE flag and no additional conversion should be needed.
      I usually use this site for checking the proper byte order: http://www.binaryconvert.com/convert_double.html
      If you have the opportunity to directly monitor the values of communicated bytes, please post them here.
      Documentation for Modbus in Rexygen is there: https://www.rexygen.com/doc/ENGLISH/MANUALS/MbDrv/MbDrv_ENG.html

      Cheers,
      Jan

      posted in Modbus RTU
      R
      reitinge
    • RE: Can driver

      Hi, could you provide some more information?

      1. What device are you trying to communicate with via the CAN bus?
      2. Can you share your Rexygen project here?
      3. What type of CAN Bus Sniffer do you have?

      For the CAN driver to work properly, you need to edit the file /etc/rexcore/rexcore.env.d/80-candrvt.sh on your Raspberry Pi. Uncomment lines from "REX_CAN_DEV=can0" onwards and fill the proper value to the "REX_CAN_BITRATE=...".

      Cheers,
      Jan

      posted in Communication (RS232
      R
      reitinge
    • RE: I2C EZO component

      Hi Arnaud,
      you can use the Rexlang block for I2C communication. As Scoobsalamander has mentioned, there are some I2C examples that can be used as a starting point of your own implementation. Use the Start from an Example Project choice in the Rexygen Studio menu and search 0502 Generic I2C Communication. Description of examples can be found at https://www.rexygen.com/example-projects/0502_Generic_I2C_Communication/0502_Generic_I2C_Communication.html.
      Documentation for Rexlang block is here: https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/REXLANG.html.
      Best regards,
      Jan

      posted in Communication (RS232
      R
      reitinge
    • RE: RC Servo PWM control.

      @reitinge To be more specific, for an open-drain digital output you will need to subtract the calculated duty cycle value from 1:

      Duty_cycle = 1 - Calculated_duty_cycle
      

      For 1 ms width pulse and frequency 50 Hz:

      Duty_cycle = 1 - 0.05 = 0.95
      

      For 2ms width pulse and frequency 50 Hz:

      Duty_cycle = 1 - 0.1 = 0.90
      

      If you are using a DO as an 5V voltage source, see the Using digital outputs in 5V logic circuits chapter here:
      https://support.monarco.io/help/digital-outputs-of-the-monarco-hat
      The logic is "reversed":
      If DOUT=OFF, no connection to ground exists and you will measure 5V at the output. If DOUT=ON, connection to ground is made and there will be 0V at the output. That's how you can control devices which use 5V logic.

      I apologize for the mystification in previous posts.

      posted in Monarco HAT
      R
      reitinge