Convert an Hex To integer (Val Function)

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Convert an Hex To integer (Val Function)

ariafrancesco@inwind.it
Why the function :

Val("&HC3C2") respond with -15422 (a short)
when the correct value is 50114 (an integer) ??

How can I convert an Hex like C3C2 in an Integer ??





-------------------------------------------------------
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
|

Re: Convert an Hex To integer (Val Function)

Pablo Vera
Put an ampersand at the end, like this:

   Val("&HC3C2&")

it returns 50114.

Saludos,
Pablo Vera
__________________________________________________________1

[hidden email] wrote:

> Why the function :
>
> Val("&HC3C2") respond with -15422 (a short)
> when the correct value is 50114 (an integer) ??
>
> How can I convert an Hex like C3C2 in an Integer ??
>
>
>
>
>
> -------------------------------------------------------
> 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
|

Re: Convert an Hex To integer (Val Function)

ariafrancesco@inwind.it
In reply to this post by ariafrancesco@inwind.it
Thaks Pablo .
Now my program works .

I'm near to implemts the modbus protocol on Gambas.
For the moment i can read from a Serial modbus net (RS485).
Last step is implemt write OP (50% of the work is done)

Thanks to all  :-))

---------- Initial Header -----------

From      : [hidden email]
To          : [hidden email]
Cc          :
Date      : Mon, 19 Sep 2005 08:53:31 -0500
Subject : Re: [Gambas-user] Convert an Hex To integer (Val Function)


> Put an ampersand at the end, like this:
>
>    Val("&HC3C2&")
>
> it returns 50114.
>
> Saludos,
> Pablo Vera
> __________________________________________________________1
>
> [hidden email] wrote:
> > Why the function :
> >
> > Val("&HC3C2") respond with -15422 (a short)
> > when the correct value is 50114 (an integer) ??
> >
> > How can I convert an Hex like C3C2 in an Integer ??
> >
> >
> >
> >
> >
> > -------------------------------------------------------
> > 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
>



-------------------------------------------------------
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
|

Re: Convert an Hex To integer (Val Function)

ariafrancesco@inwind.it
In reply to this post by ariafrancesco@inwind.it
:-((

Work but only unsigned .

:-((


---------- Initial Header -----------

From      : [hidden email]
To          : "gambas-user" [hidden email]
Cc          :
Date      : Mon, 19 Sep 2005 22:14:25 +0200
Subject : Re: [Gambas-user] Convert an Hex To integer (Val Function)

> Thaks Pablo .
> Now my program works .
>
> I'm near to implemts the modbus protocol on Gambas.
> For the moment i can read from a Serial modbus net (RS485).
> Last step is implemt write OP (50% of the work is done)
>
> Thanks to all  :-))
>
> ---------- Initial Header -----------
>
> From      : [hidden email]
> To          : [hidden email]
> Cc          :
> Date      : Mon, 19 Sep 2005 08:53:31 -0500
> Subject : Re: [Gambas-user] Convert an Hex To integer (Val Function)
>
>
> > Put an ampersand at the end, like this:
> >
> >    Val("&HC3C2&")
> >
> > it returns 50114.
> >
> > Saludos,
> > Pablo Vera
> > __________________________________________________________1
> >
> > [hidden email] wrote:
> > > Why the function :
> > >
> > > Val("&HC3C2") respond with -15422 (a short)
> > > when the correct value is 50114 (an integer) ??
> > >
> > > How can I convert an Hex like C3C2 in an Integer ??
> > >
> > >
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > 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
> >
>
>
>
> -------------------------------------------------------
> 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
|

Re: Convert an Hex To integer (Val Function)

Pablo Vera
What ???

Did you try to convert a negative hex number ?, like:

   Val("-&HC3C2&")

this returns: -50114

Or what do you mean ?

Saludos,
Pablo Vera

[hidden email] wrote:

> :-((
>
> Work but only unsigned .
>
> :-((
>
> ---------- Initial Header -----------
>
>>Thaks Pablo .
>>Now my program works .
>>
>>I'm near to implemts the modbus protocol on Gambas.
>>For the moment i can read from a Serial modbus net (RS485).
>>Last step is implemt write OP (50% of the work is done)
>>
>>Thanks to all  :-))
>>
>>---------- Initial Header -----------
>>
>>>Put an ampersand at the end, like this:
>>>
>>>   Val("&HC3C2&")
>>>
>>>it returns 50114.
>>>
>>>Saludos,
>>>Pablo Vera
>>>__________________________________________________________1
>>>
>>>[hidden email] wrote:
>>>
>>>>Why the function :
>>>>
>>>>Val("&HC3C2") respond with -15422 (a short)
>>>>when the correct value is 50114 (an integer) ??
>>>>
>>>>How can I convert an Hex like C3C2 in an Integer ??


-------------------------------------------------------
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
|

Re: Convert an Hex To integer (Val Function)

ariafrancesco@inwind.it
In reply to this post by ariafrancesco@inwind.it
I find this in the Gambas help
  +------------------------------------+--------------------------+
  ! Hexadecimal short signed integers. ! &H1F5, &HFFFF, &FFFF     !
  ! Hexadecimal signed integers.       ! &H10BF332E, &10BF332E    ! <==
  ! Hexadecimal unsigned integers.     ! &H8000&, &HFFFF&         !
  +------------------------------------+--------------------------+

I think that probably the 3rd line is the solution of my problem.
I'll try it and then say you if it work.

I find it searcing "Costants" in the Gambas Help

Asta manana Pablo   :-) me falta la egne
Saludos , de Italia

---------- Initial Header -----------

From      : [hidden email]
To          : [hidden email]
Cc          :
Date      : Tue, 20 Sep 2005 11:22:11 -0500
Subject : Re: [Gambas-user] Convert an Hex To integer (Val Function)

> What ???
>
> Did you try to convert a negative hex number ?, like:
>
>    Val("-&HC3C2&")
>
> this returns: -50114
>
> Or what do you mean ?
>
> Saludos,
> Pablo Vera
>
> [hidden email] wrote:
> > :-((
> >
> > Work but only unsigned .
> >
> > :-((
> >
> > ---------- Initial Header -----------
> >
> >>Thaks Pablo .
> >>Now my program works .
> >>
> >>I'm near to implemts the modbus protocol on Gambas.
> >>For the moment i can read from a Serial modbus net (RS485).
> >>Last step is implemt write OP (50% of the work is done)
> >>
> >>Thanks to all  :-))
> >>
> >>---------- Initial Header -----------
> >>
> >>>Put an ampersand at the end, like this:
> >>>
> >>>   Val("&HC3C2&")
> >>>
> >>>it returns 50114.
> >>>
> >>>Saludos,
> >>>Pablo Vera
> >>>__________________________________________________________1
> >>>
> >>>[hidden email] wrote:
> >>>
> >>>>Why the function :
> >>>>
> >>>>Val("&HC3C2") respond with -15422 (a short)
> >>>>when the correct value is 50114 (an integer) ??
> >>>>
> >>>>How can I convert an Hex like C3C2 in an Integer ??
>
>
> -------------------------------------------------------
> 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