PBP, Vista and MPLAB


Closed Thread
Results 1 to 28 of 28

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Looks like you forgot to define a variable or you have misspeelled something in you code.
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Nov 2005
    Location
    Newcastle, Australia
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Thanks mackrackit,
    Yeh I found the culprit. Using an include "int.bas" for a continous clock.

    Code:
    'FILENAME	:	INT.BAS	
    'PROGRAM	:	INCLUE for continuous clock
    'DATE		:	01NOV2005
    
    DEFINE	INTHAND	ROLLOVER
    
    wsave		var	BYTE 	$020 SYSTEM
    wsave1		var	BYTE 	$0a0 SYSTEM
    wsave2		var	BYTE 	$120 SYSTEM
    wsave3		var	BYTE 	$1a0 SYSTEM
    ssave		var	BYTE 	BANK0 SYSTEM
    psave		var	BYTE 	BANK0 SYSTEM
    i_hour		var	BYTE
    i_minu		var	BYTE
    i_sec		var	BYTE
    i_tic		var	BYTE
    
    
    GOTO AFTERINT				'Jump past interrupthandler
    
    asm
    
    rollover
    
    ;*****************************************************************************************
    ;*****************************************************************************************
    ;
    ;		If you are using a PIC with 2K or less, 
    ;		you MUST unremarke the lines that follow.
    ;
    ;	movwf	wsave			;only for PICs with 2k or less
    ;	swapf	STATUS,w		;only for PICs with 2k or less
    ;	clrf	STATUS			;only for PICs with 2k or less
    ;	movwf	ssave			;only for PICs with 2k or less
    ;	movf	PCLATH,w		;only for PICs with 2k or less
    ;	movwf	psave			;only for PICs with 2k or less
    ;
    ;*****************************************************************************************
    ;*****************************************************************************************
    
    ; interrupcode follows here 
    
    
    	movlw	0x58
    	movwf	TMR1L
    	movlw	0x9e			;restart timer from ffff - 9e58 => 5Hz if using 4MHz
    	movwf	TMR1H
    	decfsz 	_i_tic,f
    	goto 	slutint
    	incf	_i_sec,f
    	movlw	5			;5 = 1Hz if using 4MHz (change to 10 for 8MHz and so on)
     	movwf	_i_tic
    
    	movf	_i_sec,w
    	sublw	60
    	btfss	STATUS,Z		;check for 60 sec
    	goto 	slutint			;no
    	clrf	_i_sec			;yes
    	incf	_i_minu,f
    
    	movf	_i_minu,w
    	sublw	60
    	btfss	STATUS,Z		;check for 60 minutes
    	goto 	slutint			;no
    	clrf	_i_minu			;yes
    	incf	_i_hour
    
    	movf	_i_hour,w
    	sublw	24
    	btfss	STATUS,Z		;check for 24 hours
    	goto 	slutint			;no
    	clrf	_i_hour			;yes
    
    slutint
    	bcf	PIR1,0			;zero tmr1 interrupt flag
    
    
    ;end of interruptcode
    ; restorecode follows here
    
    	movf	psave,w			;restore
    	movwf	PCLATH
    	swapf	ssave,w
    	movwf	STATUS
    	swapf	wsave,f
    	swapf	wsave,w
    	retfie
    
    endasm
    
    
    AFTERINT:
    
    INTCON = %00000000			'all interrupts off
    PIR1 = %00000000			'zero tmr1 interrupt flag
    PIE1 = %00000001			'enable timer1 interrupt
    TMR1L = $58
    TMR1H = $9e
    i_hour = 0				
    i_minu = 0
    i_sec = 0
    i_tic = 5				'this value should be the same as the value of line 8 in the ISR
    T1CON = %00110001			'timer1 on, prescaler=1/8
    INTCON =  %11000000			'interrupt on
    
    '-----------------------------------------------------------------------------------------
    Ive underlined the problem symbols i think.....

    fits in my main program like so.....

    Code:
    DEFIN:	clear
    	DEFINE	OSC	4			'set to 4MHz oscill@@
    	INCLUDE "int.bas"
    	INCLUDE	"modedefs.bas"
    
    blah....
    blah....
    blah....
    gosub TICK
    blah....
    blah....
    blah....
    TICK:	if i_sec.0 <> OSCbit then
    		return
    	endif
    'etc.
    Cant understand getting a symbol not defined error when it defines it first line.
    cheers
    Woodzy
    Last edited by Woodzy; - 2nd March 2009 at 04:43.

  3. #3
    Join Date
    Nov 2005
    Location
    Newcastle, Australia
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Mystery solved !

    Thanks to a four year old post .......

    http://www.picbasic.co.uk/forum/showthread.php?t=1090

    dissimilar caps. Funny how mpasm is case sensitive.
    A BBIIGG thanks to the forum mods keepin old threads alive. They are just as relevent today.

    cheers
    Woodzy
    Last edited by Woodzy; - 2nd March 2009 at 04:59.

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