Hi Kris,
thanks for reporting this bug. The same behaviour occurs to me. I'll send this error to developers.
Cheers,
Jan
Hi Kris,
thanks for reporting this bug. The same behaviour occurs to me. I'll send this error to developers.
Cheers,
Jan
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.
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
@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?
@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.
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);
Best regards,
Jan
Error -106 means Invalid parameter. Error codes are documented here: https://www.rexygen.com/doc/ENGLISH/MANUALS/BRef/BRef_ENGap3.html
Cheers,
Jan
@belgacom I'm sorry, decadic ASCII value for "d" is 100, not 64.
i2c_bufTx[3] =100; //d
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.
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
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:
For I2C communication you should:
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:
The 0001 value is the traceID and 1 (0x1) is value of i2c_bus_handle. If i2c_bus_value is negative, something went wrong.
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;
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
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.
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
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:
@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:
You can also look here, where similar problem was solved:
https://forum.rexygen.com/topic/23/read-write-modbus/9?_=1608627568594
Hi, yes, it's almost certainly a licensing issue. Please check your mail. I will send you further instructions.
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:
For example REGISTER_16 (UINT16) value 0x4272 = 17010 will be divided to LSB = 0x72 = 114 and MSB = 0x42 = 66.
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
Hi Toni,
your settings in the 80-candrvt.sh file is correct. Please follow these steps:
That should show us what's going wrong.
Thanks for your cooperation,
Jan
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
Hi, could you provide some more information?
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
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
@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.