Re: 16F777 at 115200 baud
I don't use SERIN/SEROUT very often, but I think you should read the formula as :
((Fosc/4)/Bauds)-20 so, since you are using a 20 MHz external oscillator you should end up with 23. Try it and post the result, so I can verify if my understanding is correct.
Cheers
Al.
Re: 16F777 at 115200 baud
the forumula they have in the maual is (1000000/baud)-20, which results in -11. I tried 23 with no luck, or atlest the motor controller I was communicating with acts dumb. works fine with hyperterminal 8N1, 115k no flow control
Re: 16F777 at 115200 baud
this is what i come up with the varrious values to set the baud value
No Parity, True Parity, True No Parity, Inverted Parity, Inverted
115200 -11 8181 16373 24565
I have tried all the values, except -11, which is what i need I am pretty sure...
HSEROUT ["!M ", dec Motor_Val_R," ", dec Motor_Val_L, 13]'command motors ***THIS WORKS!!!!!!
SEROUT2 portB.4, 23, ["!M ", dec Motor_Val_R," ", dec Motor_Val_L, 13]'command motors, this does not....
I am snooping the packages, there is nothing when i run the serout2 line. the hserout2 works fine and looks fine on hyperterminal with the snooping...
Any ideas, Unfortunatly I can not change the baud rate of the motor controller to something slower... Have to get 115k working and i can't use the hardware port for the final configuration...
Re: 16F777 at 115200 baud
You will not be able to run serout at more than about 19.2K baud with a 20Mhz Xtal
But, you MAY be able use DEBUGOUT at that rate. I have done it at 40Mhz on an 18F part.
Re: 16F777 at 115200 baud
Quote:
The forumula they have in the maual is (1000000/baud)-20, which results in -11.
As Al pointed out (but didn't really spell out) the 1000000 comes from Fosc/4 and since you're running at 20MHz the formula becomes (5000000/115200) - 20 = 23. I don't know if 115200 "should" work at 20MHz but if you can't get it going try DEBUG instead.
/Henrik.
Re: 16F777 at 115200 baud
Thanks for all the help. I understand fosc/4, but i am not sure Serout2 or serin2 uses that. I define the osc speed up top. I have to use 10000000 to get 19200 or 38400 to work with no issue. the debug may work for outgoing, but eventually i will need incoming... I am currently laying out another board with a 2 UART chip since hserin and hserout work fine at 115k and a 20mhz osc, but i would really prefer to use my existing chip.
-Charlie
Re: 16F777 at 115200 baud
OK, you're probably correct then, sounds a bit strange though.... Anyway, if DEBUG does indeed work for the output then DEBUGIN will most likely work for the input - as long as you don't need to change pin or baudrate at runtime.
/Henrik.
Re: 16F777 at 115200 baud
Debug is much more "light weight", since the parameters are calculated at compile time, not every time the routine is called.
It works fast in both directions.