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 support@ccsinfo.com

PIC16F917 serial output not displayed
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
temtronic



Joined: 01 Jul 2010
Posts: 9097
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Aug 08, 2017 4:59 am     Reply with quote

hmm... OK... PIC works, TTLUSB works.

Try the following changes to your program:
Code:

#include <16F917.h>
#fuses HS, MCLR, NOWDT, PUT, NOIESO, BROWNOUT, NOFCMEN
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

void main()
{
 
  while(TRUE)
  {
    printf("\r \n hello");
    output_toggle(PIN_D7); //have LED+470R connected here
    delay_ms(500);  // 1/2 second delay to SEE LED flash
  }
}

With these 2 additions, you should see the LED flash at about a 1 Hz rate AND see hello on the PC screen.

If not
confirm that both RX and gnd of TTLUSB module are connected to PIC
confirm RX of module is connected to PIC TX pin
you can disconnect the TD pin of the TTLUSB module from the PIC,NOT needed and won't work anyway
confirm with scope that 'hello' IS seen on the PIC TX pin when connected to TTLUSB module

One possible problem is that the PC Windows and/terminal program doesn't see the TTLUSB device or it's been assigned to another comport.
If you disconnect the PIC TX and gnd wires, 'loopback' the TTLUSB TXD to RXD pins, evertything typed on the PC KBD should be seen on the PC SCREEN. If not, that's a 'PC problem'.

Jay
POPE19



Joined: 27 Jun 2017
Posts: 71

View user's profile Send private message

PostPosted: Tue Aug 08, 2017 6:18 am     Reply with quote

Thank you guys. I am so silly forgot the part that TXD of USB to TTL converter is RX of microcontroller & RXD of USB to TTL converter is TX of microcontroller. I have reversed the pins and i am getting output.

Thanks guys for the help. What a dumb mistake. This cable is working i also check the volts it shows 4.18v at pin C6 & 3.4 at pin C7 of PIC. So it is what temtronic suggested for data transfer as PIC will detect 4v signals.

Just mentioning this so that someone new like me can have reference what might be possibly wrong and troubleshoot reading this post.

Thanks GUYS!!
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Tue Aug 08, 2017 7:04 am     Reply with quote

Problem is (of course) that the signal may not reach 4.1v reliably at reasonable data rates.
Given the device is 5v 'tolerant', I'd suggest adding a slight pull-up to 5v (perhaps 4K7R, from the incoming data line to 5v). This should not cause any problems, and will help to ensure that the line gets up to 4v more quickly. The internal protection diodes on the USB device will clamp the signal at perhaps 4.1v. In fact the level possibly suggests that the unit already has such a resistor to the USB 5v.

My next suggestion was going to be to put the scope on the pins of the device, and verify which pin actually had data on it, when you sent something from the PC, and then to double check that this was the pin that went to the PIC's RX connection....
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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