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

rs232 problem (Serial Port Monitor)

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



Joined: 27 Mar 2008
Posts: 3

View user's profile Send private message

rs232 problem (Serial Port Monitor)
PostPosted: Thu Jul 17, 2008 1:11 pm     Reply with quote

When I compile the program from the "Tools>ICD" menu how do I run it in the "Tools>Serial Port Monitor" menu?
When I go here I don't know what to do.
The PIC18f4520 developer exercise book isn't very descriptive.
When I load the program onto the chip, then unplug the power to dissconnect the ICD-U40, then power back on the proto board, nothing happens.
Is anything wrong with the code CCS is providing or is it on my end?

Program:

Code:
#include <protoalone.h>
#include <stdlib.h>
#include <input.c>

/*9 lines below are #include <protoalone.h> w/o ICD=TRUE*/
/*#include <18f4520.h>
#fuses HS,NOLVP,NOWDT
#use delay (clock=20000000)
#use rs232 (baud=9600, xmit=PIN_C6, rcv=PIN_C7)

#define GREEN_LED PIN_A5
#define YELLOW_LED PIN_B4
#define RED_LED PIN_B5
#define PUSH_BUTTON PIN_A4*/

void main()
{
   long a,b,result;
   char opr;
   
   setup_timer_0 (RTCC_INTERNAL);
   while(TRUE)
   {
      printf("\r\nEnter the first number:");
      a=get_long();
     
      do{
         printf("\r\nEnter the operator (+-*/):");
         opr=getch();
          } while(!isamoung(opr,"+-*/"));
     
      printf("\r\nEnter the second number:");
      b=get_long();
     
      switch(opr)
      {
         case '+' : result=a+b; break;
         case '-' : result=a-b; break;
         case '*' : result=a*b; break;
         case '/' : result=a/b; break;
      }
     
      printf("\r\nThe result is %lu",result);
   }
}
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