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

RS232 controlled clock?- Simple Question

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



Joined: 17 May 2005
Posts: 213

View user's profile Send private message

RS232 controlled clock?- Simple Question
PostPosted: Wed Nov 23, 2005 6:36 am     Reply with quote

Hi

I would like to implement a count down clock. I have used the INT_RTCC successfully to achieve this.

Now I would like to send a number from the PC, and for the PIC16F84A to pick up the number being sent, and reset the count down based on the number sent. I am not sure how to do this.
Can someone please give me a guideline to follow?

Thank you in advance.
a.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Nov 23, 2005 1:28 pm     Reply with quote

Quote:

Now I would like to send a number from the PC, and for the
PIC16F84A to pick up the number being sent.


Look in the CCS file, INPUT.C, for these functions:
(The INPUT.C file is in this folder: C:\Program Files\PICC\Drivers )

get_int()
get_long()

These allow you to send a number from the PC to the PIC, and
convert it to a binary value, which you can use in your program.
ie., you can put the number into an int8 or an int16 ("long") variable.
Example:

Code:
#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use RS232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS) 

#include <stdlib.h>
#include <input.c>

//=============================
void main()
{
signed int8 value;

while(1)
  {
   printf("Enter a number: ");
   value = get_int();  // Get the number from the PC

   printf("\n\r");
   printf("value = %d\n\r", value);    // Display it
  }

}
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