Can PicBasic support 56700 serial baud?
Hi gang,
I have a project to talk to a device at 56700,N,8,1,CTS,RTS
I do not have PB-Pro and don't have the money for the upgrade as of yet.
All I need to do for sending data into the device is to send a bit stream of 3Fh, followed by 41h.
This initiates a query to the device which responds with 4 hex bytes.
I think I can simulate the 3Fh + 41h bit-stream using a 4Mhz crystal/resonator.
But then how do I capture the returned data?
I'm not sure if a pic running at 4Meg is going to be processing fast enough to decode 4 bytes at 56700 baud.
I only have to query the device every few seconds.
Perhaps I could use a chip that which would capture and store the 4 bytes and then have the PIC pull them off and reset the chip for the next send?
Perhaps you already have a sample "PicBasic" code that can work at 56700 baud?
Yes, I know, I should bite the bullet and get upgrade to Pro, but for now the piggy bank is empty.
Your suggestions greatly appreciated!!
Thanks,
dw_picbasic :)
RE: Can PicBasic support 56700 serial baud?
Hi Skimask,
It sounds probable.
I guess I could at least try it.
Perhaps with a PIC18F1220 which has an internal clock and can run up to 40Mhz.
Maybe I could monitor a 56700 signal out of my PC with a scope and try to adjust the clock offset parameter.
Or I guess it would be more reliable if I used a resonator.
re: Can PicBasic support 56700 serial baud?
Thanks Steve,
I will check that out.
I spent some time this weekend monitoring the bit streams between my pc and the device with a scope to both confirm the bit width is ~ 17uS, which it should be for 56.7k, and also to get a look at the bit patterns of returned info.
Then I did a simple....
Main:
bo = 1
high 5
bo = 1
low 5
goto main
To see what bit width I would see from a 4Mhz clock.
And this came out to around 50uS.
Perhaps if I removed the 'bo = 1's It would speed up a little, but no where near the speed needed. In order to read 56.7
Looking in PBC.INC, it looks to me like 9600 baud is right at the timing limit with a 4Mhz clock. And since 56.7 is such a large jump, I think now a 40Meg chip slowed down to around 24Mhz might be the easiest way to do it using the built in SERIN / SEROUT commands.
Anyway, I also checked out maxim's MAX3110E SPI/rs232 chip, and requested a couple of samples. I built up a schematic for it, and when they come in, I should be right on it.
If I get this working I'll post the schematic and code.
However, the reallity of my project is that I am only sending 2 bytes to the device, and these always the same. And the device is sending 4 bites back.
I think with a little work, I can replicate the command bit stream with a 20Meg crystal. Decoding the incoming bytes will be the hard part.
After sweating over that approach, I'll be eager to play with the Max chip. :)
re: Can PicBasic support 56700 serial baud?
Hi Skimask,
Thanks, however PBC doesn't have an include support file for that Pic. :(
I think the PIC12F629, and PIC12F675 are supported, and they both have internal osc as well
However, I did make progress today with a 12f675.
Yup.... doing the bit-banging routine.
By pokeing to GPIO register, and offsetting the internal clock to get the bit-width right.
Today I was able to take over the device with the PIC.
My next step is to get the A/D running and get some control buttons into the act.