Getting 19200 baud serial out of a PIC
I am working with a bluetooth module (BTM102) that comes set factory default at 19200. I need to send serial data to it at that rate. It would seem that I need to bump up the clock rate of the PIC to 8MHz. Anyone gone through this? The external xtal needs to be inexpensive for production. Is it as simple as that - just doubling the clock rate and using serout at 9600 baud to get 19200?
Re: Getting 19200 baud serial out of a PIC
SEROUT2 handles 19200 with a 4Mhz or better OSC.
Re: Getting 19200 baud serial out of a PIC
OH Duh! Should have turned the page in that manual. I never used SEROUT2 before...
I'm using a 12F675, so will I need an external oscillator/xtal/resonator? Or will the internal 4MHz work?
Re: Getting 19200 baud serial out of a PIC
Some of the older chips do not have a very accurate internal OSC, I can not say about the 675. If this is for production it might be worth using a 50 cent resonator just to be sure.
Re: Getting 19200 baud serial out of a PIC
Thanks Dave,
I dropped in a 10MHz crystal oscillator and YES that works. But not the 4 MHz internal osc apparently.
Unfortunately a resonator will eat up 2 valuable pins, and a crystal oscillator (using 1 pin) is too pricey for the project. So I'll have to bump up to a 16F627 or something, and that is $$ too. Argh!
Re: Getting 19200 baud serial out of a PIC
Quote:
Originally Posted by
tekart
Unfortunately a resonator will eat up 2 valuable pins, and a crystal oscillator (using 1 pin) is too pricey for the project. So I'll have to bump up to a 16F627 or something, and that is $$ too. Argh!
The 12F615 cost 2/3 what the 12F675 costs and has a 4/8MHz internal oscillator. I've used it at 9600 but have never had the need to try 19200. It's a fairly new chip so the accuracy of the internal oscillator may be better than that of older PICs.
Re: Getting 19200 baud serial out of a PIC
Thanks Dave,
I'll consider that F615 chip. It has the 10 bit A/D that I need too. I can sacrifice the OSC1 pin and justify the cost of an external crystal oscillator I think. It's all coming together now.
Thanks all.
Re: Getting 19200 baud serial out of a PIC
PIC12F1822
8 Pins
Internal precision 32Mhz oscillator.
EUSART (HSEROUT).
You can run at 250K baud on the internal OSC.
Requires PBP 2.60A.
Re: Getting 19200 baud serial out of a PIC
Quote:
Originally Posted by
Darrel Taylor
8 Pins
Internal precision 32Mhz oscillator.
EUSART (HSEROUT).
Can the EUSART be inverted? If not, it may require additional hardware, depending on the application.
Re: Getting 19200 baud serial out of a PIC
That's a really cool chip - but it is pricey. I'm still on PBpro 2.50 - time to upgrade I guess. But I will try out the 12F615 first, I'm getting some next week. My bluetooth (BTM-182) unit needs true serial so that is OK.
Thanks Darrell - you da man!
Re: Getting 19200 baud serial out of a PIC
Quote:
Originally Posted by
tekart
That's a really cool chip - but it is pricey.
It is about the same price as the PIC12f675, give or take 10 cents.
http://www.microchipdirect.com/Produ...rds=pic12f1822
GOT 19200 baud serial out of a 12F615
Got some 12F615 chips today, and when I remembered to configure the internal oscillator for 8MHz it produced nice 19200 baud using SEROUT2:
serout2 tx,32,1,[69,10,13] ' test serial output
Thanks all!
Re: GOT 19200 baud serial out of a 12F615
Quote:
Originally Posted by
tekart
Got some 12F615 chips today, and when I remembered to configure the internal oscillator for 8MHz it produced nice 19200 baud using SEROUT2:
Thanks for the feedback.
Re: GOT 19200 baud serial out of a 12F615
I had a project 2 winters ago with the 12F675 sending commands to an HF transceiver at 19200 with the chips internal oscillator.
I ended up bit-banging the output.
I wouldn't have attempted this if it hadn't been for the fact that the commands were easy to derive.
Basically, commands included: Select next Frequency band UP, Select next Frequency band DOWN, shut off transmit power, turn ON transmit power, scan up frequency, scan down frequency.
The challenge was the commands were 32bit segments.
I used the OSCAL command and a digi-oscope to get the bit-widths correct for that baud rate.
I may have the code stashed away in notes somewhere, but not sure since that was so long ago.
Anyway, just to give a report that the chip can output serial at that speed.
But at that time, I was using PICBASIC (not the picbasic-pro) compiler.
Good luck! and have fun :)