Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

COM serial port output

Status
Not open for further replies.

gvanto

Member level 1
Member level 1
Joined
Aug 17, 2004
Messages
41
Helped
4
Reputation
8
Reaction score
0
Trophy points
1,286
Activity points
442
I would like to, using C++ (Dev-Cpp but anything is fine), output a digital number (not sure how many bits) to my PC's serial port (or USB if possible?) and then use an digital-to-analogue converter to convert the signal into analogue form.

Its for a small research project.

I know basic C++ programming but haven't ever output stuff to the serial COM port (or read in for that matter). Since its serial output will prob need to shift-register it into a register, then DAC it out to analogue. Im sure there are all sorts of timing issues.

Any advice will be much appreciated!
gvanto
 

I would use a traditional RS-232 transceiver, such as MAX232 for instance (remember, the signals are +/-12V) and then feed the data to a microcontroller, which will interpret the it and output the required command/ data to the actual DAC.
All this is required because the DAC does not "understand" the same serial protocol the serial port uses. So you use a micro as a translator.
Depending on how you write the micro code, you will be able to use this with various applications (since you can, for example, output/ receive everything simply as ASCII codes, without worrying about the DAC, data format, etc. the micro takes care of that). It all becomes just another thing hooked up to your PC (just like an old printer, for instance). You could even use it with hyperterminal.
 

    gvanto

    Points: 2
    Helpful Answer Positive Rating
Thanks VVV, I will pursue this path!
gvanto
 

If you have knowlage on programming microcontrollers then the option of using a microcontroller (additional stage, controlled via COM port) to control AD converter is OK.
But, what (using your C skills) if you get direct control over AD converter through the paralell port?
There you have D0 - D7 lines (plus some ACK lines) and they can be directly connected to any AD converter without additional stages ..
Consider this option ..
Regards,
IanP
 

    gvanto

    Points: 2
    Helpful Answer Positive Rating
ACtually, this was the idea that I had initially in mind IanP, but wasnt sure whether its a viable option. It makes more sense though to output data parrallel since data output and acquisition will be faster (and no shift registers involved to get data into parralel).

Any idea what rate data is output on the parralel port (can it be used for other stuff than printers?) if for example Im using a PC of 800MHz processor speed. (Sorry but my knowledge of C++ is very basic and doesn't quite stretch to networking and ports I/O, yet!)

Im a little concerned that the DAC I will require will have to quite high spec (ie. ka-ching $$) to meet par-port output requirements, but Im guessing the output rate can be set (?).

Any sort of examples of using the parrallel port for i/o in C/C++ would be a great help.

Many thanks,
gvanto
 

Here are some examples in C on reading and writing data over SPP(standard parallel port):
https://www.phanderson.com/printer/ds1620/ds1620.html
https://www.phanderson.com/printer/ltc1392/ltc1392.html
and:
**broken link removed**

Speed
Q: How can Parallel Port ISA card support quoted rates of data transfer in excess of 1MB/sec ? As far a I know every in/out command for an ISA bus address takes at least 1 microsecond to perform REGARDLESS of processor speed ?

A: A simple parallel-port read or write does take one ISA-bus cycle, and on most systems, the bus speed is around 1.3 Mhz, so one cycle is a little under 1 microsecond. A complete data transfer on the original parallel port usually takes at least 4 cycles, however: check the Busy status, write the data, bring Strobe low, then high. On ports that support EPP and ECP modes, in these modes the port hardware does the handshake, and a complete transfer can take place in 1 bus cycle.

There are at least two ways of getting faster data transfers: Some ports support a "fast mode" that uses the ISA bus's NOWS (no wait state) signal to cause the CPU to skip 3 wait states. This mode is twice as fast, or around 2.7 Mhz. ECPs also include hardware support for data decompressing (& sometimes compressing, though that's often left for software), so the effective rate of data transmission can be much faster than the number of bytes written or read per second. Also, ECPs may be able to transfer data between the host's and peripheral's ECP buffers at rates greater than 1 Mhz, though the buffers are typically just 8 bytes.

Regards,
IanP
 

    gvanto

    Points: 2
    Helpful Answer Positive Rating
Wow thanks IanP for these pages, they are gold!

gvanto
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top