hemghosh04
Newbie level 4
Hi,
Can anyone help me out to convert this HI-TECH C language to MIKRO C for Pic microcontroller.
Thanks.
Can anyone help me out to convert this HI-TECH C language to MIKRO C for Pic microcontroller.
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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 /*sci.h file*/ #define FOSC (4000000L) #define SCI_EIGHT (0) #define SCI_NINE (1) unsigned char sci_Init(unsigned long int, unsigned char); void sci_PutByte(unsigned char); unsigned char sci_GetByte(void); void sci_PutNinth(unsigned char); unsigned char sci_GetNinth(void); unsigned char sci_GetFERR(void); unsigned char sci_CheckOERR(void); // unsigned char sci_GetByte(void) { while(!RCIF) /* set when register is not empty */ continue; return RCREG; /* RXD9 and FERR are gone now */ } void SendByteSerially(unsigned char Byte) //Writes a character to the serial port { while(!TXIF); //wait for previous transmission to finish TXREG = Byte; } void SendStringSerially(const unsigned char* st) { while(*st) SendByteSerially(*st++); SendByteSerially('\n'); } unsigned char ReceiveByteSerially(void) //Gets a character from the serial port { if(OERR) //if over run error, then reset the receiver { CREN = 0; CREN = 1; } while(!RCIF); //wait for transmission to receive return RCREG; } void start_lcd() { TRISB=0; Lcd4_Init(); Lcd4_Set_Cursor(1,0); Lcd4_Write_String(" WELCOME "); Lcd4_Set_Cursor(2,0); Lcd4_Write_String(" "); __delay_ms(2000); Lcd4_Set_Cursor(1,0); Lcd4_Write_String(" INITIALISING "); Lcd4_Set_Cursor(2,0); Lcd4_Write_String(" GSM "); SendStringSerially("AT\r"); __delay_ms(3000); SendStringSerially("AT+CMGF=1\r"); __delay_ms(3000); SendStringSerially("AT+CNMI=2,2,0,0,0\r"); __delay_ms(2000); } void delete_sms() { SendStringSerially("AT+CMGD=1\r"); SendByteSerially('\r'); SendByteSerially(0x1a); }
Thanks.
Last edited by a moderator: