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

16F886 I/O

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



Joined: 08 Dec 2008
Posts: 2

View user's profile Send private message

16F886 I/O
PostPosted: Mon Dec 08, 2008 10:34 am     Reply with quote

I am truly a newbie. After discovered some notes at the examples and via forum, I tried some basic idea on getting the input.

Code:
#include <16F886.h>
#device ICD=1
#fuses INTRC,NOWDT, NOLVP, BORV21
#device *=16
#use delay(clock = 4000000)
#use rs232(xmit=PIN_C6, rcv=PIN_C7, baud=9600)

#include "em260.h"

#include "ember_utilities.c"

void main(void)
{     
      set_tris_c (0xff);

      while(TRUE)
      {
   i++;
   c_rate[i] = PIN_C7;
   }   
}


I try to configure pin RC7 as my input (CCS Ember Zigbee kit only allow user interface at port C and analog at port A). I tried to read the serial input by looping and store it to c_rate. Then transmit it using ezspSendUnicast (). Correct me if I am wrong.







Smile
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Dec 08, 2008 10:57 am     Reply with quote

Download the CCS manual.
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
Look at the list of functions on page 141 (page 153 in the Acrobat reader).
Find the function that allows you to do input from a pin.
Guest








PostPosted: Mon Dec 08, 2008 11:41 am     Reply with quote

Thank you so much for the details ...
ccnewbie



Joined: 08 Dec 2008
Posts: 2

View user's profile Send private message

PostPosted: Tue Dec 09, 2008 3:58 am     Reply with quote

How about if the input is a 3 decimal number from 7 segment display?
Due to the properties of 7 segment display, 7 bits are used to denote a character on the display. Is PIC 16F886 allows up to 8 bits of data input in a time? So that means if 3 characters needed, so an array for the

spi_read()

is required?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 10, 2008 1:04 am     Reply with quote

Yes it can be put in an array of 3 bytes. Or, 3 separate int8 variables
can hold the data. The Ember kit will have a function that you can call
to read data. But none of us have the Ember kit. I don't have it.
So we can only help you a little.
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