I sounds like you want something like:
Does this look correct?Code:400-1500Hz | 10-150us | 2-50us | 10-50us | 2-50us | 10-50us | 400-1500Hz +----------+ +----------+ +----------+ ___________| |__________| |__________| |___ 1st Pin 2nd Pin 3rd Pin
With a PIC (I'll assume an 18Fxxxx) there are some things you will need to keep in mind. Each instruction cycle is Fosc/4. So at 40Mhz it will complete most instructions in .1us. Some instructions use 2 instruction cycles to comeplete (like goto's). So you should be able to get close to .25us resolution, at least once the pulses start. It also looks like a 10/2/10/2/10 pulse string would not allow any other things to be done between starting and completing the series of 3 pulses if you need high accuracy.
Have you tried something like this to get the pulses? It should be close to the .25us accuracy you are looking for.
Now, what are you using to time the 400-1500Hz initial pulse? Does this also need to have a .25us accuracy? If it does, you may have trouble, since even using ASM and Interrupts, there is a 3-4 instruction cycle latency for the interrupt to start running after the trigger (so .4us). And this does not count any context saving that may be needed. Some more info may assist in getting more help for you problem.Code:Pulse_1 VAR BYTE Pulse_2 VAR BYTE Pulse_3 VAR BYTE Delay_1 VAR BYTE Delay_2 VAR BYTE '--------------------------- ' Set the variables as needed Pulse_1 = 10 Pulse_2 = 2 Pulse_3 = 25 Delay_1 = 10 Delay_2 = 50 '--------------------------- ' Run this series of instructions ' at the appropriate interval portb.1 = 1 pauseus Pulse_1 portb.1 = 0 pauseus Delay_1 portb.2 = 1 pauseus Pulse_2 portb.2 = 0 pauseus Delay_2 portb.3 = 1 pauseus Pulse_2 portb.3 = 0
SteveB




Bookmarks