Beginner in PicBasic. I really need some help understanding this program.
So me and my friends want to learn how to start using the PicBasic codes for creating a program. What are the functions of each code in the said program:
Device 16F877A Declare Xtal = 4
ADCON1 = 7
PortB_Pullups = On
All_Digital = TRUE
TRISA=%000000
TRISB=%00001111
TRISC=%00000000
TRISD=%00000000
TRISE=%000
Dim Time As Byte
Dim PUJ As Byte
Dim BUS As Byte
Dim TAXI As Byte
Dim display As Byte
Dim display2 As Byte
Dim display3 As Byte
Clear PUJ
Clear BUS
Clear TAXI
Clear Time
Clear PORTA
Clear PORTB
Clear PORTC
Clear PORTD
Clear PORTE
DelayMS 500
Rst:
PUJ= Dig PUJ,0
TAXI = Dig TAXI,0
BUS = Dig BUS,0
display = PUJ
display2 =BUS
display3 =TAXI
PORTC = display
PORTD = display2
PORTA = display3
Counting:
For Time = 1 To 400
If PORTB.0 = 0 Then
DelayMS 50
While PORTB.0 = 0:Wend
Time = 1
PUJ = PUJ + 1
If PUJ > 9 Then
PUJ = 0
EndIf
PUJ = Dig PUJ,0
display = PUJ
PORTC = display
EndIf
;--------------------------------------...
If PORTB.1 = 0 Then
DelayMS 50
While PORTB.1 = 0:Wend
Time = 1
BUS = BUS + 1
If BUS > 9 Then
BUS = 0
EndIf
BUS = Dig BUS,0
display2 = BUS
PORTD = display2
PORTA = display3
EndIf
;--------------------------------------...
If PORTB.2 = 0 Then
DelayMS 50
While PORTB.2 = 0:Wend
Time = 1
TAXI = TAXI + 1
If TAXI > 9 Then
TAXI = 0
EndIf
TAXI = Dig TAXI,0
display3 = TAXI
PORTA = display3
EndIf
DelayMS 150
Next Time
Clear PUJ
Clear BUS
Clear TAXI
Clear Time
PUJ= Dig PUJ,0
TAXI = Dig TAXI,0
BUS = Dig BUS,0
display = PUJ
display2 =BUS
display3 =TAXI
PORTC = display
PORTD = display2
PORTA = display3
GoTo Counting
We all know that: Device 16F877A is the microcontroller we used then
Declare Xtal = 4 is the value of the oscillator in Megahertz. So far we only know the first two lines...
Re: Beginner in PicBasic. I really need some help understanding this program.
Hello,
There are several manufacturers of BASIC compilers for PIC. (There's Swordfish, Proton, MikroE, Melabs and so on).
I don't know for which one YOUR program is but as far as I can see it's not for any of the compilers being discussed on this forum, which is PBP (and to some degree the old PBC) from MicroEngineeringLabs.
Your best bet is to find a forum where the particular compiler you and your friend is trying to learn is being discussed. If that compiler IS PBP from Melabs then you ARE at the right place but the code you posted is not compatible.
/Henrik.
Re: Beginner in PicBasic. I really need some help understanding this program.
Yes, that code is definitely not PBP. Although, it can be easily modified to work in PBP.
Re: Beginner in PicBasic. I really need some help understanding this program.
Looks to be PROTON basic ...
sooo, ... hitting the HELP/Documents menu key should give you all info you need ...
that's also called " RTFM " or Read That Friendly Manual !!! ...
FWORD EDIT :Archangel
Alain
PS: licensed product ??? ... hmmmm ...
Re: Beginner in PicBasic. I really need some help understanding this program.
Re: Beginner in PicBasic. I really need some help understanding this program.
Friendly. I thought that F meant something else.
Re: Beginner in PicBasic. I really need some help understanding this program.
This forum went very prim ... for a moment :D
that's why I bailed out from my moderator job ... :rolleyes:
Alain
Re: Beginner in PicBasic. I really need some help understanding this program.
Quote:
Originally Posted by
Acetronics2
This forum went very prim ... for a moment :D
that's why I bailed out from my moderator job ... :rolleyes:
Alain
Just trying to CYA Al
JS
Re: Beginner in PicBasic. I really need some help understanding this program.
Hi,Joe
That episode learnt me one precious "lifejacket" :
there's one thing that is totally impossible to moderate: Human stupidity ...
Best regards ;)
Alain