Thanks for the help Darrel.
I will look into it further. I had initialized stepcount to 32, then later to 8. Seems to get stuck after about two flashes of the led's.
Walter
Thanks for the help Darrel.
I will look into it further. I had initialized stepcount to 32, then later to 8. Seems to get stuck after about two flashes of the led's.
Walter
Walter,
Try this. It gives you a lot smaller table by packing two bytes into each word space. If you stick with the RETLW approach just uncomment the addwf WREG.
Code:ASM SineTable movlw UPPER Table1 movwf TBLPTRU movlw HIGH Table1 movwf TBLPTRH movlw LOW Table1 movwf TBLPTRL movf _STEPCOUNT,W ;addwf WREG ; uncomment only if using RETLW tables VS db addwf TBLPTRL TBLRD* movf TABLAT, W return Table1 db 0,128,148,167,185,200,213,222,228,230,228,222,213,200,185,167 db 148,128,180,108,89,71,56,43,34,28,26,28,34,43,56,71,89,108 ENDASM
I've been trying to use DT_INTS-14 with a 16F877A. I'm getting errors when trying to compile. Code is as follows:
The errors I'm getting are:Code:DEFINE OSC 4 'Define LCD registers and bits Define LCD_DREG PORTD Define LCD_DBIT 4 Define LCD_RSREG PORTE Define LCD_RSBIT 0 Define LCD_EREG PORTE Define LCD_EBIT 1 'OPTION_REG.6 = 0 OPTION_REG.7=0 'ENABLE PORTB PULLUPS ADCON1 = 7 Low PORTE.2 Pause 100 'INCLUDE FILES FOR DT INTERRUPTS INCLUDE "DT_INTS-14.bas" INCLUDE "ReEnterPBP.bas" X VAR BYTE Y VAR BYTE Z VAR BYTE COUNTER VAR BYTE TAG VAR BYTE[26] INIT: 'INITIALIZE INTERRUPTS ASM INT_LIST macro ;IntSource,Label,Type,ResetFlag? INT_Handler RBC_INT, _BChange, PBP, yes endm INT_CREATE ENDASM @ INT_ENABLE RBC_INT START: COUNTER=0 MAIN: IF COUNTER=>26 THEN LCDOUT $FE,1,"COUNTER: ",DEC COUNTER LCDOUT $FE,$C0,STR TAG\15 COUNTER=0 ENDIF GOTO MAIN BChange: COUNTER=COUNTER+1 IF PORTB.0=0 THEN TAG[COUNTER]=0 ENDIF IF PORTB.1=0 THEN TAG[COUNTER]=1 ENDIF @ INT_RETURN
Error [113] c:(path)pbppic14.lib 1181: Symbol not previously defined (wsave)
Error [101] c:(path)code\lab-x1.asm 194: Error: (wsave variable not found,)
Error [101] c:(path)code\lab-x1.asm 258: Error: (" Add:" wsave VAR BYTE $70 SYSTEM)
Error [101] c:(path)code\lab-x1.asm 315: Error: (Chip has RAM in BANK1, but wsave1 was not found.)
etc
etc
Can somebody tell me what's wrong?
Thanks
Yes, it is asking you to change the include file here:
It needs to be adjusted for a few different chips. Comment out the wsave at $20, and uncomment the wsave at $70, and try commenting out the wsave1-3.Code:wsave VAR BYTE $20 SYSTEM ' location for W if in bank0 ;wsave VAR BYTE $70 SYSTEM ' alternate save location for W ' if using $70, comment out wsave1-3 ' --- IF any of these three lines cause an error ?? ---------------------------- ' Comment them out to fix the problem ---- ' -- It depends on which Chip you are using, as to which variables are needed -- wsave1 VAR BYTE $A0 SYSTEM ' location for W if in bank1 wsave2 VAR BYTE $120 SYSTEM ' location for W if in bank2 wsave3 VAR BYTE $1A0 SYSTEM ' location for W if in bank3
Last edited by ScaleRobotics; - 3rd September 2010 at 06:11.
http://www.scalerobotics.com
scalerobotics - Thanks very much.
Last edited by circuitpro; - 3rd September 2010 at 20:28.
Just wondering if doing something like this is a 'no no' wrt to the interrupt handlers...
....essentially 'toggling' between each comparator being 'interrupt' enabled (& where the other comparator enables/disables itself & its partner). I'm getting weird results, but that's probably cos the rest of my code isn't robustCode:CPM1_Interrupt_Handler: @ INT_DISABLE CMP1_INT [do some stuff here] @ INT_ENABLE CMP2_INT @ INT_RETURN CPM2_Interrupt_Handler: @ INT_DISABLE CMP2_INT [do some stuff here] @ INT_ENABLE CMP1_INT @ INT_RETURN- but just wanted to establish if it's ok to do this (especially if the comparators are interrupting rapidly due to them both rx'ing a rapidly changing input - and also each comparator potentially interrupting very closely in time)
Also, not having a clue about this kinda stuff, just wondering what's going on 'under the hood' so to speak....ie when an interrupt enable &/or disable is actioned as per the above? (does enabling/disabling in such a manner use a lot of processor clock cycles? Or is it pretty swift?)
Thanks.
Last edited by HankMcSpank; - 12th September 2010 at 17:24.
Bookmarks