Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

pic61F877 c code

Fahad12

New Member
Hey
I want help to write C code for my project about Wireless home security system


i got problem to write C code for pic16F877
im used mplab with CCSc complier.

any one can help me out to write this program
following my c code i got 6 errors:
#include<16f877.h>
#fuse HS,NOWDT, XT
#use delay (clock =4000000)
#use rs232(baud=9600.xmit=PIN_C6,rcv=PIN_C7,errors)

#zero_ram
///////// Variable Definition
char c=0xla;
int=b;

/////////// Interrupt Service Routen (ISR)
#int_EXT
EXT_isr()
{
bisable_interrupts(INT_EXT);
delay_ms(10);
printf ("AT+SMGS=\"+447889165758\"\r\n");
delay_ms(100);
printf (" THeft\r\n");
delay_ms(1000);
printf ('%c',c);
delay_ms(50);
output_a(0x00);
}


/////////Main function

void main()
{
set_tris_e(0x00);
output_e(0xff);
delay_ms(3000);
printf('AT+CMGI=2,1,0,0,1\R\N");
delay_ms(3000)
enable_interrupts(GLOABLE);
enable_interrupt(INT_EXT);
ext_int_edge(H_TO_L);
while (1)
{
b=input_b();
if (b==0x01)
{
delay_ms(50);
printf ("AT+CMGS=\+447889165758\"\r\n");
delay_ms(100);
printf ("Fire\r\n");
delay_ms(1000);
printf ('%c",c)
delay_ms(50);reset_cpu();
}View attachment 61773
 
Start by fixing these 4 errors.

int=b;

bisable_interrupts(INT_EXT);

printf('AT+CMGI=2,1,0,0,1\R\N");

enable_interrupts(GLOABLE);

You have to try harder to find these yourself. it is not rocket science to fix simple syntax error like these! All computer languages follow a specified syntax and grammar. Get with the program :)
 
Last edited:
thank you Moderator & hexreader


int=b;
disable_interrupts(INT_EXT);
printf('AT+CMGI=2,1,0,0,1\R\N");
enable_interrupts(GLOABAL);
 

Latest threads

New Articles From Microcontroller Tips

Back
Top