Serial port communication

 

How I can communicate via serial port with external equipment monitoring and control with string or int data type?

 
Write a DLL.
 
To this solution you could have saved the answer
 
To this rude poster, I shouldn't have bothered.
 
Usually I think WH is a bit rough around the edges, but I have to say, I think this time he was the one being civil, and the OP needs to tone it back some.
 
Sorry if anyone was offended, but I do not understand if you/we really are here to help/learn. If I ask for help because he has damaged my car and I reply that I take to the garage and you will tell me if that's a help.
 

It may be the case that win32 api already has ways to write to the serial port, eg here , or already has a dll, in which case OP would need to know how to import  the win32 functions from mql.

 
My idea is to communicate a control device with GSM communication to send SMS without ethernet.
The uC is constantly supervising communication PC <-(RS232/USB)-> uC; and MT4 connection state.
Alarms / failures would be sent by SMS.
I dont need excessive speed or data, only "int" variables to control counter and codes  to pre-recorded messages in the uC.


The Win32 API were my first idea with "Importing Function (#import)", but  MQL4 not recognize "HANDLE hComm;"and I locked


I would also like to know if there is any web page as myfxbook or fxcopy that notified  about connection failures to accounts and send SMS alarm
 

I have basic grasp of what it is I think you are trying to do here, although I am not 100% sure of that.  But I am 100% sure I do not know how to implement it.  I will post what I see you are trying to do here ruben, for other people who might not be understanding what it is you are saying based on your original post.

The issue is that there are 2 devices linked by a serial connection of some sort (basically instead of ethernet, they would potentially be hardwired together through the serial port of the PC).  The uC (not sure what this part is) is constantly watching the serial comms for events (kind of like an event in C++ style programming).  Notification would be made and certain procedures would be started when certain related events happen, like alarms and/or failures of certain things.  Counters could also be one of the things modified by the messages sent through the serial port information, although for this I would think this part would have to be set up external to the system.  The system could send the information that X happened, and then it would be the responsibility of the external stuff to actually count and keep track of it.

Hopefully this is a little more detailed (and accurate) explanation of what you want to do ruben, and even more hopefully, it helps someone else understand who has an idea on how to make this happen for you.

Serial connection example (I hope)

 
When you have your PC at home and want to monitor faults and alarms you have several options , if there is ethernet, the PC works , MT4 runs smoothly and the Script or the EA works , all messages can be reported by:
- Messages on the PC
- email
- SMS via ethernet
- MT4 mobile
the problem appears if any fails; software or hardware .

I am evaluating an alternative :
CONTROL SYSTEM FAILURE (economic )
Failure to supervise :
- Faulty connection to the server ( ethernet, network , power, ... )
- Crash Script ( EA ) or MT4
- Faulty PC
- ....
the microcontroller supervises the operation and send the SMS

My idea has 2 options :
A - The Script ( EA ) communicates directly through the serial port to the micro .

B - The Script ( or EA ) communicates with a program (via pipeline) and this program communicates via the serial port to the microcontroller . The advantage of this system is that the program could control multiple MT4

                 


The part of the microcontralador have solved , I am now evaluating options about PC and MT4
 
I hope I explained better. Thank You.

( There would also be another option, a supervisor account server warns you via SMS if the account is turned off. )
Reason: