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

Hyperterminal or CCS Serial Port Monitor versus debugger

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



Joined: 25 Aug 2005
Posts: 65
Location: Huntington Beach, CA

View user's profile Send private message

Hyperterminal or CCS Serial Port Monitor versus debugger
PostPosted: Wed Aug 12, 2009 12:00 pm     Reply with quote

I have a project that prints a couple of outputs then enters a "while" loop that prints out data when a button is pushed. All works fine when I use the debugger monitor to read the printf() statements. When I change the RS232 to use an external monitor, (the program is now being run in a stand alone mode without the compiler involved), I cannot get Hyperterminal or the CCS Serial Port Monitor to read out the first couple of printf() statements and when I start printing out the data inside the while loop, the data will print out on a single line, with the data printing side by side. If I hold the button down to keep the loop running, it will then print the data in a column as it should.

How do I setup the Hyperterminal or Serial Port Monitor to print as it does when using the compiler monitor in the debugger mode? Or what am I doing wrong to cause this discrepency?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 12, 2009 12:28 pm     Reply with quote

Post a little test program that shows the problem. Example:
Code:
#include <16F877.H>
#fuses HS, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=8000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

//====================================
void main()
{
printf("Hello World\n\r");

while(1);
}

The program that you post should not be much longer than that.
JimB



Joined: 25 Aug 2005
Posts: 65
Location: Huntington Beach, CA

View user's profile Send private message

PostPosted: Wed Aug 12, 2009 12:56 pm     Reply with quote

The inital print statements are as follows:
Code:

setup_adc_ports(AN0_AN1_VSS_VREF);
setup_adc(ADC_CLOCK_DIV_8);
set_adc_channel(1);
delay_ms(300);
batvolt = read_adc();
volt=batvolt*0.00379;
printf("%2.2f Volts\n\n\r",volt);
printf("Done\n\r");


Then inside the while loop, this is the print statement:
Code:

totalsum=totalsum/4;
printf("%lu\n\r",totalsum);
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 12, 2009 1:00 pm     Reply with quote

Post a complete, compilable test program. Don't post code fragments.
Just add an #include, #fuses, #use delay(), and any other required #use
statements. Add a main(). Add a while() loop. Test it. Prove that it
fails. Post it. Tell what the failure is. Post your compiler version so we
can duplicate the problem.
JimB



Joined: 25 Aug 2005
Posts: 65
Location: Huntington Beach, CA

View user's profile Send private message

How to implement the pushbutton
PostPosted: Wed Aug 12, 2009 2:07 pm     Reply with quote

Since there will not be a pushbutton. How would you recommend simulating that? Remember it behaves differently when pushed quickly for a single reading than when it is held down for multiple readings. The single readings line up side by side and when the button is held down they readout in a column, which is what I expect from the \n\r.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 12, 2009 2:14 pm     Reply with quote

You don't want to post a test program that I can look at, so what I will
do is post some links to "button press" code that calls printf upon a
keypress:
http://www.ccsinfo.com/forum/viewtopic.php?t=19874

http://www.ccsinfo.com/forum/viewtopic.php?t=36222
JimB



Joined: 25 Aug 2005
Posts: 65
Location: Huntington Beach, CA

View user's profile Send private message

Fixed the first printf() problem
PostPosted: Sat Aug 15, 2009 2:03 pm     Reply with quote

I fixed the first printf() problem. In that one I control the RS232 transceiver to conserve battery power. I just had it turned off. Duh.

However, the second problem that occurs inside of the while loop is a bit more puzzling. I haven't had the time to generate a simple equivalent of that section or code to post here. Problem is that repeated quick pushes causes the output to print side by side on the screen, as if there is no \n\r recognized. If the push is held down allowing the loop to keep starting over, the data is then printed in column form. If I can't figure that one out, I will have to put something here that simulates it.

Thanks for the help, though.
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