iki yönlü seri haberleşme ccs-c picc
Full duplex serial communication
projede iki adet pic16f877a kullanılmış
1. mikrodenetleyiciye bağlı 8 adet buton ile karşıdaki
mikrodenetleyicinin d portuna bağlı ledlerde gösteriliyor.
ayni şekilde ikinci mikrodenetleyiciye bağlı butonların değerleri
1. mikrodenetleyicinin b portuna bağlı ledlerde gösteriliyor
* veriler paket halinde gönderildiği için data aynı anda gönderilip alınıyor.
Hazırlayan ;
Walat YACOUB
Elk.Elt. Müh.
Berxwedan_83@hotmail.com
CLICK TO DOWNLOAD CCS-C PICC Code & ISIS Simulation
#include <16F877a.h>
#fuses XT,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT
#use fast_io(b)
#use fast_io(d)
#use delay(clock=4000000)
#use rs232 (baud=9600, xmit=pin_C6, rcv=pin_C7, parity=N, stop=1)
int w=0,ww=0;
#int_rda
void read()
{
disable_interrupts(int_rda);
ww = getc();
output_d(ww);
}
void main()
{
setup_psp(PSP_DISABLED);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_CCP1(CCP_OFF);
setup_CCP2(CCP_OFF);
set_tris_b(0xff);
set_tris_d(0x00);
while(true)
{
enable_interrupts(GLOBAL);
enable_interrupts(int_rda);
w = input_b();
putc(w);
delay_ms(100);
}
}
//*************************************************
:1000000000308A0055280000FF00030E8301A10084
:100010000A08A0008A010408A2007708A300780853
:10002000A4007908A5007A08A600831383128C30F7
:100030008400801E1D288C1A2E2822088400230884
:10004000F7002408F8002508F9002608FA0020081F
:100050008A00210E8300FF0E7F0E09008A110A120A
:10006000312883168C1283128C1E34281A08A8009B
:10007000280888008C128A110A121D282A30840050
:1000800083130008031952280130F800F701F70B19
:100090004728F80B46284A30F700F70B4D28502820
:1000A000800B44288A110A129D28840183131F3073
:1000B0008305193083169900A6309800903083127A
:1000C0009800A701A80183161F149F141F159F11E4
:1000D00007309C00FF308312A90083160912831297
:1000E00090010030F80092000030831692001F1437
:1000F0009F141F159F1183121F102915290883169D
:10010000870083129701A914290883168700831298
:100110009D01FF308316860000308800C0308312B6
:100120008B0483168C1683120608A70027080C1E62
:10013000972899006430AA003E2883168E28630011
:02400E00393F38
:00000001FF
;PIC16F877A
;CRC=F801 CREATED="12-Tem-11 10:37"
Full duplex serial communication
projede iki adet pic16f877a kullanılmış
1. mikrodenetleyiciye bağlı 8 adet buton ile karşıdaki
mikrodenetleyicinin d portuna bağlı ledlerde gösteriliyor.
ayni şekilde ikinci mikrodenetleyiciye bağlı butonların değerleri
1. mikrodenetleyicinin b portuna bağlı ledlerde gösteriliyor
* veriler paket halinde gönderildiği için data aynı anda gönderilip alınıyor.
Hazırlayan ;
Walat YACOUB
Elk.Elt. Müh.
Berxwedan_83@hotmail.com
CLICK TO DOWNLOAD CCS-C PICC Code & ISIS Simulation
#include <16F877a.h>
#fuses XT,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT
#use fast_io(b)
#use fast_io(d)
#use delay(clock=4000000)
#use rs232 (baud=9600, xmit=pin_C6, rcv=pin_C7, parity=N, stop=1)
int w=0,ww=0;
#int_rda
void read()
{
disable_interrupts(int_rda);
ww = getc();
output_d(ww);
}
void main()
{
setup_psp(PSP_DISABLED);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_CCP1(CCP_OFF);
setup_CCP2(CCP_OFF);
set_tris_b(0xff);
set_tris_d(0x00);
while(true)
{
enable_interrupts(GLOBAL);
enable_interrupts(int_rda);
w = input_b();
putc(w);
delay_ms(100);
}
}
//*************************************************
:1000000000308A0055280000FF00030E8301A10084
:100010000A08A0008A010408A2007708A300780853
:10002000A4007908A5007A08A600831383128C30F7
:100030008400801E1D288C1A2E2822088400230884
:10004000F7002408F8002508F9002608FA0020081F
:100050008A00210E8300FF0E7F0E09008A110A120A
:10006000312883168C1283128C1E34281A08A8009B
:10007000280888008C128A110A121D282A30840050
:1000800083130008031952280130F800F701F70B19
:100090004728F80B46284A30F700F70B4D28502820
:1000A000800B44288A110A129D28840183131F3073
:1000B0008305193083169900A6309800903083127A
:1000C0009800A701A80183161F149F141F159F11E4
:1000D00007309C00FF308312A90083160912831297
:1000E00090010030F80092000030831692001F1437
:1000F0009F141F159F1183121F102915290883169D
:10010000870083129701A914290883168700831298
:100110009D01FF308316860000308800C0308312B6
:100120008B0483168C1683120608A70027080C1E62
:10013000972899006430AA003E2883168E28630011
:02400E00393F38
:00000001FF
;PIC16F877A
;CRC=F801 CREATED="12-Tem-11 10:37"