473,385 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Pascal to C++

Hey,

Im doing a project which invoves using a serial A/D converter, I have
been given some C 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.

Jul 23 '05 #1
1 2013

<ro********@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Hey,

Im doing a project which invoves using a serial A/D converter, I have
been given some C 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,


You've got C code in Pascal? I'm not sure what that means...? :-)

The code below is not something that can be translated into "standard" C++
code, which is what this forum discusses. It contains several things for
which you'll need some third-party software or platform API for, such as
direct memory access (for which you may need special hardware driver
software, if you're running something like Windows XP), and for checking
keypresses.

You might ask on a newsgroup devoted to the platform you're working under.

-Howard

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chris Gordon-Smith | last post by:
I am tying to call a Pascal function from C++, and vice versa. Does anyone know how to do this, or where detailed information on this topic can be found? For the C++ to Pascal call I have...
24
by: Faith Dorell | last post by:
I really donīt like C.You can write better programs in BASIC than in C, if you donīt like this language. I donīt understand how C became so popular, although much better programming languages...
14
by: digital | last post by:
hello anyone... pls explain me , how different between function and procedure for C/C++ and Pascal. Thankx......
28
by: Skybuck Flying | last post by:
Hi, I think I understand now a bit better what the difference is between a c compiler and a pascal compiler. For example: When compiling source code with a pascal compiler. The pascal...
17
by: David Scemama | last post by:
Hi, I'm writing a program using VB.NET that needs to communicate with a DOS Pascal program than cannot be modified. The communication channel is through some file databases, and I have a huge...
6
by: kkrish | last post by:
hi, I am working on an old program written in c.The program uses a function like this "unsigned long int far pascal ReadFile(char *buff,unsigned long int *size)" . Is this a PASCAL...
15
by: jacob navia | last post by:
Programming languages come and go. Still is amazing that in this survey from http://www.devsource.com/article2/0,1895,2016936,00.asp the C language comes second, right after Java. Java # What...
0
by: dhruba.bandopadhyay | last post by:
Am using Borland C++ 4.5 for the old dos.h APIs. It appears that newer versions of compilers stop support for the oldskool DOS routines. Am trying to convert/port an oldskool Pascal program that...
7
by: SMALLp | last post by:
Hy! I desperately need help! I need to make application that would accept Pascal code and check if it returns good results. My idea is (from a beginner point of view) to make application in...
54
by: Ruud | last post by:
Hallo allemaal, During the conversion of my program from Pascal to C, I was more or less able to find the C equivalent of most Pascal functions so far. Only four gave me some real trouble. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.