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?
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?
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
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
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
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
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
Have you checked that you get the same erroneous result with PBP244 and PBP245?
I HAVE TESTED PANA 244 AND PANA 245 BUT THE COMUNICATION IS 8N1 WHY ALL THIS?
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...
You can of course BYPASS the HSEROUT defines and set-up the PIC's registers manually
IN WICH MODE ?
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
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
Bookmarks