Click to See Complete Forum and Search --> : sending a byte to serial port
jvr2
April 20th, 2001, 03:43 AM
Hello,
How can I send a byte (-> 8 bits) to a serial port ?
Is there a program for testing this ?
(e.g. Hyperterminal)
Or can I use a dos-prompt for doing this ?
With kind regards.
shyam_shiv
May 2nd, 2001, 04:18 AM
try out the following in c for this you need to include dos.h file in your dos development enviorment
outportb(potrtaddress, data)
eg. outportb(ox2f8, 0xff) ; //to send 255
In order to check the the transfer I beleive you can short the pins 2 and 3 with a led or wire and check for the same data in the input stream buffer of the serial port using inportb() function in TC++ or borland C++
If you are unable to do the aforesaid feel free to contact
sfd7678
June 14th, 2001, 09:32 PM
Hi..
I am interested to know more about using serial port in the my program
however, i have lack of idea about dos.h library.. where could i find the info, or could you send me a copy if you have one..
thanks
sfd7678
June 14th, 2001, 09:59 PM
hai
I am interested to know more about dos.h and the call function associated with it eg outportb and inportb
well, i you can say that I AM INTERESTED with serial programming
and IT IS MY FIRST TIME.. any help???
your help is higly appreciated
regards
shyam_shiv
June 14th, 2001, 11:59 PM
hi there,
Before I can tell you more about dos.h I would like to know development platform and OS you r doing your coding, as dos.h is not packaged with all the compilers.
I would like you to appreciate by rating the post.
Thanks
Shyam
sfd7678
June 15th, 2001, 03:42 AM
well.. i am thinking of using borland c++ version 4.. but i have been looking at MFC library.. and I talk with my boss.. he said that he may bought me VC++ V6 for me..i am using win 95&98
which one is the best compiler?
BJTiso
July 23rd, 2001, 08:55 AM
The complexity of this depends on whether youre using win32 or a dos-based program. For dos, you can just outportb to 0x3f8 the byte you want to send. For win32 it is more complicated, you have to set up the serial port as a file using CreateFile (look in msdn for usage), and setup a hFile. I personally would recommend using dos for simplicity. For dos, code examples are all over the web, including ones with software interrupts.
mbs
January 29th, 2002, 12:06 PM
I want to receive bytes from serial port ie. I want to get output of epabx to computer and want to save in windows environment .cause at present in dos i have
a utility calle gcap...
thak you,
Mahedra
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.