Hi,
Could you please provide examples on how to configure all the registers (in a "C" block) to allow 115K2 baud for the following 2 newer PIC chips.
16F887 - 20MHz, Page 166, SYNC = 0, BRGH = 1, BRG16 = 1, SPBRG = 42 section which produces a .94% error
18F4620 - 40MHZ, Page 208, SYNC = 0, BRGH = 1, BRG16 = 1, SPBRG = 86 section which produces a -.22% error
I am trying to use 115k2 but the standard RS232 component does not allow me to select the possible options for these newer PICs.
Will the RS232 components get updated (V3 and V4) to allow these buts to be manually set with in the component itself?
Thank you,
Ron
RS232 Setup for new registers
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RS232 Setup for new registers
Hello Ron
You would need a C code block containing the following lines of code.
16F887
clear_bit(txsta, SYNC);
set_bit(txsta, BRGH);
set_bit(baudcon, BRG16);
spbrg = 42;
18F4620
clear_bit(txsta, SYNC);
set_bit(txsta, BRGH);
set_bit(baudcon, BRG16);
spbrg = 86;
I will have a look at how complicated it would make the RS232 component baud calculation. At the moment flowcode generates a baud that is 2.86% out from 115Kbps is this not close enough to use?
You would need a C code block containing the following lines of code.
16F887
clear_bit(txsta, SYNC);
set_bit(txsta, BRGH);
set_bit(baudcon, BRG16);
spbrg = 42;
18F4620
clear_bit(txsta, SYNC);
set_bit(txsta, BRGH);
set_bit(baudcon, BRG16);
spbrg = 86;
I will have a look at how complicated it would make the RS232 component baud calculation. At the moment flowcode generates a baud that is 2.86% out from 115Kbps is this not close enough to use?
Re: RS232 Setup for new registers
Hi Ben,
Is 2.86% error close enough? I do not know, I will read up on RS232, another thing to learn about. I simply read part of the data sheet and found much lower % of error, which in the mind of a newbie is better.
As far as the request, I simply thought that keeping components up to date with the lastest hardware would be another advantage to using Flowcode.
I had a C# application written for me so I could use a few simple protocols and baud rates based on an internal flag being set and I type a bunch of bytes in the app, that are sent based on the protocol. This is allowing me to use a serial port monitor to watch the data flow back and forth. Then I find my mistakes in Flowocde and fix them.
Thanks for all the help, let Sean and Steve know I appreciate all the help over the last 2 years. I wish I had more time to play.
Ron
Is 2.86% error close enough? I do not know, I will read up on RS232, another thing to learn about. I simply read part of the data sheet and found much lower % of error, which in the mind of a newbie is better.
As far as the request, I simply thought that keeping components up to date with the lastest hardware would be another advantage to using Flowcode.
I had a C# application written for me so I could use a few simple protocols and baud rates based on an internal flag being set and I type a bunch of bytes in the app, that are sent based on the protocol. This is allowing me to use a serial port monitor to watch the data flow back and forth. Then I find my mistakes in Flowocde and fix them.
Thanks for all the help, let Sean and Steve know I appreciate all the help over the last 2 years. I wish I had more time to play.
Ron
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RS232 Setup for new registers
Hello Ron
The 2.86% error might be small enough for you to get away with using the current baud calculations. I think its a case of try it and see if it works.
I have passed the updated baud calculations to one of the Flowcode engineers. The main problem at the moment is that we have a nice stable RS232 component and editing it at this stage right before our update release may only cause more problems then it solves. The updated Baud calculations are on the list now though.
Sounds like a nice project and ill pass on your appreciation![Smile :)](./images/smilies/icon_smile.gif)
The 2.86% error might be small enough for you to get away with using the current baud calculations. I think its a case of try it and see if it works.
![Mr. Green :mrgreen:](./images/smilies/icon_mrgreen.gif)
I have passed the updated baud calculations to one of the Flowcode engineers. The main problem at the moment is that we have a nice stable RS232 component and editing it at this stage right before our update release may only cause more problems then it solves. The updated Baud calculations are on the list now though.
Sounds like a nice project and ill pass on your appreciation
![Smile :)](./images/smilies/icon_smile.gif)
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: RS232 Setup for new registers
Hi Ben,
Thanks for the info. Just a note, the 16F register is called baudctl, 18F is baudcon.
The calculation is not this issue when i brought this up. What I am hoping for is a component that can be set up for any of the data sheet rates by having the ability to do it with in the component. I am hoping for a component that, for the new 16F series can have baudctl bit set by checking a box, sync bit can be set by checking a box, spbrg can be set by typing it in and the other required bits/registers can be set the same way. 18F set the same way, old PICs with only 2 registers have the new items grayed out. Let us set up the registers the way we want them, and do calculation based on these settings. Your calculation should match those in the data sheet for that PIC.
If a new release is do out soon I would expect that this issue would be put on hold, hopefully not forgotten.
Let me know if this is only a dream, or if it might come true someday.
By the way, sending only a hand full of bits back and forth worked 115200 with flowcode default settings. Just do not know if a big program downloaded via bootloader would work.
Thanks,
Ron
Thanks for the info. Just a note, the 16F register is called baudctl, 18F is baudcon.
The calculation is not this issue when i brought this up. What I am hoping for is a component that can be set up for any of the data sheet rates by having the ability to do it with in the component. I am hoping for a component that, for the new 16F series can have baudctl bit set by checking a box, sync bit can be set by checking a box, spbrg can be set by typing it in and the other required bits/registers can be set the same way. 18F set the same way, old PICs with only 2 registers have the new items grayed out. Let us set up the registers the way we want them, and do calculation based on these settings. Your calculation should match those in the data sheet for that PIC.
If a new release is do out soon I would expect that this issue would be put on hold, hopefully not forgotten.
Let me know if this is only a dream, or if it might come true someday.
By the way, sending only a hand full of bits back and forth worked 115200 with flowcode default settings. Just do not know if a big program downloaded via bootloader would work.
Thanks,
Ron
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RS232 Setup for new registers
Hello Ron
That is a good suggestion thanks, I will see it gets added to the list.
The TinyBootloader is quite good and uses RS232 to send programs. I have mentioned this on the forums before if you want to give it a go.
http://www.matrixmultimedia.com/mmforum ... f=5&t=4647
That is a good suggestion thanks, I will see it gets added to the list.
The TinyBootloader is quite good and uses RS232 to send programs. I have mentioned this on the forums before if you want to give it a go.
http://www.matrixmultimedia.com/mmforum ... f=5&t=4647
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel