View previous topic :: View next topic |
Author |
Message |
-Terppa-
Joined: 08 Jan 2018 Posts: 59 Location: Finland
|
33EP512GP806 and fprintf (FIXED) |
Posted: Mon Jan 08, 2018 11:48 am |
|
|
Hello.
I try to put some data to serial port but i can only see "0x00" on windows terminal. Is there problem processor fuses or serial port init?
Thank you for your help.
PIC: 33EP512GP806
Compiler: CCSC PCWHD 5.074
Computer: win7 ultimate x64
Processor FUSES:
Code: | #fuses HS, NOWDT, PR, WPOSTS16, NOCKSNOFSM
#use delay(CRYSTAL=10MHz) |
Serialport init:
Code: | #pin_select U1TX=pin_d7
#pin_select U1RX=pin_d6
#USE RS232(stream=UART1, ERRORS, BAUD=115200, STREAM=HW_CONSOLE) |
Main:
Code: | fprintf(HW_CONSOLE, "\n\rTesting\n\r");
delay_ms(500);
|
Last edited by -Terppa- on Tue Jan 09, 2018 5:39 am; edited 1 time in total |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9244 Location: Greensville,Ontario
|
|
Posted: Mon Jan 08, 2018 12:18 pm |
|
|
While I don't use that PIC, this line..
#USE RS232(stream=UART1, ERRORS, BAUD=115200, STREAM=HW_CONSOLE)
may not be legal....
others may know for sure. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jan 08, 2018 12:22 pm |
|
|
Get rid of the "stream=" and it will probably work. |
|
|
-Terppa-
Joined: 08 Jan 2018 Posts: 59 Location: Finland
|
|
Posted: Mon Jan 08, 2018 12:30 pm |
|
|
I'm not noticed that dual stream name at all! Fixed lines is now:
Now setup is:
Code: |
#pin_select U1TX=pin_d7
#pin_select U1RX=pin_d6
#USE RS232(stream=UART1, ERRORS, BAUD=115200)
|
fprintf:
Code: | fprintf(UART1,"Testing..\n\r"); |
Still one "0x00" mark is coming terminal.. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9244 Location: Greensville,Ontario
|
|
Posted: Mon Jan 08, 2018 1:08 pm |
|
|
What is the hardware between PIC and PC ? |
|
|
-Terppa-
Joined: 08 Jan 2018 Posts: 59 Location: Finland
|
|
Posted: Mon Jan 08, 2018 3:21 pm |
|
|
It is cheap chinese usb to rs232 module. I think driver is something like CH3xxx. This problem is very strange because it always put that one 0x00 and that's it. Even it there is text "testing.." |
|
|
-Terppa-
Joined: 08 Jan 2018 Posts: 59 Location: Finland
|
|
Posted: Mon Jan 08, 2018 3:30 pm |
|
|
Hmmm.. Can it be max232 circuit on PIC board? Maybe it is 5v version..I check that tomorrow because clock is 11:29am |
|
|
-Terppa-
Joined: 08 Jan 2018 Posts: 59 Location: Finland
|
|
Posted: Tue Jan 09, 2018 5:38 am |
|
|
Fixed!!
I made a new circuit board an different rs232, still same.
I changed a different USB- converter, still same.
code change
this:
Code: |
#USE RS232(ERRORS, BAUD=115200, STREAM=HW_CONSOLE)
|
to this:
Code: |
#use rs232(UART1, baud=115200, ERRORS, stream=HW_CONSOLE)
|
Maybe I was too tired and did not look at my code exactly enough |
|
|
|