Difference between revisions of "3rd:RS232"
(Initial) |
(changed link) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
In this program you find packages for communicating via the RS232-interface of a computer. There is a | In this program you find packages for communicating via the RS232-interface of a computer. There is a native-class for the external predicates and an api-class for the glue code. These two classes are the heart of the program. | ||
Every port is seen as an object. So there is a serialport_class for interfacing. In that way it should be possible to use more ports at the same time. | Every port is seen as an object. So there is a serialport_class for interfacing. In that way it should be possible to use more ports at the same time. | ||
Line 5: | Line 5: | ||
To make RS232-communication possible between Visual Prolog and a microcontroller was the reason for building the program. The hardware demands are very small: pin two, three and ground is all that is needed. This means also that not all external predicates are present. | To make RS232-communication possible between Visual Prolog and a microcontroller was the reason for building the program. The hardware demands are very small: pin two, three and ground is all that is needed. This means also that not all external predicates are present. | ||
I had to use Kernel32.Lib which can be found in the | I had to use Kernel32.Lib which can be found in the Platform SDK from Microsoft. | ||
Distributing this library is not possible here . You have to get to the Microsoft-site for downloading the SDK, in case you do not have it already. | Distributing this library is not possible here. You have to get to the Microsoft-site for downloading the SDK, in case you do not have it already. | ||
The last version of the code compiles under the commercial as well as under the personal edition of Vip75 | |||
The program has been developed under | The first program has been developed under Windows XP sp2 but XP is no longer supported. However, the kernel32.lib I use is still the same and works under Windows 7,8 and 8.1. Very recently I tested the compiled program on a laptop with Windows 8.1 and a USB to serial converter. Furthermore on desktops with Windows 7 or Windows 8. I had no problems there so far. | ||
Using the packages, I wrote this test program for inspecting the RS232-communication at a very basic level. It reads out the buffer of a port at your command and you can send a byte sequence over the line. You should read the help file to discover how to do these things. | Using the packages, I wrote this test program for inspecting the RS232-communication at a very basic level. It reads out the buffer of a port at your command and you can send a byte sequence over the line. You should read the help file to discover how to do these things. | ||
There is no protocol | There is no protocol; just a byte sequence. If you should decide to use the packages then you might have to develop a protocol yourself. | ||
Programming the RS232 port is not easy. I am afraid | Programming the RS232 port is not easy. I am afraid; you have to spit through the code to see how the predicates are used. At essential points, I made a short comment, especially in the user interface part, to make your live a little easier. I think you should start there. Then there are two examples, where you can see how events are handled. | ||
If you want to give the program a try before downloading a library and so on, you can download the compiled program here: | If you want to give the program a try before downloading a library and so on, you can download the compiled program here: https://bensprikbord.nl/RS232/RS232.html. | ||
If you use two computers and a ''null'' modem cable, you are in business. | If you use two computers and a ''null'' modem cable, you are in business. | ||
And if you have a robot | And if you have a robot, talking VIP to him is fun! | ||
Contributed by Ben Hooijenga | |||
[http://discuss.visual-prolog.com/viewtopic.php?t=7662 Download the software] | [http://discuss.visual-prolog.com/viewtopic.php?t=7662 Download the software] |
Latest revision as of 15:07, 15 December 2019
In this program you find packages for communicating via the RS232-interface of a computer. There is a native-class for the external predicates and an api-class for the glue code. These two classes are the heart of the program.
Every port is seen as an object. So there is a serialport_class for interfacing. In that way it should be possible to use more ports at the same time.
To make RS232-communication possible between Visual Prolog and a microcontroller was the reason for building the program. The hardware demands are very small: pin two, three and ground is all that is needed. This means also that not all external predicates are present.
I had to use Kernel32.Lib which can be found in the Platform SDK from Microsoft. Distributing this library is not possible here. You have to get to the Microsoft-site for downloading the SDK, in case you do not have it already.
The last version of the code compiles under the commercial as well as under the personal edition of Vip75
The first program has been developed under Windows XP sp2 but XP is no longer supported. However, the kernel32.lib I use is still the same and works under Windows 7,8 and 8.1. Very recently I tested the compiled program on a laptop with Windows 8.1 and a USB to serial converter. Furthermore on desktops with Windows 7 or Windows 8. I had no problems there so far.
Using the packages, I wrote this test program for inspecting the RS232-communication at a very basic level. It reads out the buffer of a port at your command and you can send a byte sequence over the line. You should read the help file to discover how to do these things.
There is no protocol; just a byte sequence. If you should decide to use the packages then you might have to develop a protocol yourself.
Programming the RS232 port is not easy. I am afraid; you have to spit through the code to see how the predicates are used. At essential points, I made a short comment, especially in the user interface part, to make your live a little easier. I think you should start there. Then there are two examples, where you can see how events are handled.
If you want to give the program a try before downloading a library and so on, you can download the compiled program here: https://bensprikbord.nl/RS232/RS232.html.
If you use two computers and a null modem cable, you are in business.
And if you have a robot, talking VIP to him is fun!
Contributed by Ben Hooijenga