Can't set 38400 baud @ 48Mhz
Hi all,
I'm trying unsuccessfully to get an 18f4550 to run 38400 baud when set as follows:
Define OSC 48
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_SPBRG 77 ' 38400 Baud @ 0.16%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
I'm using a 20Mhz crystal, Picbasic Pro 2.46, Mpasm 7.52. When it compiles it doesn't like the PBPPIC18.lib, it says the argument is out of range and only the least significant bits are used. If I change the OSC define to 20 it works fine, but then I can't use USB.
Thanks!
Jerry.
Maybe We're getting closer!
Darrel,
I added your config lines, and commented out the lines in the 18f4550.inc file to do away with the overwrite errors, now I'm down to just these two,
Warning[202] \PBPPIC18.LIB 7695:argument out of range. least significant bits used.
Error[113]c:\pbp\usb18\march3.asm 177:Symbol not previously defined(_FCMEN_OFF_1H)
Skimask,
I tried the HSER_BAUD 38400, and it compiles fine, but the serial baud rate is not 38400. I have a program that is working great on an 16f877, and the hardware that it interfaces with will only work at 38400. If I stick the '877 in the same board it works perfectly, when I go back to the '4550 nothing happens, and when I tried a monitor program on another PC it shows garbage. I read in the manual that you won't always get an error if your define is incorrect, the compiler just ignores it. I suspect that I am overlooking something stupidly simple, but I'd rather look dumb and learn the answer than be dumb forever.
I ran out of memory on the '877, and I thought going to the '4550 and getting a USB port might be real handy later on.
Thanks guys for all your help. Have a great weekend!
Jerry.
Patches, we don't need no stinkin' patches!
Hi guys,
Yes, I did download and install the patch from the MeLabs site for 2.46, and it said it installed ok. I tried that, and I downloaded the beta loader software for my USB programmer, also MeLabs, before I posted on the forum because I thought that perhaps my .inc file was too old to have the spbrgh register in it or something. I also downloaded the upgrade for MicroCode Studio Plus.
Thanks,
Jerry.