MIAC with serial RS232

For MIAC users to discuss projects, applications, and any other issues related to the MIAC unit.

Moderators: Benj, Mods

Post Reply
thusharag
Flowcode v5 User
Posts: 46
Joined: Wed Jun 22, 2011 10:42 am
Has thanked: 9 times
Been thanked: 3 times
Contact:

MIAC with serial RS232

Post by thusharag »

Hi,
Kindly clarify the belows.
1. I need to know whether I can use RS232 communication with PIC MIAC (MI0235) then please let know the jumper selection. I can add RS232 in this MIAC in flowcode 5 and compile as well.
2. Can I use both CAN bus and RS2232 in same MI0235?. Because i can add, progrm and compile both together in one MIAC MI0235 in flowcode 5.
3. All above are required because i need to make a communication between one MIAC and two separate RS232 deferent devices (sensor and HMI). Can you suggest me a solution to get this done? Together please mention the required Flowcode version. Because as I know RS232 device can communicate with only one node.
Hooe yoir kind attention on above.

BR
Thushara.
Thanks & Regards,
Thushara Goonathilake.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MIAC with serial RS232

Post by Benj »

Hello,

The MI0235 only really has CAN as a form of communications. It sounds like you may instead need the MI5809 which includes RS232 and RS485. I would use RS485 to talk to multiple serial devices assuming you can limit comms to tx or rx at any one time. You would likely need Flowcode 7 or 8 to use this MIAC.

Another way would be to use a seperate CAN device to act as a bridge between the MIAC and the RS232 devices. You could maybe do this using E-blocks or another custom module setup. e.g. click or grove.

thusharag
Flowcode v5 User
Posts: 46
Joined: Wed Jun 22, 2011 10:42 am
Has thanked: 9 times
Been thanked: 3 times
Contact:

Re: MIAC with serial RS232

Post by thusharag »

Hi Benj,

thanks fir the reply. Hope you are in safe !!

I need to know some more details on RS485 communication to decide to use MI5809 together with Flowcode 8 for my new project (i need to buy all, that's why), SO kindly clarify the below matters in detail.
1. I have worked with RS 485 a lot but with a protocol like Modbus RTU. But you have not mentioned any protocol available in this MIAC. So what is the protocol available in MIAC MI5809?
2. As i know only one Master can be used in RS485 Modbus RTu with 256 slaves. How this happens in this MIAC?
3. i have two nodes in this projects and the MIAC should communicate with these two. one is an HMI (touch screen) and other one is a sensor. ( all other sensors are connected to analog inputs)SO if i get the MIAC as the master in RS485, will be able to communicate with the HMI for both side( read and write)
4. OR the HMI has UART port. So Can i use UART in MIAC (MI5809) to communicate with this HMI and RS485 to communicate with the sensor in same MIAC parallely?
5. Or kindly suggest me a solution to get this both communications done in one any MIAC.

BR,

Thushara.
Thanks & Regards,
Thushara Goonathilake.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MIAC with serial RS232

Post by Benj »

Hello,

1) RS485 basically builds on a standard UART where you can either transmit or receive, it allows multiple nodes to be connected together to a single master. You can use the RS485 interface as simple comms tx and rx or you can add a protocol e.g. Modbus. It's up to you.

2) RS485 works best with one master if possible, multi master is possible but it gets tricky to manage. Again it's largely up to the software interface and therefore up to you.

3) Is the HMI RS485 compatible? What HMI are you using and we can investigate for you.

4) This sounds like it should be possible

thusharag
Flowcode v5 User
Posts: 46
Joined: Wed Jun 22, 2011 10:42 am
Has thanked: 9 times
Been thanked: 3 times
Contact:

Re: MIAC with serial RS232

Post by thusharag »

Hi Benj,

Thanks for the reply.

Ill introduce the two modules and their literature with what i'm going to communicate with.

1. The HMI im going to use is in below URL
https://shuangying-ocean.en.alibaba.com ... 602cBdW2IT
The other literatures are attached.

2. The CO2 sensor - Only the sensor is planned to be connected without the its Original display comes with the sensor as per the details in the below link.
https://groupbuy.en.alibaba.com/product ... 770dHM5A8V

Litereture is attached.

These are the two modules i need to connect to the communication of one MIAC MI5809. Kindly see the possibility.

BR,

Thushara.
Attachments
ETCO2 - CO2 sensor communication details.docx
(27.77 KiB) Downloaded 223 times
HMI- User-Development-Guide-HMI Software.pdf
(1.88 MiB) Downloaded 251 times
HMI - Datasheet HMI 1.pdf
(1.97 MiB) Downloaded 231 times
Thanks & Regards,
Thushara Goonathilake.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MIAC with serial RS232

Post by Benj »

Hello,

The HMI requires a TTL level UART connection. The Sensor states RS232 but then suggests this might be TTL level too (5V/0V) and not RS232 +/- 12V.

I would maybe go with an E-block or an Arduino over a MIAC. Would this be a possibility. The MIAC is great but can't really do the TTL level UART comms easily. Bit of a square peg in a round hole.

The PIC E-block would be good as it has lots of UART connections available. The dsPIC might also be good as this has lots of ROM/RAM and speed but converting from 3V3 to 5V may be an issue. For an Arduino an Arduino Mega 2560 board would be a good suit as again it has plenty of UARTs avaialable.

thusharag
Flowcode v5 User
Posts: 46
Joined: Wed Jun 22, 2011 10:42 am
Has thanked: 9 times
Been thanked: 3 times
Contact:

Re: MIAC with serial RS232

Post by thusharag »

Hi Benj,

Finally i thought to ignore the sensor and go ahead with only the HMI.

In this case i need to to only few UART messages.
simply as bellow

Read data from HMi.
Send: 0xA5 0x5A 0x04 0x83 0x00 0x03 0x02
Here 0xA5 0x5A - command header
0x04 - command length (after the same)
0x83 - command(read the variable addresses)
0x00 0x03 - beginning address
0x02 - data length

Return: 0xA5 0x5A 0x08 0x83 0x00 0x03 0x02 0x00 0x01 0xFF 0xFF
Here 0xA5 0x5A - command header
0x08 - command length (after the same)
0x83 - command(read the variable addresses)
0x00 0x03 - beginning address
0x02 - data length
0x00 0x01 0xFF 0xFF - data
Using the above command i can read the data from the HMI easily as the data to be read from HMI is available in the variable registers in HMI.

Write data to the HMI
Send: 0xA5 0x5A 0x05 0x82 0x00 0x03 0x00 0x01
Here 0xA5 0x5A - command header
0x05 - command length (after the same)
0x82 - command(write to HMI variable addresses)
0x00 0x03 - beginning address
0x00 0x01 - data length

Using the above command i can write the data to the HMI variable addresses.

i hope this function can be achieved from a MIAC (MI5809) easily. in this case it should be able to get the data in the communication message (when read HMI) to the MIAC variables and values in the MIAC variables to the data in the communication message(when write the HMI) using the macros available in Flowcode inbuilt.
it is difficult to do with eblocks in terms of IOs in this matter.

Attached the literature of the MHI here for your reference.

Kindly comment on this.

BR

Thushara
Attachments
HMI- User-Development-Guide-HMI Software.pdf
(1.88 MiB) Downloaded 229 times
HMI - Datasheet HMI 1.pdf
(1.97 MiB) Downloaded 236 times
Thanks & Regards,
Thushara Goonathilake.

Post Reply