??? 11/21/06 02:47 Read: times |
#128335 - A suggestion Responding to: ???'s previous message |
Since I'm not familiar with the assembler you are using, I may get some things wrong.
PCA_INTERRUPT: CLR CCF0 PUSH ACC PUSH PSW PUSH DPH PUSH DPL PUSH B ; ; ***need to find out which waythe .DCW stores the high and low ; bytes into memory. This will affect the following code ; mov a,reload_index clr c rl a mov dptr,#reload_table movc a,@a+dptr ;get low byte mov b,a ;save low into B mov a,reload_index clr c rl a inc a ;+1 movc a,@a+dptr ;get high byte xch a,b ;swap hi and low values ; ; add reload value to the capture register ;***need to read the datasheet to see if the ; capture registers need to be read and written in a particular ; order**** this might be critical ; add a,CCAP0L mov CCAP0L,a mov a,b addc a,CCAP0H mov CCAP0H,a djnz pulse_count,isr_1 ;count pulses mov pulse_count,#100 ;reload inc reload_index ;next frequency reload ; ; add test for reload_index rollover ; isr_1: ;berenkat! POP B POP DPL POP DPH POP PSW POP ACC RETI The above code is only a suggestion - it is not necessarily correct! However, it might give you some ideas. also, please don't think I'm an expert with the PCA - I last used it 16 years ago! Salamut jalan! |