Beginner in PicBasic. I really need some help understanding this program.


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Sep 2013
    Posts
    1

    Default 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...

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,519


    Did you find this post helpful? Yes | No

    Default 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.

  3. #3
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    637


    Did you find this post helpful? Yes | No

    Default 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.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Default 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 ...
    Last edited by Archangel; - 23rd October 2013 at 10:36.

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: Beginner in PicBasic. I really need some help understanding this program.

    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Beginner in PicBasic. I really need some help understanding this program.

    Friendly. I thought that F meant something else.

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Default Re: Beginner in PicBasic. I really need some help understanding this program.

    This forum went very prim ... for a moment

    that's why I bailed out from my moderator job ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  8. #8
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: Beginner in PicBasic. I really need some help understanding this program.

    Quote Originally Posted by Acetronics2 View Post
    This forum went very prim ... for a moment

    that's why I bailed out from my moderator job ...

    Alain
    Just trying to CYA Al
    JS
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  9. #9
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Default 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
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. [Beginner Tutorial] How to get started with PICBASIC PRO Demo, MPLAB & PICKIT 2
    By mister_e in forum FAQ - Frequently Asked Questions
    Replies: 13
    Last Post: - 18th October 2014, 22:47
  2. DIV32 Understanding
    By enauman in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 19th January 2013, 20:44
  3. PIC12f629 beginner program
    By kiwi newbie in forum General
    Replies: 1
    Last Post: - 20th October 2010, 07:18
  4. Better understanding PULSIN
    By Wirecut in forum mel PIC BASIC
    Replies: 12
    Last Post: - 29th June 2008, 10:17
  5. 1st 16F877A program in PICBasic
    By Borisw37 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th January 2005, 04:46

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts