Modbus on serial port

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Modbus on serial port

ariafrancesco@inwind.it
I am trying to implement the serial modbus protocol on gambas.
Bookcase was my intention to create a class that all could use but I have a problem that I do not succeed to resolve.
The instrument with which I try to communicate seems that it understands what I send but does not answer to me .
What you know version 1,0,3 of gambas has of the problems with the object of the serial port?

In order to create the string to send to the instrument I use:

  strOutput = Chr$(CByte(Val ("&H "& strNode))) & Chr$(3) & Chr$(CByte(Val ("&H" & Left$(varTemp, 2)))) & Chr$(CByte(Val ("&H "& Right$(varTemp, 2)))) & Chr$(0) & Chr$(1)

in order then to send it with:

PRINT # Sport, (strOutput & Chr$(CByte(Val("&H "& Right$(strCRC, 2)))) & Chr$(CByte(Val("&H" & Left$(strCRC, 2)))))

Is possible that problem is the character set ?
Gambas use UTF8 character set so is possible that using the Chr$ function the instrument does not understand?

P.S. I sure that the instrument receives the string , in fact it count the message and understand that it is for he (strNode = "1" node 1 of net modbus 485)

HELP!!

Is possible that I'm successful to write an OCX for the modbus in VB6 and does not succeed to make of the porting on Gambas!!!!!

P.S. 2 :-))  where I can find the rpm of last stable gambas for Mandriva?

THANKS To ALL



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Modbus on serial port

Werner-4
[hidden email] wrote:

>I am trying to implement the serial modbus protocol on gambas.
>Bookcase was my intention to create a class that all could use but I have a problem that I do not succeed to resolve.
>The instrument with which I try to communicate seems that it understands what I send but does not answer to me .
>What you know version 1,0,3 of gambas has of the problems with the object of the serial port?  
>
>In order to create the string to send to the instrument I use:
>
>  strOutput = Chr$(CByte(Val ("&H "& strNode))) & Chr$(3) & Chr$(CByte(Val ("&H" & Left$(varTemp, 2)))) & Chr$(CByte(Val ("&H "& Right$(varTemp, 2)))) & Chr$(0) & Chr$(1)
>
>in order then to send it with:
>
>PRINT # Sport, (strOutput & Chr$(CByte(Val("&H "& Right$(strCRC, 2)))) & Chr$(CByte(Val("&H" & Left$(strCRC, 2)))))
>
>Is possible that problem is the character set ?
>Gambas use UTF8 character set so is possible that using the Chr$ function the instrument does not understand?  
>
>P.S. I sure that the instrument receives the string , in fact it count the message and understand that it is for he (strNode = "1" node 1 of net modbus 485)
>
>HELP!!
>  
>Is possible that I'm successful to write an OCX for the modbus in VB6 and does not succeed to make of the porting on Gambas!!!!!  
>
>P.S. 2 :-))  where I can find the rpm of last stable gambas for Mandriva?  
>
>THANKS To ALL
>
>  
>
The latest stable version is 1.0.11. The download for all distributions
starts here: http://gambas.sourceforge.net/download.html
To find out if there is a problem with character conversion you might
want to hook up with a second computer using a terminal emulator program
that can display SOH DEL ESC NUL and all the other control characters.
Alternatively you could write a small gambas program for it simulating
modbus simple replies.

Just my 2 cents.

Regards,

Werner



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Modbus on serial port

Werner-4
Werner wrote:

> [hidden email] wrote:
>
>> I am trying to implement the serial modbus protocol on gambas.
>> Bookcase was my intention to create a class that all could use but I
>> have a problem that I do not succeed to resolve.
>> The instrument with which I try to communicate seems that it
>> understands what I send but does not answer to me .
>> What you know version 1,0,3 of gambas has of the problems with the
>> object of the serial port?
>> In order to create the string to send to the instrument I use:
>>
>>  strOutput = Chr$(CByte(Val ("&H "& strNode))) & Chr$(3) &
>> Chr$(CByte(Val ("&H" & Left$(varTemp, 2)))) & Chr$(CByte(Val ("&H "&
>> Right$(varTemp, 2)))) & Chr$(0) & Chr$(1)
>> in order then to send it with:
>>
>> PRINT # Sport, (strOutput & Chr$(CByte(Val("&H "& Right$(strCRC,
>> 2)))) & Chr$(CByte(Val("&H" & Left$(strCRC, 2)))))
>> Is possible that problem is the character set ?
>> Gambas use UTF8 character set so is possible that using the Chr$
>> function the instrument does not understand?
>> P.S. I sure that the instrument receives the string , in fact it
>> count the message and understand that it is for he (strNode = "1"
>> node 1 of net modbus 485)
>> HELP!!
>>  
>> Is possible that I'm successful to write an OCX for the modbus in VB6
>> and does not succeed to make of the porting on Gambas!!!!!
>> P.S. 2 :-))  where I can find the rpm of last stable gambas for
>> Mandriva?
>> THANKS To ALL
>>
>>  
>>
> The latest stable version is 1.0.11. The download for all
> distributions starts here: http://gambas.sourceforge.net/download.html
> To find out if there is a problem with character conversion you might
> want to hook up with a second computer using a terminal emulator
> program that can display SOH DEL ESC NUL and all the other control
> characters. Alternatively you could write a small gambas program for
> it simulating modbus simple replies.
>
> Just my 2 cents.
>
> Regards,
>
> Werner
>
> I just tried Rob Kudla's web site to look up Gambas for Mandriva but
> the site just serves an empty page.  Tough luck.


Werner



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Modbus on serial port

ariafrancesco@inwind.it
In reply to this post by ariafrancesco@inwind.it
---------- Initial Header -----------

From      : [hidden email]
To          : [hidden email]
Cc          :
Date      : Wed, 14 Sep 2005 15:45:58 +0800
Subject : Re: [Gambas-user] Modbus on serial port



 THANKS but the Rob Kudla's web site is down for a
 problem with the server's mather board .



> Werner wrote:
>
> > [hidden email] wrote:
> >
> >> I am trying to implement the serial modbus protocol on gambas.
> >> Bookcase was my intention to create a class that all could use but I
> >> have a problem that I do not succeed to resolve.
> >> The instrument with which I try to communicate seems that it
> >> understands what I send but does not answer to me .
> >> What you know version 1,0,3 of gambas has of the problems with the
> >> object of the serial port?
> >> In order to create the string to send to the instrument I use:
> >>
> >>  strOutput = Chr$(CByte(Val ("&H "& strNode))) & Chr$(3) &
> >> Chr$(CByte(Val ("&H" & Left$(varTemp, 2)))) & Chr$(CByte(Val ("&H "&
> >> Right$(varTemp, 2)))) & Chr$(0) & Chr$(1)
> >> in order then to send it with:
> >>
> >> PRINT # Sport, (strOutput & Chr$(CByte(Val("&H "& Right$(strCRC,
> >> 2)))) & Chr$(CByte(Val("&H" & Left$(strCRC, 2)))))
> >> Is possible that problem is the character set ?
> >> Gambas use UTF8 character set so is possible that using the Chr$
> >> function the instrument does not understand?
> >> P.S. I sure that the instrument receives the string , in fact it
> >> count the message and understand that it is for he (strNode = "1"
> >> node 1 of net modbus 485)
> >> HELP!!
> >>
> >> Is possible that I'm successful to write an OCX for the modbus in VB6
> >> and does not succeed to make of the porting on Gambas!!!!!
> >> P.S. 2 :-))  where I can find the rpm of last stable gambas for
> >> Mandriva?
> >> THANKS To ALL
> >>
> >>
> >>
> > The latest stable version is 1.0.11. The download for all
> > distributions starts here: http://gambas.sourceforge.net/download.html
> > To find out if there is a problem with character conversion you might
> > want to hook up with a second computer using a terminal emulator
> > program that can display SOH DEL ESC NUL and all the other control
> > characters. Alternatively you could write a small gambas program for
> > it simulating modbus simple replies.
> >
> > Just my 2 cents.
> >
> > Regards,
> >
> > Werner
> >
> > I just tried Rob Kudla's web site to look up Gambas for Mandriva but
> > the site just serves an empty page.  Tough luck.
>
>
> Werner
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server.
> Download it for free - -and be entered to win a 42" plasma tv or your very
> own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Modbus on serial port

Benoît Minisini
In reply to this post by ariafrancesco@inwind.it
On Wednesday 14 September 2005 08:57, [hidden email] wrote:

> I am trying to implement the serial modbus protocol on gambas.
> Bookcase was my intention to create a class that all could use but I have a
> problem that I do not succeed to resolve. The instrument with which I try
> to communicate seems that it understands what I send but does not answer to
> me . What you know version 1,0,3 of gambas has of the problems with the
> object of the serial port?
>
> In order to create the string to send to the instrument I use:
>
>   strOutput = Chr$(CByte(Val ("&H "& strNode))) & Chr$(3) & Chr$(CByte(Val
> ("&H" & Left$(varTemp, 2)))) & Chr$(CByte(Val ("&H "& Right$(varTemp, 2))))
> & Chr$(0) & Chr$(1)
>
> in order then to send it with:
>
> PRINT # Sport, (strOutput & Chr$(CByte(Val("&H "& Right$(strCRC, 2)))) &
> Chr$(CByte(Val("&H" & Left$(strCRC, 2)))))

If you don't end the PRINT with a semicolon, then a Chr$(10) is sent as end of
line. Is it what you want?

>
> Is possible that problem is the character set ?
> Gambas use UTF8 character set so is possible that using the Chr$ function
> the instrument does not understand?

You don't send strings on a serial port, you send bytes. Character set is only
used when displaying a byte sequence. And UTF-8 == ASCII when the byte is
between 0 and 127.

Regards,

--
Benoit Minisini
mailto:[hidden email]


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Loading...