Originally Posted by
scalerobotics
I don't think your chip has a PLL. So its always best to go with the default configs when you try to change chips. So if you just erase this from the code:
Code:
asm
__CONFIG _CONFIG1H, _OSC_HSPLL_1H
__CONFIG _CONFIG2H, _WDTEN_OFF_2H & _WDPS_512_2H
__CONFIG _CONFIG4L, _LVP_OFF_4L
endasm
It will use the defaults located in PBP under your chipname.inc
Then you will get less errors
I've removed that part of the code together with other modifications but these two errors kip on coming,i dont how to make it work....
m getting these two assembler errors.
ERROR"INT_Handler"-Interrupt flag(PIR1,TMR1IF) not found.)
ERROR"INT_ENABLE"-Interrupt flag(PIR1,TMR1IF) not found.)
code.
Code:
; i'm using pic16f877
;
define OSC 20
;wsave VAR BYTE $20 SYSTEM ' location for W if in bank0
wsave VAR BYTE $70 SYSTEM ' alternate save location for W
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
ADCON0 = %00000000
ADCON1 = %00000000 ;all anolog output
trisb = %11111111 ;define porta as input
trisc = %11111011 ;make ccp1/portc.2 an output pin
trisa = %11111111 ;define porta as input
TMR2 = 16
PR2 = 34 ;set for 36Khz HPWM(=72 steps*10 times*50hz)
CCP1CON = %000001100 ;set to pwm mode
T2CON=%00000110 ;enable timer2 and set timer2 prescaler value of 1:4
STEPCOUNT var byte
stepcount = 256
; Set sine "table" in an array
sineval var byte[72]
sineval[1] = 128 ;0 degree
sineval[2] = 137 ;5 degree
sineval[3] = 146
sineval[4] = 154
sineval[5] = 163
sineval[6] = 171
sineval[7] = 179
sineval[8] = 187
sineval[9] = 194
sineval[10] = 200
sineval[11] = 206
sineval[12] = 212
sineval[13] = 216
sineval[14] = 220
sineval[15] = 224
sineval[16] = 227
sineval[17] = 228
sineval[18] = 229
sineval[19] = 230 ;90 degree
sineval[20] = 229
sineval[21] = 228
sineval[22] = 227
sineval[23] = 224
sineval[24] = 220
sineval[25] = 216
sineval[26] = 212
sineval[27] = 206
sineval[28] = 200
sineval[29] = 194
sineval[30] = 187
sineval[31] = 179
sineval[32] = 171
sineval[33] = 163
sineval[34] = 154
sineval[35] = 146
sineval[36] = 137
sineval[37] = 128 ;180 degree
sineval[38] = 119
sineval[39] = 110
sineval[40] = 102
sineval[41] = 93
sineval[42] = 85
sineval[43] = 77
sineval[44] = 69
sineval[45] = 62
sineval[46] = 56
sineval[47] = 50
sineval[48] = 44
sineval[49] = 40
sineval[50] = 36
sineval[51] = 32
sineval[52] = 29
sineval[53] = 28
sineval[54] = 26
sineval[55] = 26
sineval[56] = 26
sineval[57] = 28
sineval[58] = 29
sineval[59] = 32
sineval[60] = 36
sineval[61] = 40
sineval[62] = 44
sineval[63] = 50
sineval[64] = 56
sineval[65] = 62
sineval[66] = 69
sineval[67] = 77
sineval[68] = 85
sineval[69] = 93
sineval[70] = 102
sineval[71] = 110
sineval[72] =119
timerone var word
INCLUDE "DT_INTS-14.bas" ; Base Interrupt System
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _sine, ASM, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
T1CON = $31
TMR1L = 255 ; Prescaler = 8, TMR1ON
TMR1H = 254
@ INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts
timerone = $FD00 ;gives about 50 hz sine
Main:
pause 5
if timerone = $F9FF then timerone = $FF00
GOTO Main
'---[TMR1_INT - interrupt handler]------------------------------------------
sine:
TMR1L = timerone.byte0
TMR1H = timerone.byte1
CCPR1L = sineval[STEPCOUNT]>>1
stepcount = stepcount -1
if stepcount = 0 then stepcount = 72
@ INT_RETURN
Bookmarks