arnol34
- 3rd May 2007, 12:45
I am new to the Pic world.
Here is what I am trying to do. I want to program a RTTY Ham transmitter using a FT18F2620 driving an AH 9834 DDS... But one big problem I had not been able to solve. The length of the timer1 interrupt. I need 22 MS . I am using D. Taylor's code to load the offset value into the timer.. The value computes out to 10541 at 1:2 prescaler... which is $292B
bcf T1CON,TMR1ON ; Turn off timer
movlw LOW(Timerset) ; 1 instruction cycle
addwf TMR1L,F ; 1 instruction cycle
movlw HIGH(Timerset) ; 1 instruction cycle
addwfc TMR1H,F ; 1 instruction cycle
bsf T1CON,TMR1ON ; 1 instruction cycle - Turn TIMER1 back on
The timer runs at its own speed. I can't seem to change the duration . The settings are shown below I have re-read the spec sheet a good many times.. I have tried settings from 0 to 65000.... It always interrupts at the same time duration...
Timerset = $292B ' 22 ms with prescale of 1:2 dec 10541
T1CON = 0 ' ZERO OUT THE TIMER REG
T1CON.5 = 0 'Prescale 00 = 1:1, 01 = 1:2
T1CON.4 = 1 ' 10 = 1:4 , 11 == 1:8
T1CON.0 = 0 'timer on = 1 timer off = 0
TMR1H = $29 'Timer1 set to 22ms
TMR1L = $2B 'Timer1 set to 22ms
RCON.7 = 1 'Enable priority levels on interrupts (IPEN)
TMR1IE VAR PIE1.0 'Enabel timer interrupt. (TMR1IE0)
TMR1IF VAR PIR1.0 'interrut flag bit (TMR1IF)
TMR1IE = 1 'enable timer
IPR1.0 = 1 'Timer1 interrupt priority high (TMR1IP)
PIE1.0 = 1 'Timer1 interrupt enable (TMR1IE)
I have a second interrupt handler for the keyboard to load an input buffer. That appears to be working well... I set it at low priority and the timer one to high priority.
I hope someone can tell me where I have gone wrong...I just can't change the time between interrupt. the timer has selected some value, and won't change... HELP!!!
Jack W0KPH
My Thanks to Joe Rocci for the hardward....
Here is what I am trying to do. I want to program a RTTY Ham transmitter using a FT18F2620 driving an AH 9834 DDS... But one big problem I had not been able to solve. The length of the timer1 interrupt. I need 22 MS . I am using D. Taylor's code to load the offset value into the timer.. The value computes out to 10541 at 1:2 prescaler... which is $292B
bcf T1CON,TMR1ON ; Turn off timer
movlw LOW(Timerset) ; 1 instruction cycle
addwf TMR1L,F ; 1 instruction cycle
movlw HIGH(Timerset) ; 1 instruction cycle
addwfc TMR1H,F ; 1 instruction cycle
bsf T1CON,TMR1ON ; 1 instruction cycle - Turn TIMER1 back on
The timer runs at its own speed. I can't seem to change the duration . The settings are shown below I have re-read the spec sheet a good many times.. I have tried settings from 0 to 65000.... It always interrupts at the same time duration...
Timerset = $292B ' 22 ms with prescale of 1:2 dec 10541
T1CON = 0 ' ZERO OUT THE TIMER REG
T1CON.5 = 0 'Prescale 00 = 1:1, 01 = 1:2
T1CON.4 = 1 ' 10 = 1:4 , 11 == 1:8
T1CON.0 = 0 'timer on = 1 timer off = 0
TMR1H = $29 'Timer1 set to 22ms
TMR1L = $2B 'Timer1 set to 22ms
RCON.7 = 1 'Enable priority levels on interrupts (IPEN)
TMR1IE VAR PIE1.0 'Enabel timer interrupt. (TMR1IE0)
TMR1IF VAR PIR1.0 'interrut flag bit (TMR1IF)
TMR1IE = 1 'enable timer
IPR1.0 = 1 'Timer1 interrupt priority high (TMR1IP)
PIE1.0 = 1 'Timer1 interrupt enable (TMR1IE)
I have a second interrupt handler for the keyboard to load an input buffer. That appears to be working well... I set it at low priority and the timer one to high priority.
I hope someone can tell me where I have gone wrong...I just can't change the time between interrupt. the timer has selected some value, and won't change... HELP!!!
Jack W0KPH
My Thanks to Joe Rocci for the hardward....