Pic16F877 failure to assemble


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2008
    Location
    South Australia
    Posts
    5

    Angry Pic16F877 failure to assemble

    G'Day..
    I am copying Chuck Hellebuyck's Pic16F876 A/D for a 5 LED idication on a variable Pot.
    V+ in = progressive LEDS out. I have included files "16F877.Bas" and "pbppic14.lib"
    I get back 21 compilation errors for ' bad expression pbppic14lib.'I have checked both files for comparisons to the errors and can find no reference to any syntax expressions therein.
    The compilers first error is ' TrisB = %00000000. Am I missing something......Thanks
    Last edited by Old Man Emu; - 20th June 2008 at 10:53. Reason: mis-spelling

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Who is Chuck and what does his code look like?
    Please post your code so we can tell what is going on.

    Neither one of those files you mentioned should be included in your code. PIC Basic takes care of that.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jun 2008
    Location
    South Australia
    Posts
    5


    Did you find this post helpful? Yes | No

    Angry Pic16F877 failure to assemble

    ' RA2 Pot connection
    ' RB4 LED4
    ' RB3 LED3
    ' RB2 LED2
    ' RB1 LED1
    ' RB0 LED0
    '-------------------- Revision History ----------------------------------------
    include "pbppic14.lib"
    include "16F877.bas"
    '-------------------- Constants and Defines -----------------------------------

    'Define ACDIN parameters

    Define ADC_BITS 8 ' Set number of bits in result
    DEFINE ADC_CLOCK 3 ' Set clock source ( 3 = RC )
    DEFINE ADC_SAMPLEUS 50 ' Set sampling time to micro-seconds

    '-------------------- Variables -----------------------------------------------

    adval var byte ' Create adval to store result



    PortB = %00000000 ' All outputs off to start
    TrisB = %00000000 ' All of PortB is Outputs

    MAIN:

    TRISA = %00111111 ' Set PortA to all Inputs
    ADCON1 = %00000010 ' Set PortA Analogue

    LOOP:

    ADCIN 2, adval ' Read channel to Adval

    '******************* Let's Drive some LEDS ************************************

    Ledtst1:
    if adval > 25 tHEN tst2 ' If A/D val is less than 25 then

    PortB = %0000001 ' light LED0 only
    goto cont ' Continue with Programme
    tst2:
    if adval > 75 then tst3 ' If A/D val is between 25 - 75

    PortB = %00000011 ' light LED0 - LED1 only
    goto cont ' Continue with Programme
    tst3:
    if adval > 125 then tst4 ' If A/D val is between 75 - 125

    PortB = %00000111 ' light LED0 - LED2 only
    Goto cont ' Continue with Programme
    tst4:
    if adval = 175 then tst5 ' If A/D val is between 125 - 175

    PortB = %00001111 ' light LED0 - LED3 only
    goto cont ' Continue with Programme
    tst5:
    PortB = %00011111 ' If A/D value is greater than 175
    ' Then light all LEDS0 - 4
    cont:
    Pause 100 ' wiat 1 second
    goto LOOP ' Go back to LOOP

    end

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I commented out these two lines
    Code:
    include "pbppic14.lib"
    include "16F877.bas"
    and the rest of your code compiled here. Give it a try. I will look at the remainder in a bit.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jun 2008
    Location
    South Australia
    Posts
    5


    Did you find this post helpful? Yes | No

    Angry Pic16F877 failure to assemble

    I originally included the two files because without them the compilation errors are...
    'Macro label?L not found in macro file' , 'Macro ADCIN?CN not found in macro file', etc. for all the commands used in this programme..I am beginning to think that my last update of MicroCodePlus Studio may be crappy, although it compiles 16F84A's OK.I may have to look at reinstalling this programme ...Thanks ..Rod.

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Do you have MCS set up to us MPASM? Should not make a difference with you PIC though.

    The machine I tested your code on does not have MCS. I used MPLAB.

    What version of PIC BASIC PRO and MCS do you have?
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Jun 2008
    Location
    South Australia
    Posts
    5


    Did you find this post helpful? Yes | No

    Post Pic16F877 failure to assemble

    I am only using MCS 3.0.0.5 as standalone , and PICBasicPro 2.45A. I do have Mplab V8.0 onboard but they no longer include the ability to compile from basic , and will only work with the *.asm file. If this programme compiles on your system , then it should compile on mine , unless I have a dodgy software loading.. I am about to remove PicBasicPro and MCS and reload them both.. I will post the results , most probably Monday....Thanks...Rod.

  8. #8
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    This tells how to use PIC BASIC and MPLAB together.
    http://www.melabs.com/support/mplab.htm

    Works very well. I even use this on my Linux box.
    Dave
    Always wear safety glasses while programming.

  9. #9
    Join Date
    Jun 2008
    Location
    South Australia
    Posts
    5


    Did you find this post helpful? Yes | No

    Talking Pic16F877 failure to assemble

    I am happy to announce that , after replacing the HDD in my desktop and reloading both MPLAB and PicBasicPro that I am up and running with my 16F877 compilations..anndd PBPro
    is running within MPLAB..

Similar Threads

  1. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  2. PIC16F877 I2C programme
    By cooqo in forum mel PIC BASIC
    Replies: 3
    Last Post: - 21st April 2008, 10:02
  3. Replies: 8
    Last Post: - 17th January 2007, 19:18
  4. button input PIC16F877
    By ob38 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th June 2006, 20:11
  5. Who's the Biggest Failure?
    By Squibcakes in forum Off Topic
    Replies: 1
    Last Post: - 1st November 2005, 15:37

Members who have read this thread : 0

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