Page 1 of 1

Need code from keypad to xbee and seven segment display

PostPosted: Sun Oct 17, 2010 6:23 am
by didiey
Hello, i'm doing fyp related with broadcast xbee which use keypad and also 7segment display. i need someone to tell me how to coding all those thing. Actually, i have used pic 16f877a, and mplab v 8.46 as software to program it.

How to code, form keypad (4x4) go to pic 16f877a, and display the out put at seven segment display and simultaneously transmit the data to xbee transeiver? i really need u help, a little bit confius here, :? ~

Re: Need code from keypad to xbee and seven segment display

PostPosted: Mon Oct 18, 2010 2:04 am
by shahrul
If you want to learn, see example keypad + 7 segment.
For the Xbee use UART, see the example UART Transmit and Receive.

Re: Need code from keypad to xbee and seven segment display

PostPosted: Mon Oct 18, 2010 8:25 am
by didiey
Thanks a lot, i need to to study the code first, a lot of changes should be made right? actually i'm beginner in mplab, i'm juz explore it by myself coz only for my final year project. May be i need guide how to code it. :)

i'm juz used typical seven segment display. By right, should i change the coding from lcd to segment? :?

#define LCD_RS RD0
#define LCD_RW RD1
#define LCD_EN RD2
#define LCD_LIGHT RD3
#define LCD_DATA PORTD //D7-D4
#define LCD_PULSE() ((LCD_EN=1),(LCD_EN=0))



how about this code?

[size=85]while(1){
for (counter=0;counter<10;counter++)
{PORTD=[color=#0040FF]segment
[counter];
__delay_sec(1);
}
}



...confius, which one should i change, really need you help! tq.. :).

Re: Need code from keypad to xbee and seven segment display

PostPosted: Mon Oct 18, 2010 12:47 pm
by shahrul
You just think 7 segment as parallel led. So, you can turn on and turn off independently.
You can set
CODE: SELECT_ALL_CODE
#define SEGMENT   PORTB      //abcdefg.

for(;;){
SEGMENT=0b11111100; //display 0
__delay_ms(30);
SEGMENT=0b01100000; //display 1
__delay_ms(30);
SEGMENT=0b11011010; //display 2
__delay_ms(30);
}

Re: Need code from keypad to xbee and seven segment display

PostPosted: Mon Oct 18, 2010 1:35 pm
by yonghui
hi,

be careful with 3.3V of xbee. PIC is 5V.