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

UART Printf problems

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



Joined: 08 Mar 2012
Posts: 38
Location: Canada

View user's profile Send private message

UART Printf problems
PostPosted: Sun Apr 22, 2012 10:47 am     Reply with quote

Hey guys,
I am currently trying to communicate between two PIC's.
I am successfully receiving data and displaying it on an LCD with PIC16F877A. But transmitting data through its TX pin with the use of the printf function is another story..

What I begin by doing is put the characters I want to send into an array:

Code:

char ch_str[20] = "ATZ\r";


Then count how many characters are in the array:

Code:

int chcount = strlen(ch_str);


Then I check if the device is in an idle state with the if (tempc==0x3E), and if it is then using the printf function and a for loop I send the data through the TX pin.

Code:

if (tempc==0x3E)
   {
      for (i=0; i<=chcount;i++)
      {
         printf("%s" ,ch_str[i]);
      }
   }


What I tryed doing was hooking up my USBee device to monitor the data comming out of the TX pin and noticed that there was no activity at all. So I wrote a sample code to test the printf function and there is absolutely no life from the TX pin...
What amI doing wrong? Should I be using putc() instead of printf?

Printf function test code:
Code:

#include <main.h>
#include "D:\Winter_2012\Project_2\flex_lcd.c"

void main()
{
delay_ms(5000);
printf("%c", "ATZ");
}


Thanks!
wordizlife



Joined: 08 Mar 2012
Posts: 38
Location: Canada

View user's profile Send private message

PostPosted: Sun Apr 22, 2012 12:06 pm     Reply with quote

Problem solved, it was a hardware problem with the jumper connected to the TX pin... -_-
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