yalcinelmas
Newbie level 3
Hi, I have a question. I spend lot of time. There is a receiver circuit and code developed with CCS.
And there is a transmitter circuit and code developed with C18. I want to communicate these circuit serially. I wrote the CCS and C18 code below. Can anyone help me ?
C18 sender code :
CCS receiver code:
And there is a transmitter circuit and code developed with C18. I want to communicate these circuit serially. I wrote the CCS and C18 code below. Can anyone help me ?
C18 sender code :
Code:
#include<p18f4685.h>
#include <stdlib.h>
#include <string.h>
#include <usart.h>
#pragma config OSC=HSPLL, WDT=OFF, MCLRE=ON, PBADEN=OFF, LVP=OFF
#define LED_TRIS (TRISAbits.TRISA0)
#define LED_IO (LATAbits.LATA0)
void main()
{
int n=0;
long int i;
LED_TRIS=0;
OpenUSART( USART_TX_INT_OFF & USART_RX_INT_ON & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_HIGH, 2082);
TXSTA = 0x20;
RCSTA = 0x90;
BAUDCONbits.BRG16=1;
while(1)
{
while(BusyUSART());
WriteUSART('vexxx\r');
//putcUSART('veseeds\r\n');
LED_IO ^= 1;
Delay10KTCYx(100);
/*while(BusyUSART());
WriteUSART('0');
*/
LED_IO ^= 1;
Delay10KTCYx(100);
}
}
CCS receiver code:
Code:
#include <18F4685.h> // Kullanılacak denetleyicinin başlık dosyası tanıtılıyor.
#fuses HS,NOWDT
#use delay (clock=40000000)
#use rs232 (baud=1200,xmit=PIN_C6, rcv=PIN_C7, parity=N, bits=8, stop=1)
char kk[20];
void main ( )
{
while(1)
{
gets(kk);
if(kk[0]=='v' && kk[1]=='e')
{
output_high(pin_a0);
delay_ms(100);
output_low(pin_a0);
delay_ms(100);
printf("ok\r");
}
}
}