What is the suitable compiler?

Embedded Systems Topics
Post Reply
User avatar
Nandika
Captain
Captain
Posts: 247
Joined: Sat Oct 15, 2011 11:40 am
Location: Galle-Sri Lanka

What is the suitable compiler?

Post by Nandika » Sun Feb 17, 2013 7:17 pm

What is the suitable compiler for generate .hex file for this code?
This has assembly level in Main Program some C based code in defining region. :roll:
How to find suitable compiler?

Code: Select all

 ; **** Encabezado(header) ****
	list		p=16f628A	; list directive to define processor
	#include	<p16f628A.inc>	; processor specific variable definitions
	__CONFIG _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _INTOSC_OSC_NOCLKOUT & _DATA_CP_OFF & _LVP_OFF & _MCLRE_ON

;**** Definicion de variables(Definition of variables)****
	Flags	equ		0x20	; Registro para guardar banderas.-

	Selec	equ		0		; Bit para indicar seleccion(Selec=1->500Hz; Selec=0->2kHz).-
;**** Definiciones para el ensamblador(Definitions for the assembler) ****
	#define Signal Flags,Selec
	
	
;/////////////////////////////////
;**** Inicio del Micro(Home of the Micro) ****
Reset.		
	org		0x00		; Aquí comienza el micro.-
	goto	Inicio		; Salto a inicio de mi programa.-

; **** Programa Principal(Main Program)****
	org		0x05
Inicio
	bsf		STATUS,RP0	; Banco 1
	bsf		TRISB,0		; Como Entrada.-
	bcf		TRISB,3		; RB3 como Salida.
	bcf		STATUS,RP0	; Banco 0.-
	movlw	b'00000110'	; Se selecciona TMR2, preescaler de 1/16.-
	movwf	T2CON
	bsf		STATUS,RP0	; Banco 1
	movlw	0x7C		; Inicia periodo de 500Hz.-
	movwf	PR2
	bcf		STATUS,RP0	; Banco 0.-
	bsf		Signal
	movlw	0x3E		; Ciclo de trabajo 50%
	movwf	CCPR1L
	bsf		CCP1CON,CCP1X
	bcf		CCP1CON,CCP1Y
	bsf		CCP1CON,CCP1M3	; Configura modulo CCP modo PWM.-
	bsf		CCP1CON,CCP1M2
Bucle
	btfss	PORTB,0		; Testea si se quiere cambiar de Frecuencia.-
	goto	$-1			; No se quiere cambiar.-
	btfss	Signal		; A cual cambiar?
	goto	Cambiar500Hz
Cambiar2kHz
	bsf		STATUS,RP0	; Banco 1
	movlw	0x1E
	movwf	PR2	
	bcf		STATUS,RP0	; Banco 0
	bcf		Signal		; Señal de 2kHz
	movlw	0x0F		; Ciclo de trabajo 50%
	movwf	CCPR1L
	goto	Bucle		;

Cambiar500Hz
	bsf		STATUS,RP0	; Banco 1
	movlw	0x7C		; Inicia periodo de 500Hz.-
	movwf	PR2			; Señal de 500 Hz.-
	bcf		STATUS,RP0	; Banco 0.-
	bsf		Signal
	movlw	0x3E		; Ciclo de trabajo 50%
	movwf	CCPR1L	
	goto	Bucle
;...............................................
	end 

	
Thanks :)
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: What is the suitable compiler?

Post by Neo » Mon Feb 18, 2013 2:24 pm

MP ASM compiler that comes built-in with MPLab IDE will do it.
User avatar
Nandika
Captain
Captain
Posts: 247
Joined: Sat Oct 15, 2011 11:40 am
Location: Galle-Sri Lanka

Re: What is the suitable compiler?

Post by Nandika » Mon Feb 18, 2013 7:03 pm

Thank you Neo,

I couldn't do it.because I were not set MPASM in properly.
Now it's OK.
Post Reply

Return to “Embedded Systems”