PDA

View Full Version : Hserin



Christopher4187
- 10th March 2006, 01:52
Hi,

I have a known working program and breadboard for a 16F688, 16F870, 16F876.... which works well. I have tried to import the same program on a 18F4550 and I have not had ANY luck. I verified the serial data is getting to the 18F4550 but I can't get it to do anything. I do have another program that I am using with the 18F4550 and it works good but it does not deal with the Hserin or Hserout. Do anyone have any suggestions as to what I can check?

Thanks,

Chris

btaylor
- 20th March 2006, 05:29
HSERIN/OUT require you to manually manage over-run errors and suchlike in the USART. This is hinted at in the paper manual but not mentioned at all in the on-line help that comes up in MicroCode Studio.

Unless you manually fiddle with the USART registers you will have a very unreliable Tx/Rx system. I spent days farting around with this before I dumped HSERxx and went back to SEROUTx that works every time on any pin.

Christopher4187
- 20th March 2006, 17:03
So my question is, am I wasting time by using the Hserin/Hserout? Are there any major benefits to using these or should I just use serin/serout?

DynamoBen
- 20th March 2006, 23:09
You're not wasting your time with HSERIN/HSEROUT. I use the onboard USART whenever possible. The reason being the onboard USART has a built in buffer.

This means PICBasic can do other things and not miss any incoming data. In addition if you enable interrupts you serial string will be received without polling.

The error handling isn't an issue for me because I automatically clear them as they occur with the following:
DEFINE HSER_CLROERR 1 ' Clear all USART errors as they happen

If I had to determine a cause I would have to say it is a setting that is missed on the new chip. Make sure all the defines and fuses are set correctly. Also make sure wiring is correct.

Don't give up yet, its with the little amount of work.