Just a little question.
Does GCB set the SPBRG value automatically for lets say, the 18f4550, using PLL ?
If i just write :
#define USART_BAUD_RATE 31250
while my config is as follow (20Mhz crystal) :
#config PLLDIV=4, USBDIV=1, OSC=HSPLL_HS
Should I have my USART working indeed at 31250 bauds ?
i've just downloaded "Pic baud rate calculator v2.1"
So according to my setup, the CPU should run at 5MHz (20Mhz crystal divided by 4 by the PLL Prescaler)
So according to that nice little software, If I want the Baud rate to be 31250 :
For BRGH = 0 it seems impossible.
For BRGH = 1 ( hi speed mode apparently) SPBRG sould be 9, with 0.00 % drift error.
So I guess my question is, does GCB know all of this or should I input this setup manually ?
GCBASIC will calculate the SPBRG value based on the baud rate you set with USART_BAUD_RATE and the chip speed in MHz given in the #chip line. It should work properly in this situation, try it and see!
If it doesn't work, please let us know. GCBASIC is meant to automate any common stuff like this that varies from one chip model to another or one clock speed to another. Being able to take a program and run it on a different chip without changes has always been an important design aim!
And that is one of the features I appreciate the most about what you've created in GCB.
I've used PICBASIC for years and even wrote a couple books on it and think its great, but a big stumbling block for many beginner's and casual users is all the configuration/register setup for a project and then moving to a new chip is a nightmare for many. I have answered more email support questions on that topic alone than any other.
GCB makes that so much easier for those trying to learn or who just want to program PICs for a hobby.
Thanks for such a great design aim. It's appreciated.