flat assembler
Message board for the users of flat assembler.

Index > Windows > RS232 API??

Author
Thread Post new topic Reply to topic
lilljocke



Joined: 28 Dec 2004
Posts: 34
Location: Sweden
lilljocke 20 Mar 2006, 17:10
Is there someone who can show me how to receve data from the com port??
Post 20 Mar 2006, 17:10
View user's profile Send private message Visit poster's website Reply with quote
UCM



Joined: 25 Feb 2005
Posts: 285
Location: Canada
UCM 20 Mar 2006, 21:45
sorry, i don't know much about this, but CreateFile should be able to open the com port for you
i don't know much else, scour the Win32 API

edit: there is a communications section in Win32 API, it describes this
for example, use GetCommState and SetCommState to set like baud rate, parity, etc..
Post 20 Mar 2006, 21:45
View user's profile Send private message Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier 20 Mar 2006, 23:32
lilljocke,

Read the info here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp

UCM was correct, you use CreateFile to open a port, and ReadFile/WriteFile to read and write from/to the port. Setting "interrupts" and handlers is more complicated. I use this technique to read data from a truck scale and write info to a slip printer and it works.

Another alternative is to use a "device driver" such as the WinIO library which you can find at www.internals.com This gives you access to the serial ports in a way which would be familiar to DOS programmers using in and out port instructions. I have never used this, but others say it works well.

hth,

farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 20 Mar 2006, 23:32
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.