Steve Smith wrote: > Guys: > During a program I have to periodically make a burst of 455Khz pulses and > stop when a pin changes state.... > > Using an pic 12F510 I can get an 8Mhz internal osc that gives me about 4 > instructions to manufacture this burst and sense the end. It goes something > like this > > Code cycles (500ns ) > Bsf GPIO,outbit ;0 6 > btfss GPIO,inrxbit ;1 > goto main ; > bcf GPIO,outbit ;3 > goto $-4 ;4 > > > best I can do is 5... Anybody got any better ideas I am trying to get a one > chip solution in the smallest possible space and it needs a comparator > > TIA > > STeve You can try something like this: goto StartTx ; Outputs 454.54kHz at GPIO,OUTBIT ; until GPIO,INRXBIT is set ; Fosc=8.00Mhz ; Complete loop takes 11us = burst of 5 periods TxLoop bcf GPIO,OUTBIT ; nop ; bsf GPIO,OUTBIT ;9us/8.8us nop ; bcf GPIO,OUTBIT ; nop ; StartTx bsf GPIO,OUTBIT ;0us/0us (11us/11us) nop ; bcf GPIO,OUTBIT ; nop ; bsf GPIO,OUTBIT ;2us/2.2us nop ; bcf GPIO,OUTBIT ; btfsc GPIO,INRXBIT ; goto EndTx ; bsf GPIO,OUTBIT ;4.5us/4.4us nop ; bcf GPIO,OUTBIT ; nop ; bsf GPIO,OUTBIT ;6.5us/6.6us goto TxLoop ; EndTx nop Djula -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist