16f946


Closed Thread
Results 1 to 21 of 21

Thread: 16f946

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Not sure what you mean, but ...

    The Main file that you are compiling determines the processor for all the include files too.

    If you are trying to compile the include file by itself, you probably just need to change the chip in the drop-down box in MicroCode Studio.
    <br>
    DT

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Right you are, Mr. Taylor! I had the dropdown wrong (it defaults to 16f628).
    All is well once again, thank you! (I must be lacking film)

  3. #3


    Did you find this post helpful? Yes | No

    Default

    The INCLUDE file now compiles fine, but trying to compile the "Main" program causes the "Unable to open INCLUDE file NUM TEST.BAS" error. Both of the files shown below are located in c:\Program Files\Mecanique\MCS.


    This is "936 include test2" file:

    Pause 1000 ;for ICSP
    @ __config _WDT_OFF & _CP_OFF & _PWRTE_ON & _MCLRE_ON & _INTRC_OSC_NOCLKOUT

    OPTION_REG = %01000000 ;PORTB pullups enabled, no prescale
    INCLUde "num test.bas"
    ANSEL = 0 ;all pins digital
    CMCON0 = 7 ;comparators off
    ADCON0 = 0 ;ADC's off
    WDTCON = 0 ;WDT off

    TRISA = %00000000
    TRISB = %11000001 ;switches on RB6,RB7, INT on RB0
    TRISC = %00000000 ;LED on RC5, LCD bias on RC3
    TRISD = %00000000
    TRISE = %00001000 ;MCLR on RE3
    TRISF = %00000000
    TRISG = %000000

    OSCCON = %01100001 ;4 mhz. internal

    LCDPS = %00000000 ;Type-A,1/3 bias,no prescale

    LCDCON = %01010011 ;disabled,sleep disabled,VLCD disabled,LFINTOSC,
    ;1/4 mux

    ;PIR2.4 = 0 ;clear LCD interrupt
    low PORTC.5
    high PORTC.3 ;apply power to LCD bias network

    SwCount var byte




    Main:



    low PORTC.5
    low PORTC.4
    low PORTD.3

    SwCount = 0

    LCDPS = %00000000

    LCDSE0 = %10110000 ;enable appropriate segment pins
    LCDSE1 = %10010011
    LCDSE2 = %11111110
    LCDSE3 = %11111111
    LCDSE4 = %11111111
    LCDSE5 = %11

    LCDCON = %11011111 ;enable LCD module
    pause 10


    gosub Dig1_1

    goto Main




    This is "num test" file:

    Dig1_1: LCDDATA7.0 = 1
    LCDDATA4.0 = 1
    LCDDATA18.6 = 1
    RETURN

    Can someone please tell me what I'm doing wrong? Thank you.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Possibly another MCS default.

    It saves new files as .PBP unless you specify .BAS
    The include statements show .BAS
    <br>
    DT

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Yes, thank you! Changing the name in the main program from .bas to .pbp fixed it.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Well, I am wrong, again! The INCLUDE file compiles, but the main program doesn't display the number "1" in the first position when i use the INCLUDE file. When I move the contents of the INCLUDE file to the main program, it works. I have tried this with other combinations of files and file names, but it just won't work! Any ideas?

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Total guess.
    Violation of INCLUDE rule #1.

    Execution of the program must not be allowed to "Fall into" a Subroutine.

    Place a GOTO before, to a place AFTER any subroutines in the Include file.
    <br>
    DT

Similar Threads

  1. 16F946 pcb footprint (64 tqfp)
    By nomad in forum Schematics
    Replies: 2
    Last Post: - 8th September 2009, 11:14
  2. Replies: 4
    Last Post: - 17th April 2009, 08:56
  3. 16F946 Instant Interrupts problem
    By jderson in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th April 2009, 22:20
  4. Problem with Bank 3 in 16F946
    By karlosguay in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th September 2006, 00:19

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