[fpc-pascal] Re: Accessing USB HID from Lazarus programs?

2011-03-20 Thread Bo Berglund
I posted this on the lazarus list but they suggested to send it to the
FPC list instead in order to possibly get better answers...

On Sun, 20 Mar 2011 10:04:28 -0500, Bo Berglund
 wrote:

>I need to create a program using Lazarus/FPC to access a data
>collection device built using a PIC24F series microprocessor with
>built-in USB support. The firmware makes the PIC processor register as
>a Human Interface Device (HID) class USB device.
>
>I understand that for the HID class one does not have to provide a USB
>driver, there is already a generic one on Windows and possibly also on
>Linux.
>And the HID interface is not limited to mice and such, for example the
>PicKit3 PIC programmer and ICE uses the HID driver and it can both
>program code into PIC:s and execute PIC code with breakpoints from
>within MPLAB (the PIC develeopment IDE).
>
>My objective is to read the data from the data collection device using
>the USB interface and display the data on screen and also save to the
>PC disk.
>My FPC program should be able to run on Windows and preferably also on
>Linux.
>
>But I can't find any good examples on how to access the USB HID
>device
>
>Can someone here please provide some help, links to code examples or
>similar?
>
>Or is this OT for this list since it is basically a hardware access
>question?
>


-- 
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Converting code from C++ to FP....

2011-03-20 Thread Micha Nelissen

Jorge Aldo G. de F. Junior wrote:

const has the same effect as fpc const before a parameter,


This is not true.


double* SX0
is the same as
double *SX0
or
double * SX0

so this becomes

const SX0 : pdouble (ugly pointer as array Cishism)


No! 'const double * X' in C makes the pointed-to data const, while 
'const X: PDouble' in pascal makes the parameter itself const. You 
cannot assign another address of a double to it, while you can in C.


In C terms, pascal can only do 'double * const X'. Pascal is not really 
useful this way, 'const' is generally only useful for structures and 
strings.


Micha
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: Re: [fpc-pascal] com port using prolific driver

2011-03-20 Thread johnelee1944

Paul and other responders, thanks. Think I'ma bit clearer how to do it now.

q1) My com device is an energy monitor that sends a block of xml data, 1000  
bytes or so, every 6 secs. Guess this means I might be better 'using getbuf  
or whatever it's called in synaser, rather than single char at a time? Any  
examples of using this welcome.


q2) does synaser work on win98/me?

Regards John

On , Paul Breneman  wrote:

John,






I'm trying to get data from a device via a serial (com) port, 9600 baud,


connected via the prolific cable (serial to usb). This allows one to  
connect


a serial device via a usb port (many new PCs do not have a real serial  
port.



I've loaded the prolific driver.





Anyone have fpc program that'll work on win xp.





I have some files here that might help you get started using the SynaSer  
package with FPC:



http://www.turbocontrol.com/simpleserial.htm





--



Regards,



Paul Breneman



www.dbReplication.com - VCL database replication components



www.TurboControl.com - Hardware and software development services



- Educational programming project for environment monitoring



- Information on using FreePascal for embedded systems



- Support information for the TurboPower open source libraries



___



fpc-pascal maillist - fpc-pascal@lists.freepascal.org



http://lists.freepascal.org/mailman/listinfo/fpc-pascal



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] FPC 2.4.2 i386 MacOS: Inc broken for Int64's

2011-03-20 Thread Tobias Giesen
Hello,

my app uses the built-in Inc function to add Int64 variables. 
Unfortunately, they are treated as UInt32, so the values are
truncated as 32 bit values.

Wow! That is an impressive bug. I assume it is known? What's the
recommendation, which FPC version should I use? Could it be an
incompatibility with a specific version of the Developer Tools 
from Apple?

It used to work fine a few years ago but no longer.

Cheers,
Tobias


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Accessing USB HID from Lazarus programs?

2011-03-20 Thread Henry Vermaak
On 20 March 2011 16:35, Bo Berglund  wrote:
>>I need to create a program using Lazarus/FPC to access a data
>>collection device built using a PIC24F series microprocessor with
>>built-in USB support. The firmware makes the PIC processor register as
>>a Human Interface Device (HID) class USB device.
>>
>>I understand that for the HID class one does not have to provide a USB
>>driver, there is already a generic one on Windows and possibly also on
>>Linux.
>>And the HID interface is not limited to mice and such, for example the
>>PicKit3 PIC programmer and ICE uses the HID driver and it can both
>>program code into PIC:s and execute PIC code with breakpoints from
>>within MPLAB (the PIC develeopment IDE).
>>
>>My objective is to read the data from the data collection device using
>>the USB interface and display the data on screen and also save to the
>>PC disk.
>>My FPC program should be able to run on Windows and preferably also on
>>Linux.
>>
>>But I can't find any good examples on how to access the USB HID
>>device

What you seen hidapi?

http://www.signal11.us/oss/hidapi/

You will probably have to translate the headers.

Henry
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] com port using prolific driver

2011-03-20 Thread Luca Olivetti
Al 20/03/11 19:47, En/na johnelee1...@googlemail.com ha escrit:
> Paul and other responders, thanks. Think I'm a bit clearer how to do it now.
> 
> q1) My com device is an energy monitor that sends a block of xml data, 1000 
> bytes or so, every 6 secs. Guess this means I might be better 'using getbuf 
> or whatever it's called in synaser, rather than single char at a time? Any 
> examples of using this welcome.

If each line of xml has a terminator (say, crlf), you can use RecvTerminated
to read line by line.
Or, you can use RecvBufferEx, RecvBufferString, RecvPacket.
All methods are documented in synaser source.

> 
> q2) does synaser work on win98/me?

No idea. I works under xp.

Bye
-- 
Luca
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC 2.4.2 i386 MacOS: Inc broken for Int64's

2011-03-20 Thread Jonas Maebe

On 20 Mar 2011, at 20:41, Tobias Giesen wrote:

> my app uses the built-in Inc function to add Int64 variables. 
> Unfortunately, they are treated as UInt32, so the values are
> truncated as 32 bit values.
> 
> Wow! That is an impressive bug. I assume it is known?

It has been fixed in svn trunk (r16289). It won't be in 2.4.x.

> What's the
> recommendation, which FPC version should I use?

I don't think there is any older FPC version that does not contain it. It 
remained hidden for so long because it only happened if range or overflow 
checking was enabled.

> Could it be an
> incompatibility with a specific version of the Developer Tools 
> from Apple?

No.


Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: Accessing USB HID from Lazarus programs?

2011-03-20 Thread Bo Berglund
On Sun, 20 Mar 2011 19:47:28 +, Henry Vermaak
 wrote:

>On 20 March 2011 16:35, Bo Berglund  wrote:
>>I need to create a program using Lazarus/FPC to access a data
>>collection device built using a PIC24F series microprocessor with
>>built-in USB support. The firmware makes the PIC processor register as
>>a Human Interface Device (HID) class USB device.
>>
>>I understand that for the HID class one does not have to provide a USB
>>driver, there is already a generic one on Windows and possibly also on
>>Linux.
>>And the HID interface is not limited to mice and such, for example the
>>PicKit3 PIC programmer and ICE uses the HID driver and it can both
>>program code into PIC:s and execute PIC code with breakpoints from
>>within MPLAB (the PIC develeopment IDE).
>>
>>My objective is to read the data from the data collection device using
>>the USB interface and display the data on screen and also save to the
>>PC disk.
>>My FPC program should be able to run on Windows and preferably also on
>>Linux.
>>
>>But I can't find any good examples on how to access the USB HID
>>device
>
>What you seen hidapi?
>
>http://www.signal11.us/oss/hidapi/
>
>You will probably have to translate the headers.

Thanks, interesting read. I looked over what I thought would be the
valid items and also tested the included enumeration test project,
which found my keyboard, mouse and Microchip PicKit3 programmer.
So far so good

But it looks like this is C or C++ stuff :-(
Is there any FPC translation anywhere?
I don't believe I can translate the C stuff properly myself to FPC.


-- 
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal