Hi,
I think that the highest frequency you can get out of the CCP module is 2.5Mhz when the chip running at 20Mhz. Even so I don't think it's going to do what you want since there's no easy way to control the number of cycles or "pulses" that is going out and as far I understand you need exactly 4096 "pulses".
Perhaps it's possible to connect the CCP output back into a counter input and set that up to generate an interrupt which stops the CCP module at the right spot but it seems like a long shot.
I'm definetly no "ASM-guy" but to set and reset a pin (or rather the port latch) in ASM you can do:But even if you put 4096 of those in a row you won't get more that 2.5Mhz because each instruction takes one cycle and one cycle is Fosc/4 meaning 200ns per cycle @20MHz so the frequency would be 1/400ns=2.5Mhz. Not to mention you'd fill up the flash memory of the 16F88....Code:@ BSF PORTA, 3 @ BCF PORTA, 3
How about this, I THINK it should run faster than your For i = 0 to 4095 loop.If I'm right that inner loop seems to execute in 7 cycles and the outer loop seems to take another 12 for a total of (7*256*16)+(12*16)=28864 cycles @ 200ns each. A total of 5772.8us for 4096 pulses or an average frequency of ~709kHz. There will be some jitter in the pulsestream when it goes from the inner to outer loop but I guess it doesn't matter(?)Code:i VAR BYTE j VAR BYTE For i = 1 to 16 '16*256=4096 For j = 0 to 255 @ BSF PORTA, 3 @ BCF PORTA, 3 NEXT NEXT
/Henrik.




Bookmarks