Page 1 of 1

Serial Port Initialization - Modem Control Register

Posted: Sun Feb 27, 2022 3:36 am
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,

Re: Serial Port Initialization - Modem Control Register

Posted: Sun Feb 27, 2022 3:59 pm
by Octocontrabass

Re: Serial Port Initialization - Modem Control Register

Posted: Mon Feb 28, 2022 7:28 am
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,

Re: Serial Port Initialization - Modem Control Register

Posted: Mon Feb 28, 2022 12:06 pm
by Octocontrabass
Yeah, you can skip that line. I'd also suggest clearing OUT1.