mikroC Pro and 8051 development

Recently I purchased several 8051 type development boards from China, most of the examples were written in Keil. As a test I decided to see if i could get any other compilers working, one that has caught my eye is the products from mikroelektronica, mainly as they have a nice modern gui feel and also as well as C they have Pascal and Basic  compilers and all have code size limited free versions to test the product out.

Also they have a few libraries to make development easier , for example a nice LCD library.

As always the simplest test is to flash those LEDs. In this case I connected Port 2 of my 8051 (its an STC90C516) to a bank of 8 LEDs that are on the development board.

I wrote the code, compiled and generated the hex file. Using the STC flash utility (tutorial on that later) I was able to upload my example and was delighted to see the LEDs flashing on and off.

 

Code

void main()
{
do
{
P2 = 0x00; // Turn ON diodes on PORT2
Delay_ms(1000); // 1 second delay

P2 = 0xFF; // Turn OFF diodes on PORT2
Delay_ms(1000); // 1 second delay

} while(1); // Endless loop
}

 

Links

 

Related posts

8051 and RGB led example using the SiLabs IDE

C8051F340 flashing led example

8051 7 Segment display program written in Basic