|
|
 |
 |
| Buy it now and get free product lifetime support. |
|
| Discount When Purchased with Development Board/System. |
$99 |
|
|
|
|
My First Program in mikroBasic
'Why Basic?', you may wonder. The answer is simple: it is legible, easy-to-learn, procedural programming language, with sufficient power and flexibility needed for programming microcontrollers. Whether you had any previous programming experience, you will find that writing programs in mikroBasic is very easy.
|
|
|
Example: My First AD Conversion
The following code sample is one simple loop for performing AD conversion on MCU PORTA and displaying results on PORTB. Examine these lines and note that our humble example deals with highly complicated task of AD conversion. mikroBasic spares you from consulting the manual for specific MCU, code adjustments for different PIC models, and address arithmetic... Just let the compiler take care of it - simply and efficiently.
|
program ADC_on_Leds
dim temp_res as word
main:
ADCON1 = $80 ' configure analog inputs and Vref
TRISA = $FF ' designate PORTA as input
TRISB = $3F ' designate RB7, RB6 pins as outputs
TRISD = $0 ' designate PORTD as output
while true
temp_res = ADC_read(2)
PORTD = temp_res ' send lower 8 bits to PORTD
PORTB = word(temp_res >> 2)
' send two most significant bits to PORTB, pins RB7,RB6
wend
end.
|
|