This is nearly trivial. WARNING: Untested code ahead! Initialization, etc not included. The 100Khz signal can be generated by code that toggles a GPIO every 5th instruction time. Code the 50Hz signal is then interspersed around it: CBLOCK 0x?? count ENDC OUT100K = 0 ; GPIO pin assignments OUT50 = 1 ; Each iteration of the following main_loop takes 50uSec ; and generates 5 full cycles of the 100KHz signal. ; Since the state of the 50Hz signal should change every 0.01 ; second, we want to change the state of the 50Hz output each: ; 0.01Sec / 50uSec = 200th time around the loop movlw .200 movwf count main_loop: bsf GPIO,OUT100K ;[1:1] movlw 1 << OUT50 ;[1:2] assume it is time to toggle movf count,F ;[1:3] time to toggle? skpnz ;[1:4] skip if not xorwf GPIO,F ;[1:5] toggle the pin now bcf GPIO,OUT100K ;[1:6] movlw .200 ;[1:7] assume it is time to reset count movf count,F ;[1:8] time to reset? skpnz ;[1:9] skip if not movwf count ;1:10] reset count bsf GPIO,OUT100K ;[2:1] decf count,F ;[2:2] decrement count nop bcf GPIO,OUT100K ;[2:6] goto $+2 goto $+2 bsf GPIO,OUT100K ;[3:1] goto $+2 goto $+2 bcf GPIOI,OUT100K ;[3:6] goto $+2 goto $+2 bsf GPIO,OUT100K ;[4:1] goto $+2 goto $+2 bcf GPIOI,OUT100K ;[4:6] goto $+2 goto $+2 bsf GPIO,OUT100K ;[5:1] goto $+2 goto $+2 bcf GPIO,OUT100K ;[5:6] goto $+1 ;[5:7-8] goto main_loop ;[5:9-10] Bob Ammerman RAm Systems ----- Original Message ----- From: "Lasse Madsen" To: Sent: Sunday, March 17, 2002 12:29 PM Subject: [PIC]: 2 oscillators in one pic ? Hi all I was wondering if its possible to make 2 oscillators running in one pic at the same time ? the PIC is a 12C50x with external 4MHz crystal and oscillators should be on 100KHz and 50Hz. Output on any availble GPIO pin is ok ... I personally doubt it can be done because i dont think a pic can multitask but maby im wrong (i hope so) Best regards Lasse Madsen -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu