I have a PIC16F84A chip with 4mhz crystal and want to store four = frequencies ex: 1khz , 1.2khz , 1.5khz , 2khz then I need the chip to = work like a high speed switch so I can send those four frequencies out = into our modulator it must switch at least 10 or higher times a second = and it must loop continiously and send each frequency out to one port = pin only such as portb1. Thank You Keith LIST P=3D16F84A #INCLUDE _CONFIG_CP_OFF_WDT_XT_OSC_PWRTE_ON org 0 CLRF PORTB ;CLEAR PORTB OUTPUT BSF STATUS,RP0 ;SELECT REGISTER BANK 1 BCF TRISB,1 ;SET RB1 AS OUTPUT BCF STATUS,RP0 ;GO BACK TO BANK 0 FREQ1 EQU d'1000' ;output freq in hertz CLOCK EQU d'4000000' ;clock freq in hertz #DEFINE PIN PORTB,1 ;output pin ;VARIABLES CBLOCK h' 0c' COUNTER ENDC delay equ clock/(2*FREQ*d'16') ;delay clock loop bsf pin ;pin high [4] ;-1 to account for overhead in setting up the loop movlw delay -1 ;[4] movwf counter ;[4] nop ;[4] ;inner loop always takes 16 cycles loop clrwdt ;[4] decfsz counter ;[4/8] goto loop ;[8/0] nop ;[0/4] ;depending on the choice of clock and frequency you might need some = extra nop;s in here(if delay is non integral ;nop ; [4] bcf pin ;pin low [4] ;-1 to account for overhead in setting up the loop movlw delay -1 ;[4] movwf counter ;[4] nop ;[4] ;inner loop always takes 16 cycles loop clrwdt ;[4] decfsz counter ;[4/8] goto loop ;[8/0] nop ;[0/4] ;depending on the choice of clock and freq you might need some ;extra nop's in here(if delay is non-intregral) ;nop ;[4] goto loop end -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist