ako din magtatanong...yung mga at-commands ba, ipiniprint lang sa serial port(assuming serial port nakakabit ang gsm modem)? so kung may nagtext sa PC ng "Hoy, pogi!"ang reply ko sa program sa C: printf("AT+CMGS="0917111222\r");printf("ano yun??!! ctrl-z"); // Pano ba ang Ctrl-z?!
printf("AT+CMGS="0917111222\r");printf("ano yun??!!");putchar(26); //hexadecimal 1A in decimal
tama ba itong code? Code: [Select]printf("AT+CMGS="0917111222\r");printf("ano yun??!!");putchar(26); //hexadecimal 1A in decimal
kung yung putchar tutuloy din dun sa string, yup. kailangan din yung quotation marks. hindi ko na maalala ang printf ng C. lagi ako gumagamit ng C pero parang antagal ko nang hindi gumamit ng printf.
You can also embed special characters sa string using the "\nnn" octal formatprintf("ano yun??!!\032");\032 octal = 0x1A hex.Mas madalas akong magprogram using assembly. If ever I have to use C, ayaw ko rin gamitin ang printf. Malakas lumamon ng code memory space. Dala dala ko pa rin itong habit na ito kahit na malalaki na ngayon ang code memory space ng mga micro.
pano ba ang command line kung di gagamit ng printf?kunwari yang sample program...
void put_string(const char * s) //send string to UART for transmission{ while(*s){ //while end of string is not reached while(!TXIF); //wait until previous character is transmitted TXREG = *s++; //write character to transmit register and } //char is transmitted immediately when hardware //is able; then pointer is increment to point to //next character in the string array }
void main(){ init_uart(); //initialize UART, assume function is declared somewhere put_string("sevenstring impakta\n"); //send string to UART //you can view the output //using Hyperterminal while(1); }
put_string("AT+CMGS="0917111222\032");