Hi Guys,
I have pic program I need to code count, and aim for total 25 cycles so that the output of the ports are
100 kHz roughly 50% duty cycle driven by 10 MHz clock.. The duty cycle and desynchronisation between the two pins are not important because the decade counter outputs are still 50% duty cycle even if their input from the microcontroller isn't.
It turns out that my scope will count between 99.7xx kHz and 100.20 kHz or so when the pic clocked
with a rubidium frequency standard, and the scope is only referencing it's own ovenised crystal oscillator.
There are a few nops I can add or remove from this routine, and still not be sure which version outputs 100kHz.
There is no evaluation or conditional branching, so the instruction time should be static.
The compiler does the conversion of the writes to portb bits efficiently, as you would in asm.
Any help appreciated.
Cheers, Art.
I have pic program I need to code count, and aim for total 25 cycles so that the output of the ports are
100 kHz roughly 50% duty cycle driven by 10 MHz clock.. The duty cycle and desynchronisation between the two pins are not important because the decade counter outputs are still 50% duty cycle even if their input from the microcontroller isn't.
Code:
cycle: ' main routine
'
@ nop
@ nop
@ nop
@ nop
@ nop
@ nop
@ nop
@ nop
@ clrwdt ; clear watchdog timer manually (1)
portb.4 = 1 ' (2)
portb.5 = 1' (2)
@ nop
@ nop
@ nop
@ nop
@ nop ; (1)
@ nop
portb.4 = 0
portb.5 = 0
'
goto cycle ' do it again (2)
with a rubidium frequency standard, and the scope is only referencing it's own ovenised crystal oscillator.
There are a few nops I can add or remove from this routine, and still not be sure which version outputs 100kHz.
There is no evaluation or conditional branching, so the instruction time should be static.
The compiler does the conversion of the writes to portb bits efficiently, as you would in asm.
Any help appreciated.
Cheers, Art.
Last edited: