Hi guys,
Thanks for all the help. At the end, I managed to make my program work using CCS.
This is my serial programming code, but it is not working. None of my friend has experience working serial problem. can anyone pin point what is the problem of the code? High appreciate your helps. Thanks.
#include <pic.h>
__CONFIG(0x3F32);
#define sensor RA0
#define sw RA1
#define buzzer RC5
#define led RC4
#define BAUD 9600
#define _XTAL_FREQ 20000000
void uart_transmit(char data);
void uart_string(const char*s);
void uart_transmit(char data){
while (TXIF==0)continue;
TXREG='j';
}
void uart_string(const char*s)
{while(*s)
uart_transmit(*s++);
}
void main (void)
{
ADCON1 = 0x06;
TRISA=0b11111111;
TRISC=0b00000000;
TXSTA=0b00100000;
RCSTA=0b10010000;
SPBRG=265;
SYNC=0;
BRGH=1;
SPEN=1;
TXEN=1;
sensor=0;
sw=0;
buzzer=0;
led=0;
while(1)
{
if ((sensor == 1) && (sw ==0))
{ led=1,buzzer=1;
uart_string("ATD+60125597225");//call
uart_transmit(0x0D);}//enter
else if ((sensor == 0) && (sw ==1))
{ led=0,buzzer=0;}
else {led =0,buzzer =0;}
}
}
well i am compiling your program on mplab using ccs compiler but the program is giving error... ... is it a full code or there is something missing in it... i am new in serial communication and am not getting any progress in it .. i was hoping that your code will work but its giving error so kindly if u give me a program of a serial communication so it will be very greatfull
thanks in advance
btw, the hyperterminal default BRGH is high/low?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?