Oznog
Active Member
I was looking at what it would take to make a software serial port receive at 4800 baud to talk to a GPS, because the hardware port was already being constantly used for something else.
Now I have a 10 MHz instruction clock here (18F series, 10MHz xtal with a 4x PLL to give a 40MHz clock freq). I read here that I need to handle this on an interrupt basis at 3x the baud rate, so this would then require interrupts only 694 instructions apart?
Also TMR2 is already in use for PWM and cannot be reassigned. On the 18F4620, like most PICs, the period can only be arbitrarily assigned in TMR2. Can I sample a 4800 baud serial signal at a higher rate? If I use another timer at 512 clks then it's 36% faster.
Frankly I would expect this is going to be a positively awful performance hit, there is even a remote possibility that in a worse case scenario where it also gets interrupted with a high priority interrupt that it may lose a cycle. Any other better way to do this at all?
Now I have a 10 MHz instruction clock here (18F series, 10MHz xtal with a 4x PLL to give a 40MHz clock freq). I read here that I need to handle this on an interrupt basis at 3x the baud rate, so this would then require interrupts only 694 instructions apart?
Also TMR2 is already in use for PWM and cannot be reassigned. On the 18F4620, like most PICs, the period can only be arbitrarily assigned in TMR2. Can I sample a 4800 baud serial signal at a higher rate? If I use another timer at 512 clks then it's 36% faster.
Frankly I would expect this is going to be a positively awful performance hit, there is even a remote possibility that in a worse case scenario where it also gets interrupted with a high priority interrupt that it may lose a cycle. Any other better way to do this at all?