Mikro C

Mikroelectronica supplies range evaluation and development boards for the PIC and other microcontrollers, as well as C, Pascal, and Basic compilers (Figure D.1). The C compiler MikroC is well documented in a downloadable user manual and includes a good range of peripheral driver libraries, including CAN, Ethernet, and graphical LCD drivers as part of a comprehensive I/O library. The packages are oriented toward the educational and hobby market, offering additional features designed to assist the beginner in developing C applications.

Figure D.1. Mikroelectronica EasyPIC4 Development Board


An evaluation version does not appear to be available at the time of this writing, and the compiler syntax can be assessed prior to purchase only by reference to code fragments given in the manual. An ADC input block is reproduced as an example in Listing D.4. As we see, the control registers are set up by loading control codes as hex numbers, which requires the program designer to look up the necessary bit configurations. However, the ADC access function is simple and concise, allowing the input channel to be selected as the function parameter.

Listing D.4. MikroC Source Code Sample (ADC Input and Display)

unsigned inval; // 16-bit integer for 10-bit input

void main {

ADCON1=0×80; // Setup ADC

TRISA=0xFF; // Analog inputs

TRISB=0×3F; // RB6,RB7 display outputs

TRISD=0; // Port D display outputs

do{

inval=Read_ADC(2); // Read channel 2 (RA2)

PORTD=inval; // Show low 8 bits

PORTB=inval>>2; // Show high 2 bits

}while(1);

}

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.228.35