Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC Programming Language

Status
Not open for further replies.

Joshijc

Newbie level 3
Joined
Sep 14, 2010
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Delhi, INDIA
Activity points
1,319
I am relatively a new commer to PIC programming. So far I have been doing small programs in assembly language and now I want to lern PIC programming in C. Recently I have seen a program for electronic dice which appears to me neither in assy. language nor in C. I am reproducing it below as it is
The program
program LED_Dice_decay
dim portb_bit as byte
dim porta_bit as byte 'Declare variables
dim counter as integer
main:
TRISB = %00000001 ' Configure pins of PORTB as output, but pin zero as input
TRISA = %11111111
PORTB = %11111110 'Turn LED's off
' PORTA = %00000000
counter = 1
eloop: 'Start of loop
portb_bit = PORTB.0 'Get button status

if portb_bit = 1 then 'Button press
counter = counter + 1
end if

porta_bit = PORTA.6 'Get fast / slow status
if porta_bit = 1 then 'slow mode
delay_ms(300)
end if
if counter = 7 then 'error handle
counter = 1
end if
select case counter 'Turn appropriate LED's on
case 1
PORTB = %11101110
case 2
PORTB = %11010110 ' 0 is ON
case 3
PORTB = %11000110
case 4
PORTB = %01010100 ' 1 is OFF
case 5
PORTB = %01000100
case 6
PORTB = %00010000
end select
goto eloop ' Stay in loop
end

First I wish to know in which language it is written. Secondly what the word 'dim' appearing in the biginning of the first three lines of the program. I will be extreamly greatfull to all those who will help me in this. Joshijc
 

It's in BASIC. The syntax and format clearly reveal that the compiler is mikroBASIC. https://www.mikroe.com/mikrobasic/pic/

I've used BASIC (mikroBASIC) for quite a long time before I switched to C (I use mikroC PRO for PIC). If you are starting out new, I too would recommend C simply for the flexibility and vast amount of resources available.

Hope this helps.
Tahmid.
 

Thanks a lot for the information/ comments. I am really greatfull to all the three Mr.wp100, Tahmid, and pasicr for their help and suggestions. Joshijc
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top