-
Oscillation maximum
Hello,
I would like toknow if the follwoing is possible in picbasic .
I have a sensor that needs to be clocked at 2Mhz. I would like the Pic to read the amount of clockings, and sends out a pulse at the 129th clock. the pulse should have similar rise , hold and fall time as the clock.
I found this link:
http://www.fh-aalen.de/dti/o_mess/Pixcntr.txt
which the person seems to have programmed a chip to do so.
the picbasic manual basically tells me it is impossible beause it is too high speed.
Any suggestion,? even is it not pic based
thank you
ken
-
Ideally I would like to have the following output
a 25khz frequency, with 1.2% duty cycle
I am clocking a sensor chip at 2Mhz, I want to send a high on every 130th cycle wich will not be longer then a cycle of the 2Mhz.
k
-
even more basically,
I want to send a 0.5us pulse every 40us.
I have this program below, nothing is coming out of it, althou if i remove the line :DEFINE OSC 20, it works. How do i set my 20mhz ?
Below without the define 20, it gves me an oscillation of 125Khz
@ DEVICE PIC16F88, MCLR_ON,HS_OSC, WDT_ON, LVP_OFF, BOD_OFF, PWRT_ON, PROTECT_OFF, CCPMX_ON
INCLUDE "modedefs.bas"
DEFINE OSC 20 'use external 20mhz crystal
CMCON = 7 : ANSEL = 0 : ADCON1 = 7
DEFINE CCP1_REG PORTB 'Hpwm 1 pin port, RIGHT
DEFINE CCP1_BIT 3 'Hpwm 1 pin bit
TRISB = %00000000
PAUSE 1000 ' start-up delay
HPWM 1,3,25000
loop:
goto loop
end
oddly enough even if I change to lower values like:
HPWM 1,3,15000
it do not work