RCtech
- 29th January 2006, 18:46
Hello members.
I'll try to explain my problem in a comprehensive english but don't blame me if my language is not perfect, English is not native for me.
Well, i just wanna do that :
Pulsin a value on a pin and pulsout this value on another pin.
it's okay with a 4Mhz crystal but not with another one :O(
Here is my code :
-=-=-=-=-=-=-=-=-=-=-=-=-=
@ device PIC16F871, HS_osc, wdt_off, pwrt_off, protect_off, bod_on, lvp_off, cpd_off, wrt_off, debug_off
ADCON1 = 7 'Need this to turn off ADC
DEFINE NO_CLRWDT 1 'Do not auto insert watchdog timer
Define OSC 20 'Not important to define in this case but i want
Clear
TRISA = %11111111 'Pins A are in input mode
TRISC = %00000000 'Pins C are in Output mode
PORTC = %00000000 'Clear Port C
Init:
PULSIN PORTA.2,1,ValInPulse 'Measure the pulse who vary from 1ms to 2ms
PULSOUT PORTC.5, ValInPulse 'Output the pulse
GOTO Init 'Do it always
-=-=-=-=-=-=-=-=-=-=-=-=-=
And now, here is is what i don't understand :
I know Pulsin and pulsout depend from the crystal, so, if the pulsin have a 5 times higher resolution with à 20MHZ crystal, it's the same for the pulsout (?) I think i don't have to multiply or divide the pulsin value before i output it via PORTC.5...
May be someone could explain ?
Thanx.
I'll try to explain my problem in a comprehensive english but don't blame me if my language is not perfect, English is not native for me.
Well, i just wanna do that :
Pulsin a value on a pin and pulsout this value on another pin.
it's okay with a 4Mhz crystal but not with another one :O(
Here is my code :
-=-=-=-=-=-=-=-=-=-=-=-=-=
@ device PIC16F871, HS_osc, wdt_off, pwrt_off, protect_off, bod_on, lvp_off, cpd_off, wrt_off, debug_off
ADCON1 = 7 'Need this to turn off ADC
DEFINE NO_CLRWDT 1 'Do not auto insert watchdog timer
Define OSC 20 'Not important to define in this case but i want
Clear
TRISA = %11111111 'Pins A are in input mode
TRISC = %00000000 'Pins C are in Output mode
PORTC = %00000000 'Clear Port C
Init:
PULSIN PORTA.2,1,ValInPulse 'Measure the pulse who vary from 1ms to 2ms
PULSOUT PORTC.5, ValInPulse 'Output the pulse
GOTO Init 'Do it always
-=-=-=-=-=-=-=-=-=-=-=-=-=
And now, here is is what i don't understand :
I know Pulsin and pulsout depend from the crystal, so, if the pulsin have a 5 times higher resolution with à 20MHZ crystal, it's the same for the pulsout (?) I think i don't have to multiply or divide the pulsin value before i output it via PORTC.5...
May be someone could explain ?
Thanx.