News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

IR control

Started by firehawk, February 25, 2006, 03:42:34 PM

Previous topic - Next topic

firehawk

Hi. I am new here. I hope someone is able to help me in my mission. I apologise if this is the wrong forum to post but its my best shot!


I am new to assembly, I have always wanted to learn it as I am a very deep down technical core type of guy - I have only done Assembly in College. I however program in other languages such as .NET.

What I am trying to do is I am trying to use RAW/serial IR on a mobile device. Now, after extensive programming and research - I found out that this certain type of mobile device (or the range of them) unfortunatly does not support RAW IR. it has IRDA.

The issue is with the driver I believe as the hardware manufacturer of the phones (who are really not great) did not implement support for RAW IR.

I have been developing firstly in .NET 2.0 for access to serial port however it throws me an error. (simple write "hi").

I went low level/native code to have direct access to COM port using:

CreateFile()
WriteFile()
CloseFile()

and so on - I still get errors reported back from the OS. After banging my head on the wall, and with some of my colleagues - found out that it appears to maybe be a driver issue.

Apperently pocket PC's have RAW IR support as with a smartphone, it does not. It kinda sucks.


I then thought ok, well how about if we go for assembly? make some driver/connection to have access to RAW IR (COM3 I believe) from which I can call from a higher language.

Of course this is NOT the ideal way but its better than nothing.

I am wondering - am I completely wrong in this way? Can anyone help me understand where the problem is - if I am right/wrong?

Much appreciated for your VALUED input :)

PBrennick

You cannot write directly to COM3 or any other port in any language using any version of Windows.  You MUST write a driver to do this.

You CAN write directly to these ports from DOS, however.  I think you need to do this in CE, though.  I don't know much about CE. Anyway you probably plan to catch the stream on a desktop so you actually need to write 2 drivers.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

farrier

Quote from: PBrennick on February 25, 2006, 07:29:14 PM
You cannot write directly to COM3 or any other port in any language using any version of Windows.  You MUST write a driver to do this.

Not true!

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

firehawk,

This has been discussed a number of times, Search the board for this topic and you will find a numer of threads which offer a number of good techniques.

hth,

farrier
It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)

PBrennick

farrier,
As is  pointed out in your link...
QuoteOne thing to note about port names is that traditionally they have been COM1, COM2, COM3, or COM4. The Win32 API does not provide any mechanism for determining what ports exist on a system. Windows NT and Windows 95 keep track of installed ports differently from one another, so any one method would not be portable across all Win32 platforms.
Which means I am correct.  You cannot write directly to COM3 (which is an IRQ).  Read your own quotes.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

farrier

PBrennick,

Determining which ports exist on the system, and 'connecting' to it are two different things.  On my system , the IRLink is reported as COM3 and I can and do  connect to it thru the linked techniques.  I've never done anything useful with this, other than trigger an IR detector while trying to build a hardware project.

I do use the same technique to read/write to COM ports and LPT ports, to access scales and printers.  This works with Win95 thru WinXP, everyday, many different machines, no driver or tricky techniques required.  I promise!

I've never tried to programmatically determine which ports are associated with a modem/IRLink/serial port.  Don't know how to do this!

farrier
It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)

PBrennick

Farrier,
Thank you for the info although it contradicts everything I have been taught.  Does anyone else have anthing to offer because I am CERTAIN that you cannot access IRQs from Windows, only from DOS.
Paul
The GeneSys Project is available from:
The Repository or My crappy website

Mark Jones

Paul, what about this?

http://www.masmforum.com/simple/index.php?topic=3894.0

The (very limited) experience I've had with IR and IRDA, was not pleasant. It was an IR adapter for an HP printer / laptop. Never did get it working reliably.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

PBrennick

Mark,
I am aware of that.  It uses a library and allows access to the ports but not the IRQs.  Do not confuse access to IO as access to IRQs.
Paul
The GeneSys Project is available from:
The Repository or My crappy website

farrier

PBrennick,

I'm not sure where the reference to IRQ's came from.  IR yes,  IRQ ?

farrier
It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)

tenkey

And to make things clearer, IRQ is interrupt request, IR is infrared.
A programming language is low level when its programs require attention to the irrelevant.
Alan Perlis, Epigram #8

PBrennick

Because in DOS Ports are controlled by IRQs but you cannot do that in Windows. I've been trying to make that point through out this thread to the point that it is beginning to irk me.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

PBrennick

Tenkey,
That is just plain insulting.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

farrier

PBrennick,

The original poster asked about Sending and Receiving serial information thur IR ports using Windows programming.  No mention of DOS or IRQ's.

Sorry for any confusion on my part.

farrier
It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)

PBrennick

Farrier,
You evidently missed the point of that posting.
QuoteI went low level/native code to have direct access to COM port using:

This can ONLY be done using IRQs, your method IS NOT low level.  It is MIDLEVEL to HIGHLEVEL depending on if it is assembly or C.  I accept your apology.  I don't expect everyone to understand real LOWLEVEL as it is seldom used any more, but since he said he is a tech type guy and did no assembly since college I would be willing to bet he only knows Microcode and you had to use IRQs in Microcode because it loads during the BIOS load before DOS and/or Windows loads.  BIOS programming only recently allowed MIDLEVEL using C but it still must be interpreted before the Microprocessor can understand it and only is acceptable because of the fast processors of today, unfortunately there is a speed sacrifice so I wish they did not do that but people are getting lazy these days.  Now you know, please remember.  It was necessary for me to tell him, also, please do not interfere by misleading him.  It is VERY irritating.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

farrier

PBrennick,

Wow.

If you look at the link I provided, it uses:

CreateFile()
WriteFile()
CloseFile()


Standard Win32 SDK stuff.  Not Low or Mid level stuff.  I read that and assumed the original poster was having the same trouble I had before I found the site I linked to.

I understand low level serial programming, in CP-M, Dos, and Win 3.1, & for 6801 MicroContollers.  So I know the difference!

I hope we haven't scared off firehawk,  what he was trying to do was quite interesting.

My last comment here.  Unless firehawk asks for more help.  I've already made all the mistakes that can be made with:


CreateFile()
WriteFile()
ReadFile()
CloseFile()

Once again, sorry for this ugliness.

If I was irritating, it was the farthest thing from my original intention.

farrier
It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)