Buy an Axon, Axon II, or Axon Mote and build a great robot, while helping to support SoR.
0 Members and 1 Guest are viewing this topic.
#include "C:\Documents and Settings\Aruna\Desktop\pic c\aa\a.h"#include <stdio.h>void main(){ setup_adc_ports(NO_ANALOGS|VSS_VDD); setup_adc(ADC_OFF); setup_timer_0(RTCC_INTERNAL);setup_wdt(WDT_18MS); setup_timer_1(T1_DISABLED); setup_comparator(NC_NC); setup_vref(FALSE); // TODO: USER CODE!! while(1) { output_high(PIN_A3); delay_ms(1000); output_low(PIN_A3); delay_ms(1000); }}
Error 111 "C:\Documents and Settings\Aruna\Desktop\pic c\aa\a.h" Line 11(7,46):unknown keyword in #FUSES "BORSEN"/code]here is my complete header file[code]#include <12F675.h>#device adc=8#FUSES WDT //Watch Dog Timer#FUSES INTRC_IO //Internal RC Osc, no CLKOUT#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#FUSES BORSEN //See Datasheet#use delay(clock=4000000)#use rs232(baud=9600,parity=N,xmit=PIN_A3,rcv=PIN_A2,bits=8)
Lines similar to the following should be the first lines in your main C file:#include <16F876A.h>#fuses HS,NOWDT,NOPROTECT,NOLVP,NOBROWNOUT#use delay(clock=20000000)#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)Give that a try. Obviously, tailor this to your situation.
#use delay(clock=4000000)
I checked Mouser for 12F675 parts. They are all 20 MHz parts there. Yours probably is too.
Yes. There is an advantage. External oscillators (in the form of ceramic resonators or crystals) are much more accurate timing sources, especially crystals. If you are doing a project that requires accurate timing, this will become important to you.Google is your friend for finding PIC projects, but I like the many books that are available for PIC projects.I did have this site bookmarked.http://www.best-microcontroller-projects.com/index.htmlThe 12F675 is an awesome little chip. When I was your age, I had to wrestle with 555 timers just to get a square wave... And I had to walk to school, uphill both ways.
#include "D:\PIC C codes\PWM1\pwm1.h"#include <12F675.h>#device adc=10#FUSES NOWDT, INTRC_IO, NOCPD, NOPROTECT, NOMCLR, NOPUT, BROWNOUT#use delay(clock=4000000)#use rs232(baud=9600,parity=N,xmit=PIN_A3,rcv=PIN_A2,bits=8)#byte OSCCAL = 0x80int x=0;void pwm(int a){if(a==1)output_high(PIN_A1);if(a==2){output_high(PIN_A1);delay_us(87.5);output_low(PIN_A1);delay_us(12.5);}if(a==3){output_high(PIN_A1);delay_us(75);output_low(PIN_A1);delay_us(25);}if(a==4){output_high(PIN_A1);delay_us(62.5);output_low(PIN_A1);delay_us(37.5);}if(a==5){output_high(PIN_A1);delay_us(50);output_low(PIN_A1);delay_us(50);}if(a==6){output_high(PIN_A1);delay_us(37.5);output_low(PIN_A1);delay_us(62.5);}if(a==7){output_high(PIN_A1);delay_us(25);output_low(PIN_A1);delay_us(75);}if(a==8){output_low(PIN_A1);}}void main(){ setup_adc_ports(sAN0|VSS_VDD); setup_adc(AN0_ANALOG); setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); setup_timer_1(T1_DISABLED); setup_comparator(NC_NC); setup_vref(FALSE); // TODO: USER CODE!! set_adc_channel(0); while(1) { delay_ms(10); x=read_adc(); if(x>=0 && X<31) pwm(8); if(x>=31 && X<63) pwm(7); if(x>=63 && X<95) pwm(6); if(x>=95 && X<127) pwm(5); if(x>=127 && X<159) pwm(4); if(x>=159 && X<191) pwm(3); if(x>=191 && X<223) pwm(2); if(x>=223 && X<255) pwm(1); }}
can i use opto isolator(attached zip file) to short 2 pins of a motor for breaking?