Ihjaz Mohammad Nizam
Newbie level 1
- Joined
- Mar 27, 2014
- Messages
- 0
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 0
- Activity points
- 17
I have the code for PIC 18F14K50 but it shows many errors while compiling.
I am attaching the above stated program with this post.
Anyone please help me getting this program. Its very urgent.
Thank you.
I am attaching the above stated program with this post.
Anyone please help me getting this program. Its very urgent.
Thank you.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 char input[20]; volatile bit rx_event; void interrupt() { if (PIR1.RCIF) { UART1_Read_Text(input, "\r", 20); rx_event=1; } } void main() { short Start_up=0; short i; OSCCON.b6=1; OSCCON.b5=1; OSCCON.b4=0; OSCCON.b1=1; UART1_Init(38400); ANSELH.ANS11 =0; IOCB.IOCB7=0; TRISB.TRISB7=0; TRISB.TRISB5=1; Soft_UART_Init(&PORTC, 7, 6, 38400, 0); INTCON.PEIE = 1; //peripheral interrupt enable PIE1.RCIE = 1; //Receive char Interrupt Enable bit PIR1.RCIF = 0; //Receive char Interrupt flag- reset to 0 INTCON.GIE = 1; //global interrupt enable rx_event=0; //initialize rx_evnet to = 0 delay_ms(1000); //wait one sec for the stamp to stabilize if(Start_up==0){ //when the program firsts starts it will for(I = 1; I<=3;i++){ //flash on / off the stamps led uart1_write_text("L0"); //"L0" = led's off uart1_write(13); //<CR> delay_ms(1000); //wait one sec uart1_write_text("L1"); //"L1" = led's on uart1_write(13); //<CR> delay_ms(1000); //wait one sec } Start_up = 1; //by setting Start_up to 1, we stop the leds from flashing on/off } delay_ms(1000); //wait one sec for the stamp to stabilize after the led flashing uart1_write_text("c"); //the command "c" will tell the stamp to take continues readings uart1_write(13); //<CR> delay_ms(500); while(1){ short len=0; if(rx_event){ rx_event=0; len = strlen(input); for(i=0;i<len;i++){ Soft_UART_Write(input[i]); } Soft_UART_Write(13); } } }
Last edited by a moderator: