View Full Version : Hserout
MICOCALI
- 7th August 2004, 13:40
I SEND THE CARACTER TO PIC AT PC WITH 9600/8/E/1
i HAVE CONFIG DEFINE HSER_EVEN 1, BUT THE COMUNICATE IS 9600/7/E/1. WHAT IS THE DEFINE?
Melanie
- 7th August 2004, 15:56
1. For 7E1 add the define...
DEFINE HSER_EVEN 1
2. For 7O1 add the define...
DEFINE HSER_ODD 1
3. For 8N1...
Do NOT add any defines
The following additions below are only valid for PBP 2.44 or later...
4. For 8E1...
Define HSER_EVEN 1
Define HSER_BITS 9
5. for 8O1
Define HSER_ODD 1
Define HSER_BITS 9
Note that options 4 & 5 are ONLY available from PBP version 2.44 onwards which added the HSER_BITS 9 define. If you have an older compiler, it's time to get in contact with MeLabs for an upgrade.
Melanie
MICOCALI
- 7th August 2004, 16:28
I have 2.44 but HSER_BITS 9 NOT COMPILE THIS DEFINE
MICOCALI
- 7th August 2004, 17:00
DEFINE OSC 20
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_BAUD 9600
DEFINE HSER_CLROERR 1
DEFINE HSER_EVEN 1
DEFINE HSER_BITS 9
I HAVE THIS DEFINE BUT THE COMUNICATE IS 8N1
WHY
Melanie
- 7th August 2004, 17:02
Define HSER_BITS 9
Compiles without error with my version of 2.44
MICOCALI
- 7th August 2004, 17:13
IF POSSIBLE COMPILE THIS FILE FOR ME
THANK
MICOCALI
- 7th August 2004, 17:15
THE PIC IS 16F628
Melanie
- 7th August 2004, 17:22
I've compiled it twice for you... (two posts since I can only add one attachment at a time)...
This is done with PBP version 2.44
It is actually a .HEX file, but again this forum doesn't allow .HEX attachments so I renamed it as a .TXT
Melanie
- 7th August 2004, 17:23
And this is compiled with PBP version 2.45
NavMicroSystems
- 7th August 2004, 17:27
@ Melanie
you are right, the example compiles ok
but what MICOCALI is saying is also correct.
I have just tried it with:
-----------------------------
DEFINE LOADER_USED 1
DEFINE OSC 20
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_BAUD 9600
DEFINE HSER_CLROERR 1
DEFINE HSER_EVEN 1
DEFINE HSER_BITS 9
Loop:
Hserout ["Test: 0 1 2 3 4 5 6 7 8 9"]
Pause 1000
goto loop
END
-----------------------------
The PIC communitates with 9600 8N1
MICOCALI
- 7th August 2004, 17:40
thank you NavMicroSystems
but I make connection with pic at 9600/8/E/1
i HAVE USE THE FILE PANA245 BUT COMUNICATION IS 8N1
NOT 8E1 I HAVE TESTED WITH HYPERTERMINAL
Melanie
- 7th August 2004, 17:41
Have you checked that you get the same erroneous result with PBP244 and PBP245?
MICOCALI
- 7th August 2004, 17:44
I HAVE TESTED PANA 244 AND PANA 245 BUT THE COMUNICATION IS 8N1 WHY ALL THIS?
Melanie
- 7th August 2004, 17:45
It looks like HSER_BITS 9 was added when the HSEROUT2 and HSERIN2 commands (along with the HSER2_BITS define) were added.
I'll pull a PIC out with 2 USARTS and test both HSEROUT and HSEROUT2 later when I've some free time.
You can of course BYPASS the HSEROUT defines and set-up the PIC's registers manually...
MICOCALI
- 7th August 2004, 17:50
You can of course BYPASS the HSEROUT defines and set-up the PIC's registers manually
IN WICH MODE ?
Melanie
- 7th August 2004, 17:59
Just as a test... before we dive into playing with the registers... you're currently setting HSER_TXSTA to 24h. Since bit 6 of the TXSTA Register selects 8 or 9 bit mode, shouldn't you really be setting TXSTA to 64h??
Therefore try these defines...
DEFINE OSC 20
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 64h
DEFINE HSER_BAUD 9600
DEFINE HSER_CLROERR 1
DEFINE HSER_EVEN 1
DEFINE HSER_BITS 9
MICOCALI
- 7th August 2004, 18:07
YOU ARE THE BEST THANK YOU FOR ALL
Melanie
- 7th August 2004, 18:08
Another happy customer... *smiles*
NavMicroSystems
- 7th August 2004, 18:08
Melanie,
you are so right!
In most cases a look at the datasheet really helps!
As I have a Board in front of me I have tested it, and with
DEFINE HSER_TXSTA 64h
and the PIC communicates @ 9600 8E1
Powered by vBulletin® Version 4.1.7 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.