I am seeing that MikroElektronika site has: C, Basic and Pascal compilers for ARM, PIC, PIC32, AVR, 8051.
see: http://www.mikroe.com/forum/
The question is, are these people serious? They seem to have all major compilers possible for all major microcontrollers on the market.
Example:
Code written for mikroBasic ARM compiler
' * Project name:
' Pwm_Demo (Demo on using mikroE's PWM library functions)
' * Copyright:
' (c) Mikroelektronika, 2011.
' * Revision History:
' 20110105:
' - initial release;
' * Description:
' This is a simple demonstration of PWM library, which is being used for
' control of the ARM's PWM module. The module is initialized and started,
' after which the PWM's Duty Ratios can be adjusted by means of 4 buttons
' connected to pins PA0, PA1, PA2 and PA3. The changes can be monitored on the PWM
' output pins (PB0 and PB2).
' * Test configuration:
' MCU: LM3S9B95
' http://www.ti.com/lit/ds/symlink/lm3s9b95.pdf
' Dev.Board: EasyMx v7 for STELLARIS(R) ARM(R)
' http://www.mikroe.com/eng/products/view/792/easymx-pro-v7-for-stellaris-arm/
' Oscillator: XT-PLL, 80.000MHz
' Ext. Modules: None.
' SW: mikroBasic PRO for ARM
' http://www.mikroe.com/eng/products/view/753/mikrobasic-pro-for-arm/
' * NOTES:
' - Turn off all PORT LEDs except PORTB at SW15. (board specific)
' - Pull-down PORTA at SW1, and put SW16.1 in VCC position (board specific)
program Pwm_Demo
dim current_duty, old_duty, current_duty1, old_duty1 as word
pwm_period1, pwm_period2 as word
sub procedure InitMain()
GPIO_Digital_Input (@GPIO_PORTA, _GPIO_PINMASK_ALL) ' configure PORTA pins as input
end sub
main:
InitMain()
current_duty = 100 ' initial value for current_duty
current_duty1 = 100 ' initial value for current_duty1
pwm_period1 = PWM_CCP0_Init(5000, @_GPIO_MODULE_CCP0_B0)
pwm_period2 = PWM_CCP3_Init(5000, @_GPIO_MODULE_CCP3_B2)
PWM_CCP0_Start()
PWM_CCP3_Start()
PWM_CCP0_Set_Duty(current_duty, _PWM_INVERTED_DISABLE) ' Set current duty for PWM_CCP0
PWM_CCP3_Set_Duty(current_duty1, _PWM_INVERTED_DISABLE) ' Set current duty for PWM_CCP3
while (TRUE) ' endless loop
if GPIO_PORTA_DATA.B0 = 1 then ' button on RA0 pressed
Delay_ms(1)
current_duty = current_duty + 5 ' increment current_duty
if (current_duty > pwm_period1) then ' if we increase current_duty greater then possible pwm_period1 value
current_duty = 0 ' reset current_duty value to zero
end if
PWM_CCP0_Set_Duty(current_duty, _PWM_INVERTED_DISABLE) ' set newly acquired duty ratio
end if
if GPIO_PORTA_DATA.B1 = 1 then ' button on RA1 pressed
Delay_ms(1)
current_duty = current_duty - 5 ' decrement current_duty
if (current_duty > pwm_period1) then ' if we decrease current_duty greater then possible pwm_period1 value (overflow)
current_duty = pwm_period1 ' set current_duty to max possible value
end if
PWM_CCP0_Set_Duty(current_duty, _PWM_INVERTED_DISABLE) ' set newly acquired duty ratio
end if
if GPIO_PORTA_DATA.B2 = 1 then ' button on RA2 pressed
Delay_ms(1)
current_duty1 = current_duty1 + 5 ' increment current_duty1
if (current_duty1 > pwm_period2) then ' if we increase current_duty1 greater then possible pwm_period2 value
current_duty1 = 0 ' reset current_duty1 value to zero
end if
PWM_CCP3_Set_Duty(current_duty1, _PWM_INVERTED_DISABLE) ' set newly acquired duty ratio
end if
if GPIO_PORTA_DATA.B3 = 1 then ' button on RA3 pressed
Delay_ms(1)
current_duty1 = current_duty1 - 5 ' decrement current_duty1
if (current_duty1 > pwm_period2) then ' if we decrease current_duty1 greater then possible pwm_period1 value (overflow)
current_duty1 = pwm_period2 ' set current_duty to max possible value
end if
PWM_CCP3_Set_Duty(current_duty1, _PWM_INVERTED_DISABLE)
end if
Delay_ms(1) ' slow down change pace a little
wend
end.