ERROR Compling 16F819...l but the 16F818 works fine


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    4Lewis's Avatar
    4Lewis Guest

    Unhappy ERROR Compling 16F819...l but the 16F818 works fine

    I get an error when I compile for the 16F819... the same code works for the 16F818. Explaination?
    ---------------------------------------
    DEFINE OSC 4
    DEFINE ADC_BITS 10 'Set number of bits in result
    DEFINE ADC_CLOCK 3 'Set clock source (3=rc)
    DEFINE ADC_SAMPLEUS 50 'Set sampling time in us


    TRISA = %11111111 'Set A to inputs
    TRISB = %00000000 'Set I/O to output
    ADCON1 = %10000010 'Port A Analog and right justify results


    X VAR BYTE

    LOOP:
    ADCIN PORTA.1, X
    Pause 50
    If X > 100 Then
    GOTO BLINK
    ENDIF
    GOTO LOOP

    BLINK:
    HIGH PORTB.4
    Pause 100
    LOW PORTB.4
    RETURN

    ---------------------------------
    Here's the error msg:
    Error [124] C:\PROGRA~1\PICBAS~1.16\PBPPIC14.LIB [Illegal Argument]

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Compiles fine for me on the 818 and the 819 (I use MPASM).

    However, your troubles could be due to the “Return” at the end of the Blink section. Did you intend to use “Gosub Blink” instead of “Goto Blink” in the Loop Section?

    Paul Borgmeier
    Salt Lake City, Utah
    USA

  3. #3
    4Lewis's Avatar
    4Lewis Guest


    Did you find this post helpful? Yes | No

    Default Good try

    Your suggestion of using "goto" did not work.

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    If you add -v to your command line when compiling, it should highlight the offending line during the compilation process to give you a clue where to look.

    As Paul said you should be using GOSUB BLINK because you are calling a subroutine, and not GOTO BLINK as in your original post, which makes me suspect that the code you posted on the forum is not exactly the same as the code you have in your working program, because you will get a Stack Underflow the instant your try to run it on a PIC.

  5. #5
    4Lewis's Avatar
    4Lewis Guest


    Did you find this post helpful? Yes | No

    Default

    ------ I should have stated I am using the complier that comes with PidBasic Pro called MicroStudio, so I don't know how to do the command line option you suggested. Thank you though ----

    If you add -v to your command line when compiling, it should highlight the offending line during the compilation process to give you a clue where to look.


    I have tried both "goto and gosub" with same result... I'll try again this morning and see what I can get! (fingers crossed)

    "As Paul said you should be using GOSUB BLINK because you are calling a subroutine, and not GOTO BLINK as in your original post, which makes me suspect that the code you posted on the forum is not exactly the same as the code you have in your working program, because you will get a Stack Underflow the instant your try to run it on a PIC. "

  6. #6
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    It's probably a setting in your Microcode Studio (which I don't use). The reason I say that is that the only difference between a 16F818 and 819 is the memory. PICBasic will not give you a clean compile on the 818 and then an error on the 819. Sometimes I think IDE's give you more problems than they're worth.

Similar Threads

  1. Replies: 1
    Last Post: - 23rd May 2009, 09:22
  2. 7805 works fine, LM2940CT5 not!
    By DanPBP in forum Off Topic
    Replies: 4
    Last Post: - 29th August 2007, 22:01

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