Embedded Systems Building Blocks, Second Edition

11.09: How to use the COMM_PC and the COMMBGND Module

11.09 How to use the COMM_PC and the COMMBGND Module

If you write a foreground/background application you will need to use the COMM_PC (assuming you are using a PC) and the COMMBGND modules. The first thing you need to do is to configure the module by setting the value of the #defines described in section 11.08. Next, you will need to call functions to initialize the modules and the serial port(s) that you are planning on using. For example, if you are using the PC's COM1, you would need to have the following code:

void main(void){    .    .    CommInit();                /* Initialize COMMBGND             */    .    .    CommCfgPort(COMM1, 9600, 8, COMM_PARITY_NONE, 1);    CommSetIntVect(COMM1);     /* Install the interrupt vector    */    CommRxIntEn(COMM1);        /* Enable receive interrupts       */    .    .} <a name="948"></a><a name="beginpage.253EE025-D733-11D7-B210-00055D0AFCF5"></a>

You should note that you don't need to enable transmit interrupts because this is done automatically when you send data on the serial port. When all your initialization is done, your background loop could check for incoming data, as...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: PC/104 Modules
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.