View previous topic :: View next topic |
Author |
Message |
ccnewbie
Joined: 08 Dec 2008 Posts: 2
|
16F886 I/O |
Posted: Mon Dec 08, 2008 10:34 am |
|
|
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.
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Guest
|
|
Posted: Mon Dec 08, 2008 11:41 am |
|
|
Thank you so much for the details ... |
|
|
ccnewbie
Joined: 08 Dec 2008 Posts: 2
|
|
Posted: Tue Dec 09, 2008 3:58 am |
|
|
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
|
|
Posted: Wed Dec 10, 2008 1:04 am |
|
|
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. |
|
|
|