Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Cannot convert *.ASM to *.HEX using MPLAB IDE v8.92

Status
Not open for further replies.

jspfleury

Newbie level 4
Newbie level 4
Joined
May 26, 2014
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
50
Hi I am a beginner to PIC programming and have a PICkit2 programmer, I have downloaded MPLAB IDE v8.92. with the plug-in and CCS C Compiler, now the problem is I download *.asm files found on sites and tried several files but I keep getting Build Failed. And error as “Error[113] C:\USERS\USER\DESKTOP\HEX N ASM FILES\SERVO.ASM 74 : Symbol not previously defined (OSCCAL) Error[113] C:\USERS\USER\DESKTOP\HEX N ASM FILES\SERVO.ASM 77 : Symbol not previously defined (GPIO)."
As I am new and just started to use a programmer, I need to use HEX files but unable to understand why the ASM files on site are unable to be converted.
Please help me solve my problem.
 

Hi,

Have you set your Mplab Project up to use Assembler or C ?

Post your Assembly code here ( use the # tags) so we can see what you are actually using.
 

thanks barry.. need to know where to get these libraries.

- - - Updated - - -

Code:
;**********************************************************************
;IT'S A SMALL WORLD TUNE                                                  *
;  14-5-2010                                                          *
;                                             *
;**********************************************************************


	list	p=12F629
	radix	dec
	include	"p12f629.inc"
	
		errorlevel	-302	; Dont complain about BANK 1 Registers during assembly

	__CONFIG	_MCLRE_OFF & _CP_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT  ;Internal osc.


;==========================================================================
;
;       Configuration Bits
;
;==========================================================================


note	equ		21h	;value of HIGH and LOW for note
gap		equ		22h ;gap between notes - uses delay "gap_1"
loops	equ		23h ;loops of HIGH/LOW for 250mS or other duration
temp1	equ		24h ;temp file for note 
jump	equ		25h
D1		equ		26h	;used in 250mS delay
D2		equ		27h	;used in 250mS delay
D3		equ		28h	;used in 250mS delay
gapDela	equ		29h	;used in gap delay
tempA	equ		2Ah	;used in gap delay
extend  equ		2Bh	;used to increase number of loops


;****************************************************************
;Beginning of program
;****************************************************************
		org		0x00
		nop
		nop
		nop
		nop
		nop			
SetUp	bsf		status, rp0 	;Bank 1		
		call    0x3FF       	;retrieve factory calibration value 
		movwf   OSCCAL      	;update register with factory cal value 
       	movlw	b'00001011'		;Set TRIS  
		movwf	TRISIO	   	    ;GP2,4 outputs			
		bcf		status, rp0		;bank 0		
		movlw   07h         	;turn off Comparator 
        movwf   CMCON       	;must be placed in bank 0 
        clrf	jump			;jump value for table					
		goto 	M1		


;****************************************************************
;* Delays 			*
;****************************************************************
	
		
		;gap_1 produces the gap between notes - 3rd byte in the table
		;each unit is 10mS
		
gap_1	movlw	.2
		movwf	gapDela
gap_1a	decfsz	tempA
		goto	gap_1a
		decfsz	gapDela,1 ;produces loops
		goto	gap_1a
		decfsz	gap,1	;
		goto	gap_1
		retlw	00	

	
		;250mS second delay
		
_250mS	nop
		goto	$+1		
		decfsz 	D1,1
		goto 	_250mS
		decfsz 	D2,1
		goto 	_250mS		
		retlw 	00	
		

;****************************************************************
;* Table			*
;****************************************************************
		

		;table values are as follows:
		;1st value = value of HIGH and LOW for note
		;2nd value = value to create 48mS note
		;3rd value = x8 for long note = 48x5=380mS   x5 for short note 48x5=240mS 

table1	addwf   pcl,f   ;02h,1  add W to program counter
		nop				;
		
		retlw   .14		;loops - cycles of HIGH/LOW  "E"  It's
        retlw   .84     ;note - value of HIGH/LOW
        retlw   .50     ;gap between notes - uses "gap_1" delay      
        retlw   .14     ; "F" - A
		retlw   .80 	
        retlw   .50 
		retlw   .30		;"G"  world
        retlw   .142
        retlw   .50 
		retlw   .30		;"E"  of
        retlw   .84    
        retlw   .50 
		retlw   .30		;"C"   laugh
        retlw   .105
        retlw   .50 
		retlw   .14		;"D"- ter
        retlw   .94
        retlw   .50 
		retlw   .14		;"C"   a
        retlw   .105
        retlw   .50 
		retlw   .30		;"C"   world
        retlw   .105
        retlw   .50  
        retlw   .30		;"B"  of
        retlw   .113
        retlw   .50  
        retlw   .40		;"B"  tears
        retlw   .113
        retlw   .50 
        retlw   .14		;"D"- It's
        retlw   .94
        retlw   .50
		retlw   .15		;"E"  a
        retlw   .84    
        retlw   .50
        retlw   .30     ; "F" - world
		retlw   .80 	
        retlw   .50
        retlw   .30		;"D"- of
        retlw   .94
        retlw   .50
        retlw   .40		;"B"  hopes
        retlw   .113
        retlw   .50 
        retlw   .14		;"C"   and
        retlw   .105
        retlw   .50 
        retlw   .14		;"B"  a
        retlw   .113
        retlw   .50 
        retlw   .30		;"A"  world
        retlw   .126
        retlw   .20 
        retlw   .30		;"G"  of
        retlw   .142
        retlw   .50 
        retlw   .30		;"G"  fears
        retlw   .142
        retlw   .50 
        retlw   .15		;"E"  There's
        retlw   .84    
        retlw   .50
        retlw   .15     ; "F" - so
		retlw   .80 	
        retlw   .50
        retlw   .30		;"G"  much
        retlw   .142
        retlw   .50
        retlw   .14		;"C"   that
        retlw   .105
        retlw   .50 
        retlw   .14		;"D"- we
        retlw   .94
        retlw   .50
        retlw   .30 	;"E"  share
        retlw   .84    
        retlw   .50
        retlw   .14		;"D"- that
        retlw   .94
        retlw   .50
        retlw   .14		;"C"   it's
        retlw   .105
        retlw   .50
        retlw   .15		;"A"  time
        retlw   .126
        retlw   .20
        retlw   .14		;"D"- we're
        retlw   .94
        retlw   .50
        retlw   .15 	;"E"  a
        retlw   .84    
        retlw   .50
		retlw   .30     ; "F" - ware
		retlw   .80 	
        retlw   .50
		retlw   .14		  ;"E"   It's
        retlw   .84
        retlw   .50 
        retlw   .14		;"D"   A
        retlw   .94
        retlw   .50 
        retlw   .30		;"G"  small
        retlw   .142
        retlw   .50 
        retlw   .14     ; "F" - world
		retlw   .80 	
        retlw   .50 
        retlw   .30     ; "E" - af
		retlw   .84 	
        retlw   .50 
        retlw   .14		;"D"   ter
        retlw   .94
        retlw   .50 
        retlw   .60		;"C"  all
        retlw   .105
        retlw   .240
        retlw   .45		;"C"  It's
        retlw   .105
        retlw   .50 
        retlw   .14		;"C"   a
        retlw   .105
        retlw   .50 
        retlw   .30     ; "E" - small
		retlw   .84 	
        retlw   .50
        retlw   .30		;"C"   world
        retlw   .105
        retlw   .50 
        retlw   .45		;"D"   af
        retlw   .94
        retlw   .50 
        retlw   .15		;"D"   ter
        retlw   .94
        retlw   .50
        retlw   .60		;"D"   all
        retlw   .94
        retlw   .240 
		retlw   .48     ; "D" -It's
		retlw   .94 	
        retlw   .50     
        retlw   .14		;"D"- A
        retlw   .94
        retlw   .50        
        
        retlw   .30		;"F"  small
        retlw   .80
        retlw   .50   
        retlw   .24		;"D"   word
        retlw   .94
        retlw   .50 
        retlw   .48		;"E"   af
        retlw   .84    
        retlw   .50 
        retlw   .14		  ;"E"   ter
        retlw   .84
        retlw   .20  
		retlw   .48     ; "E" - all
		retlw   .84 	
        retlw   .240 
        retlw   .48		;"E"- It's
        retlw   .84
        retlw   .20  
        retlw   .14		;"E"  A
        retlw   .84
        retlw   .20  
        retlw   .50		;"G+"   small
        retlw   .71
        retlw   .20  
        retlw   .24		;"E"  world 
        retlw   .84    
        retlw   .20  
        retlw   .48		;"F"  af
        retlw   .80    
        retlw   .20 
        retlw   .14     ; "F" -ter
		retlw   .80 	
        retlw   .20 
        retlw   .14     ; "F" - all
		retlw   .80 	
        retlw   .240
        retlw   .30		;"E"  it's 
        retlw   .84    
        retlw   .20 
        retlw   .14		;"D"- A
        retlw   .94
        retlw   .50 
        retlw   .40		;"G"  small
        retlw   .142
        retlw   .50 
        retlw   .40		;"B"  small
        retlw   .113
        retlw   .50 
        retlw   .55		;"C"   word
        retlw   .105
        retlw   .50        
                     
		retlw   0FFh
        

M1		call	_250mS
		call	_250mS
		
Main	incf	jump,1  ;increment pointer 
		movf	jump,w		
		call	table1
		movwf	loops		;first value from table	
		movlw	0ffh
		xorwf	loops,w		;see if value is "0ffh"
		btfsc	status,z
		goto	SetUp			
		incf	jump,1
		movf	jump,w
		call	table1
		movwf	temp1	;temp for note for HIGH/LOW
		
		
eee 	movlw	10
		movwf	extend		
ttt		movf	temp1,w
		movwf	note		
		bsf		gpio,2
		bcf		gpio,4
		goto	$+1
		goto	$+1
		goto	$+1
		decfsz	note,1
		goto	$-4		
		movf	temp1,w
		movwf	note		
		bcf		gpio,2
		bsf		gpio,4
		goto	$+1
		goto	$+1
		goto	$+1
		decfsz	note,1
		goto	$-4
		decfsz	extend,1
		goto	ttt
		decfsz	loops,f
		goto	eee
		incf	jump,1 ;look for gap value
		movf	jump,w			
		call	table1
		movwf	gap
		bcf		gpio,2	;to produce silence
		bcf		gpio,4	;to produce silence
		call	gap_1	;mS gap
		goto	Main
				
		
		END
 
Last edited by a moderator:

They should be somewhere in the MPLAB install path. But as WP100 said, you should make sure your project is setup properly, and maybe post your code.
 

Hi,

The code builds fine in Assebler with Mplab V8.92, so there is nothing wrong there.

Do wonder what you are trying to program in ?

You say you have downloaded CCS C, but C is a different programming language to Assembly which that code is in.

In General terms the two methods do not mix.

Can you say what you intentions are...?

Hex file and picture attatched
 

Attachments

  • tune.zip
    64.1 KB · Views: 150
Last edited:
Assuming you want to compile it yourself, there are a couple of gotcha's to look out for:
1) Be sure case sensitivity is disabled.
2) Under "configure" in the MPLab screen, be sure to select your device.

John
 
Hi jpanhalt I just added the asm file to project and selected the right chip i,e: PIC12F629 and selected MPASM assembler(mpasmwin.exe)v5.51. so i am not sure where i am going wrong..
 

"OSCCAL" and "GPIO" are indeed registers, but unless case sensitivity is disabled, MPLab will not recognize "gpio" and "osccal." (As well as some others.)

Go to build options and check the box to disable case sensitivity. Then see what happens.

John

PS: If you use code tags here, i.e., {code}<insert code here> {/code} (replace curly brackets with straight brackets), your formatting will be better preserved. Cutting and pasting what you posted here gives lots of format errors that I ignored.
 
Last edited:
Hi I thank you all for your help and guidance in solving "converting *.asm to *.hex". files and highlighting the basic knowledge of using MPLAB IDE.
I also apologize for Inappropriate Use or Lack of CODE or SYNTAX Tags.
Regards
Joseph
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top