Recent

Author Topic: 1-Wire (MicroLan) programming  (Read 12190 times)

3bier

  • Newbie
  • Posts: 3
1-Wire (MicroLan) programming
« on: December 06, 2006, 10:52:58 am »
Hi all,

I'm new here, and new to Lazarus. But I do have a question for wich I hope I can find the answer here.

I want to be able to read and write to 1-wire devices (from Dallas Semiconductors) using a Lazarus written application in Linux.
I have found a SDK from Dallas with some Delphi demo code and units but I'm not shure if they are usable for Lazarus.
I know I can import a Delphi Project, but can't find which version of Delhpi is supported.
Maybe someone has allready done this before?

Here is some info from one of the demo files. Maybe this is helpful for giving an answer to the question if these are useable.

***********

TEMPDL32 : This utility uses TMEX to view a read the temperature from
             a DS1920/DS1820. It requires the windows 95/NT, TMEX drivers
             to be present.
    Compiler : Borland Delphi 2.0
    Version : 3.10                                                       }

unit Tempmain;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, iBTMEXPW, StdCtrls, ExtCtrls, RdProf;

**********

Regards,

Ed.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2582
RE: 1-Wire (MicroLan) programming
« Reply #1 on: December 06, 2006, 10:59:34 am »
Delphi code itself should be compatible, however if you don't have the sources of the iBTMEXPW unit, you may need to write the dll imports yourself.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

3bier

  • Newbie
  • Posts: 3
Re: RE: 1-Wire (MicroLan) programming
« Reply #2 on: December 07, 2006, 07:36:03 am »
Quote from: "Marc"
Delphi code itself should be compatible, however if you don't have the sources of the iBTMEXPW unit, you may need to write the dll imports yourself.


I do have the code. But I noticed a lot of errors in declarations when I tried to compile the demo.
I will trie again.
Thanx for the reply.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2582
RE: Re: RE: 1-Wire (MicroLan) programming
« Reply #3 on: December 07, 2006, 11:10:26 am »
try to compile in delphi mode (add a {$mode delphi} at the start of the unit)
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

3bier

  • Newbie
  • Posts: 3
Re: RE: Re: RE: 1-Wire (MicroLan) programming
« Reply #4 on: December 07, 2006, 11:28:15 am »
Quote from: "Marc"
try to compile in delphi mode (add a {$mode delphi} at the start of the unit)


Hmm no luck so far.
There are some units missing. Wintypes, Winprocs and messages. I tried replacing them bij LCLIntf and LMessages, but no luck so far.
There is 1 form in the demo source, and I can't even get that to display :-(

Maybe this is to much for a beginner. I succeeded in doing some simple programming in Lazarus, but making Delphi code working in Lazarus seems to be an other ballgame all together.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
RE: Re: RE: Re: RE: 1-Wire (MicroLan) programming
« Reply #5 on: December 07, 2006, 12:00:12 pm »
This isn't hard. Just read each error message and fix them one at a time.

There is a guide for code conversion here:

http://wiki.lazarus.freepascal.org/Code_Conversion_Guide

And if you get stuck, just ask for more help here, preferably with the code that is causing trouble and the error message it gives.

PS: By correctly using IFDEFs you can make the code still be compilable with Delphi. For example:

{$ifdef fpc}
  {$mode delphi}
{$endif}

 

TinyPortal © 2005-2018