Serial Port Initialization - Modem Control Register

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
yasar11732
Member
Member
Posts: 28
Joined: Thu Sep 27, 2018 5:10 pm
Libera.chat IRC: yasar
Location: Turkey
Contact:

Serial Port Initialization - Modem Control Register

Post by yasar11732 »

Hi,

I am following Serial Ports Tutorial.

In the Initilization section, modem control register is written multiple times with different flags.

Code: Select all

outb(PORT + 4, 0x0B);
Here, bits 0,1 and 3 is set, so Data Terminal Ready pin is set, Request to Send pin is set and OUT2 pin is set. If I understand correctly, OUT2 pin enables IRQ's.

Code: Select all

outb(PORT + 4, 0x1E);
Here, DTR is unset, RTS is still set, OUT1 is set, OUT2 is set and LOOPBACK is set.

I understand that by writing 0x1E to modem register, loopback mode is activated. But, what is the purpose of writing 0x0B to it first?

Best Regards,
yasar11732
Member
Member
Posts: 28
Joined: Thu Sep 27, 2018 5:10 pm
Libera.chat IRC: yasar
Location: Turkey
Contact:

Re: Serial Port Initialization - Modem Control Register

Post by yasar11732 »

So, what is the correct way to do this? Just skip this line?

Code: Select all

outb(PORT + 4, 0x0B);
Sorry if this is a obvious question. I tried reading some technical documents, I ended up more confused :)

Best Regards,
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: Serial Port Initialization - Modem Control Register

Post by Octocontrabass »

Yeah, you can skip that line. I'd also suggest clearing OUT1.
Post Reply