??? 11/20/06 13:40 Read: times |
#128305 - How to connect Cool Edit Responding to: ???'s previous message |
Dear Russell,
My apologies if the explanation so far seem to make no sense at all. This is the 1st time that I'm using a PCA, thus your assistance is much appreciated. 1. The chip simulated is P89C51RD2HBA. 2. Application to generate a linear frequency ramp from 1Khz ~ 40 Khz at increments of 1 Khz. 3. All values have been confirmed to produce the correct frequency & number of pulses using a scope. However at higher frequencies, my suspicions is that something is causing a delay when the PCA is switching frquencies. This is only seen after 16Khz, but not at lower frquencies. 4. My code : Non_Value holds the number of pulses which is needed. Value1 is incremented everytime a pulses is generated. .Main_Program: Lcall F_Counter_up PCA_INIT: ;Initializa PCA Timer MOV CMOD,#02H ; Input to PCA Timer = 1/4 * Fosc MOV CH,#00 MOV CL,#00 MOV CCAPM0,#04DH ; HSO with Interrupt Enabled MOV CCAP0L,#.LOW(1000) ; Not sure what this does !!!!! MOV CCAP0H,#.HIGH(1000); Not sure what this does !!!!! CLR P1.3 SETB EC ; Enable PCA Interrupt SETB EA SETB CR MOV VALUE1,#0 WAIT: ; The following routine controls number of pulses needed MOV A,VALUE1 cjne a,NON_PULSES,done1 MOV CCAPM0,#00H ; Disable HSO mode RET done1: SJMP wait ; Loop number of pulses equals PCA_INTERRUPT: CLR CCF0 JNB P1.3,DONE done2: PUSH ACC PUSH PSW CLR EA MOV A,FREQ1 ADD A,CCAP0L MOV CCAP0L,A MOV A,FREQ2 ADDC A,CCAP0H MOV CCAP0H,A SETB EA POP PSW POP ACC RETI DONE: inc value1 sjmp done2 F_COUNTER_UP: MOV FREQ1,#.LOW(3125) ; 1kHZ using 25Mhz Crystal MOV FREQ2,#.HIGH(3125) MOV NON_PULSES,#100 ; Number of pulses needed LCALL PCA_INIT MOV FREQ1,#.LOW(1563) ; 2Khz using 25Mhz Crystal MOV FREQ2,#.HIGH(1563) MOV NON_PULSES,#100 ; Number of pulses needed LCALL PCA_INIT ; Balance of code is here ( truncated for explanation ) MOV FREQ1,#.LOW(78) ; 40 Khz using 25Mhz Crystal MOV FREQ2,#.HIGH(78) MOV NON_PULSES,#100 ; Number of pulses needed LCALL PCA_INIT RET P.S : I've got Cool Edit, however how would one use it to see the pulses |