Pascal to C++ - Microsoft Windows

This is a discussion on Pascal to C++ - Microsoft Windows ; Hey, Im doing a project which invoves using a serial A/D converter, I have been given some code in Pascal but i need this translated into C++ code in order to use it in the compiler that i have been ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Pascal to C++

  1. Pascal to C++

    Hey,


    Im doing a project which invoves using a serial A/D converter, I have
    been given some code in Pascal but i need this translated into C++
    code in order to use it in the compiler that i have been told to use, I

    am only new to both types of code and any help you could give me would
    be greatly appreciated,


    Thanks in advance,


    Rod


    The code is as shown here


    Program serial_adc;


    {Serial port AD converter circuit control program by Tomi Engdahl}


    Uses Crt;


    Const
    combase=$2f8;
    MCR=combase+4;
    LCR=combase+3;
    MSR=combase+6;


    Procedure Initialize_converter;
    Begin
    Port[MCR]:=3;
    Port[LCR]:=0;
    End;


    Function Read_value:byte;
    Var
    value:byte;
    count:byte;
    Begin
    value:=0;
    Port[MCR]:=1;
    For count:=0 to 7 Do Begin
    value:=value SHL 1;
    Port[LCR]:=64;
    If (port[MSR] and $10)=$10 Then Inc(value);
    Port[LCR]:=0;
    End;
    Port[MCR]:=3;
    Read_value:=value;
    End;


    Begin
    Initialize_converter;
    Repeat
    Writeln(Read_value);
    Until KeyPressed;
    End.


  2. Re: Pascal to C++

    cwynnes@gmail.com writes:
    > Hey,
    >
    >
    > Im doing a project which invoves using a serial A/D converter, I have
    > been given some code in Pascal but i need this translated into C++
    > code in order to use it in the compiler that i have been told to use, I
    >
    > am only new to both types of code and any help you could give me would
    > be greatly appreciated,


    A crosspost to pascal and c++ newsgroups would be a lot more helpful
    than anything you're likely to get around here I'll wager. You can
    search for these newsgroups at groups.google.com

    I've done a fair bit with C++, but no Pascal, and not on the Windows
    platform.


    Best Regards,
    --
    Todd H.
    http://www.toddh.net/

  3. Re: Pascal to C++

    I just searched with a Google Advanced Search with "Exact Phrase"
    set to: Pascal to C

    Got quite a few matches pointing to converter software.

    Skip

    On 6 May 2005 07:00:57 -0700, cwynnes@gmail.com wrote:

    -|Hey,
    -|
    -|
    -|Im doing a project which invoves using a serial A/D converter, I have
    -|been given some code in Pascal but i need this translated into C++
    -|code in order to use it in the compiler that i have been told to use, I
    -|
    -|am only new to both types of code and any help you could give me would
    -|be greatly appreciated,
    -|
    -|
    -|Thanks in advance,
    -|
    -|
    -|Rod
    -|
    -|
    -|The code is as shown here
    -|
    -|
    -|Program serial_adc;
    -|
    -|
    -|{Serial port AD converter circuit control program by Tomi Engdahl}
    -|
    -|
    -|Uses Crt;
    -|
    -|
    -|Const
    -| combase=$2f8;
    -| MCR=combase+4;
    -| LCR=combase+3;
    -| MSR=combase+6;
    -|
    -|
    -|Procedure Initialize_converter;
    -|Begin
    -| Port[MCR]:=3;
    -| Port[LCR]:=0;
    -|End;
    -|
    -|
    -|Function Read_value:byte;
    -|Var
    -| value:byte;
    -| count:byte;
    -|Begin
    -| value:=0;
    -| Port[MCR]:=1;
    -| For count:=0 to 7 Do Begin
    -| value:=value SHL 1;
    -| Port[LCR]:=64;
    -| If (port[MSR] and $10)=$10 Then Inc(value);
    -| Port[LCR]:=0;
    -| End;
    -| Port[MCR]:=3;
    -| Read_value:=value;
    -|End;
    -|
    -|
    -|Begin
    -| Initialize_converter;
    -| Repeat
    -| Writeln(Read_value);
    -| Until KeyPressed;
    -|End.


  4. Re: Pascal to C++

    comphelp@toddh.net (Todd H.) writes:

    > A crosspost to pascal and c++ newsgroups would be a lot more helpful
    > than anything you're likely to get around here I'll wager.


    I'll be damned, Frank proved me dead wrong! :-)


    --
    Todd H.
    http://www.toddh.net/

  5. Re: Pascal to C++

    Todd H. wrote:
    > comphelp@toddh.net (Todd H.) writes:
    >
    >> A crosspost to pascal and c++ newsgroups would be a lot more helpful
    >> than anything you're likely to get around here I'll wager.

    >
    > I'll be damned, Frank proved me dead wrong! :-)


    Yep, I think he deserves a round of applause for that one.



  6. Re: Pascal to C++

    "John of Aix" writes:

    > Todd H. wrote:
    > > comphelp@toddh.net (Todd H.) writes:
    > >
    > >> A crosspost to pascal and c++ newsgroups would be a lot more helpful
    > >> than anything you're likely to get around here I'll wager.

    > >
    > > I'll be damned, Frank proved me dead wrong! :-)

    >
    > Yep, I think he deserves a round of applause for that one.


    Here here. [applause]


    --
    Todd H.
    http://www.toddh.net/

  7. Re: Pascal to C++

    06 May 2005 15:29:10 -0500, Todd H.:

    > "John of Aix" writes:
    >
    >> Todd H. wrote:
    >>> comphelp@toddh.net (Todd H.) writes:
    >>>
    >>>> A crosspost to pascal and c++ newsgroups would be a lot more helpful
    >>>> than anything you're likely to get around here I'll wager.
    >>>
    >>> I'll be damned, Frank proved me dead wrong! :-)

    >>
    >> Yep, I think he deserves a round of applause for that one.

    >
    > Here here. [applause]


    thanks.
    But read the comments; I didn't solve it completely *g*
    --
    Gruß | Greetings | Qapla'
    "All I ask is a tall ship and a star to steer her by."
    http://www.stud.tu-ilmenau.de/~frst-ii/

+ Reply to Thread