![]() |
Forum Index : Microcontroller and PC projects : Pulse Widths
Author | Message | ||||
vk4tec![]() Senior Member ![]() Joined: 24/03/2012 Location: AustraliaPosts: 239 |
Hello When I use a PIC micro in assembly code I can predict the width of an ON/OFF/ON based upon the crystal frequency. Should the MaxiMite / Duinomite be any different ? I would like to make a RADAR signal simulator - Andrew - Andrew Rich VK4TEC www.tech-software.net |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3272 |
If you are talking about the PULSE command then its timing is derived from the crystal. Geoff Geoff Graham - http://geoffg.net |
||||
vk4tec![]() Senior Member ![]() Joined: 24/03/2012 Location: AustraliaPosts: 239 |
I have found that 20 MHz xtal on my PIC gives me 200 ns steps 08 MHz = 500 ns 10 MHz = 400 ns 20 MHz = 200 ns 16 MHz = 250 ns 32 MHz = 125 ns My signals are 1. 0.8 us wide 2. 8 and 21 us apart 20 MHz does this for me 4 x 200 ns = 0.8 us (check) 40 x 200 ns = 8 us (check) 105 x 200 ns = 21 us (check) Andrew Rich VK4TEC www.tech-software.net |
||||
Dylan Regular Member ![]() Joined: 17/06/2013 Location: NetherlandsPosts: 81 |
Since obviously 20Mhz = 1/(50 ns), I take it your inner delay loop executes in 4 assembly cycles. The PIC32MX has two clocks, one 8MHz and the other 32.768kHz. I can't help but notice that 1000000/(0.8+8+0.8+21)s is 32680 Hz, and even if it is purely coincidental that your high PRF is so near to a timer clock, from my very limited* understanding of radar, the signal is coming in too fast to tell what position the objects are in, but that speed can be judged more accurately at short ranges (*wiki example is speed traps). The advantage of using an actual programming language, even one as basic as ... Basic, is that you can let it do more of the solving of the problem for you. Unfortunately, timer interrupts proved less than ideal for bit-banging PWM for me, and would be even less useful to you. |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |