CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

33EP512GP806 and fprintf (FIXED)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
-Terppa-



Joined: 08 Jan 2018
Posts: 59
Location: Finland

View user's profile Send private message

33EP512GP806 and fprintf (FIXED)
PostPosted: Mon Jan 08, 2018 11:48 am     Reply with quote

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: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jan 08, 2018 12:18 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jan 08, 2018 12:22 pm     Reply with quote

Get rid of the "stream=" and it will probably work.
-Terppa-



Joined: 08 Jan 2018
Posts: 59
Location: Finland

View user's profile Send private message

PostPosted: Mon Jan 08, 2018 12:30 pm     Reply with quote

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: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jan 08, 2018 1:08 pm     Reply with quote

What is the hardware between PIC and PC ?
-Terppa-



Joined: 08 Jan 2018
Posts: 59
Location: Finland

View user's profile Send private message

PostPosted: Mon Jan 08, 2018 3:21 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jan 08, 2018 3:30 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jan 09, 2018 5:38 am     Reply with quote

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 Embarassed
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group