Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

need a simple C program for PIC controller.

Status
Not open for further replies.

akhileshchidare

Member level 3
Joined
Oct 4, 2005
Messages
59
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
1,758
noprotect sourceboost

hi,
can any one send a basic C program for addition in PIC microcontroller.

Akhilesh Chidare
 

Tohu

Full Member level 1
Joined
Jun 9, 2004
Messages
96
Helped
16
Reputation
32
Reaction score
4
Trophy points
1,288
Activity points
1,328
#include "D:\MyDocuments\Isdelia\test\pic12.h"

#int_ext
ext_irs()
{
if(getc()==('a'))
{
output_high(pin_a0);
delay_ms(300);
output_low(pin_a0);
}
}

void main()
{

setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_comparator(NC_NC);
setup_vref(VREF_LOW|-2);
enable_interrupts(int_ext);
enable_interrupts(global);
while(1)
{
delay_ms(500);
putc('b');
output_high(PIN_A3);
delay_ms(500);
output_low(PIN_A3);


}
}

.h file
#include <12F675.h>

#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //Internal RC Osc
#FUSES NOCPD //No EE protection
#FUSES NOPROTECT //Code not protected from reading
#FUSES MCLR //Master Clear pin enabled
#FUSES NOPUT //No Power Up Timer
#FUSES BROWNOUT //Reset when brownout detected

#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_A1,rcv=PIN_A2,bits=9)

this is a simple program that every 1 s send byte ASCI b to the serial port /software serial port/ and flashing LED 500/500 ms.

edit: also this progrm wait for a recive byte, if this byte is equal to ASCII a then flashing led in port A0.

p.s. this is for the CCS IDE
 

mobile-it

Advanced Member level 1
Joined
Apr 24, 2004
Messages
467
Helped
22
Reputation
44
Reaction score
8
Trophy points
1,298
Activity points
3,344
Try to search for Sourceboost IDE
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top