16F914 and MPASM


Closed Thread
Results 1 to 11 of 11
  1. #1

    Default 16F914 and MPASM

    The following program compiles fine in both PBP and MPASM, but the version compiled with MPASM refuses to run. I'm using V5.14 of MPASM. Programs compiled on other PICS run fine.

    OPTION_REG = %11000000
    INTCON = 0
    PIE1 = 0
    PIE2 = 0
    ANSEL = 0
    TRISA = %00000000
    TRISB = %00100001
    TRISC = %00000000
    TRISD = %00000000
    TRISE = %1000
    OSCCON = %00000001
    CMCON0 = 7
    ADCON0 = 0
    WDTCON = 0

    CLEAR

    LCDPS = %00110000
    LCDSE0 = %11111110
    LCDSE1 = %11111111
    LCDSE2 = %11111111

    LCDDATA0 = $00
    LCDDATA1 = $00
    LCDDATA2 = $00

    PIR2 = 0



    SMCOUNT var byte
    SMCOUNT10 var byte
    SMCOUNT100 var byte

    clear

    LCDCON = %11001000

    PORTA.7 = 0

    Main:


    PORTA.7 = 1
    pause 10
    PORTA.7 = 0
    pause 10
    goto Main

    Anyone have any ideas why this is?

    Thank you for your help.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    PORTA.7 share a couple of things

    OSC1
    CLKI
    T1OSI

    My first bet would be that you haven't set the OSC to internal... and if you did

    Code:
    OSCCON=0
    '
    '
    '
    '
    '
    '
    
    OSCCON = %00000001
    this make the whole thing running @ 32KHz
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Yes, it's supposed to be running at 32khz internal. I am programming the '914 via ICSP, and other chips via the ME Labs USB programmer. Do you think this could make a difference?

  4. #4


    Did you find this post helpful? Yes | No

    Default

    O.K., after half a day of fighting this problem, I found the solution. When the MPASM check box is checked, you have the option of checking three additional boxes. I had the box marked "INHX8M" checked. When I checked the "INHX8S" box instead, the programs run O.K.

    Where is this documented?

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    In the MPASM assembler help file, somewhere under Hex file format.
    Code:
    Hex File Formats (.hex, .hxl, .hxh) 
    The MPASM assembler and MPLINK linker are capable of producing ASCII text hex files in different formats.
    
    	Format Name  		Format Type  		File Extension  Use  
    Intel Hex Format  		INHX8M  		.hex  8-bit core device programmers  
    Intel Split Hex Format  	INHX8S  		.hxl, .hxh  odd/even programmers  
    Intel Hex 32 Format  		INHX32  		.hex  16-bit core device programmers
    It's a bit ODD that INHX8S fixed it...
    Last edited by mister_e; - 5th February 2009 at 13:52.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Alas, I was wrong! Iam still unable to program 16F914 using MPASM and ICSD. I can program using PBP, however. I am able to program 12F635 using either PBP or MPASM and the standard 40 pin ZIF socket from MELABS. I have asked MELABS for help with this.

    Thank you for your help Mister e

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    What are your config fuse settings?

    If you're using the internal osc set for 31kHz, then you'll want to make sure you have config setting for internal osc set.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  8. #8


    Did you find this post helpful? Yes | No

    Default

    Thank you, Bruce. I just tried it again with the following line:

    __config_DEBUG_OFF_FCMEN_OFF_IESO_OFF_BOD_OFF_CPD_ OFF_MCLRE_OFF_PWRTE_ON_WDT_OFF_INTRC_OSC_NOCLKOUT

    It made no difference. Compiles in MPASM with no errors, but will not run:

    __config_DEBUG_OFF_FCMEN_OFF_IESO_OFF_BOD_OFF_CPD_ OFF_MCLRE_OFF_PWRTE_ON_WDT_OFF_INTRC_OSC_NOCLKOUT
    OPTION_REG = %11000000
    INTCON = 0
    PIE1 = 0
    PIE2 = 0
    ANSEL = 0
    TRISA = %00000000
    TRISB = %00100001
    TRISC = %00000000
    TRISD = %00000000
    TRISE = %1000
    OSCCON = %00000001
    CMCON0 = 7
    ADCON0 = 0
    WDTCON = 0

    SSPCON = 0
    CCP1CON = 0
    CCP2CON = 0

    CLEAR

    LCDPS = %00110000
    LCDCON = 0
    LCDSE0 = 0
    LCDSE1 = 0
    LCDSE2 = 0

    PORTA.7 = 1
    LED1 VAR PORTA.7

    Main:

    PORTA.7 = 1
    pause 10
    PORTA.7 = 0
    pause 10
    goto Main

    Any other suggestions?

  9. #9
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    It shouldn't compile the way you did it... seems odd syntaxe.

    How about
    Code:
    @CFG1 = _DEBUG_OFF & _FCMEN_OFF & _IESO_OFF & _BOD_OFF & _CPD_OFF
    @CFG2 = _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_OSC_NOCLKOUT
    @   __CONFIG CFG1 & CFG2
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  10. #10
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    If you really got this to compile as-is, you definitely have something VERY strange
    going on.

    That config line is really a mess. Try the attached and let me know if it works.
    Attached Files Attached Files
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  11. #11


    Did you find this post helpful? Yes | No

    Default

    Problem finally solved! The config settings were the problem. Thank you, Bruce, your code worked. Thanks also to Charles Leo at MeLabs. You both solved the problem at the same time! Will I ever learn?

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