Example
#{example}"); ipb.editor_values.get('templates')['togglesource'] = new Template(""); ipb.editor_values.get('templates')['toolbar'] = new Template(""); ipb.editor_values.get('templates')['button'] = new Template("
Emoticons
"); // Add smilies into the mix ipb.editor_values.set( 'show_emoticon_link', false ); ipb.editor_values.set( 'bbcodes', $H({"snapback":{"id":"1","title":"Post Snap Back","desc":"This tag displays a little linked image which links back to a post - used when quoting posts from the board. Opens in same window by default.","tag":"snapback","useoption":"0","example":"[snapback]100[/snapback]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"topic":{"id":"5","title":"Topic Link","desc":"This tag provides an easy way to link to a topic","tag":"topic","useoption":"1","example":"[topic=1]Click me![/topic]","switch_option":"0","menu_option_text":"Enter the topic ID","menu_content_text":"Enter the title for this link","single_tag":"0","optional_option":"0","image":""},"post":{"id":"6","title":"Post Link","desc":"This tag provides an easy way to link to a post.","tag":"post","useoption":"1","example":"[post=1]Click me![/post]","switch_option":"0","menu_option_text":"Enter the Post ID","menu_content_text":"Enter the title for this link","single_tag":"0","optional_option":"0","image":""},"spoiler":{"id":"7","title":"Spoiler","desc":"Spoiler tag","tag":"spoiler","useoption":"0","example":"[spoiler]Some hidden text[/spoiler]","switch_option":"0","menu_option_text":"","menu_content_text":"Enter the text to be masked","single_tag":"0","optional_option":"0","image":""},"acronym":{"id":"8","title":"Acronym","desc":"Allows you to make an acronym that will display a description when moused over","tag":"acronym","useoption":"1","example":"[acronym='Laugh Out Loud']lol[/acronym]","switch_option":"0","menu_option_text":"Enter the description for this acronym (EG: Laugh Out Loud)","menu_content_text":"Enter the acronym (EG: lol)","single_tag":"0","optional_option":"0","image":""},"hr":{"id":"12","title":"Horizontal Rule","desc":"Adds a horizontal rule to separate text","tag":"hr","useoption":"0","example":"[hr]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"1","optional_option":"0","image":""},"php":{"id":"14","title":"PHP Code","desc":"Allows you to enter PHP code into a formatted/highlighted syntax box","tag":"php","useoption":"0","example":"[php]$variable = true;\n\nprint_r($variable);[/php]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"html":{"id":"15","title":"HTML Code","desc":"Allows you to enter formatted/syntax-highlighted HTML code","tag":"html","useoption":"0","example":"[html]\n \n[/html]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"sql":{"id":"16","title":"SQL Code","desc":"Allows you to enter formatted/syntax-highlighted SQL code","tag":"sql","useoption":"0","example":"[sql]SELECT p.*, t.* FROM posts p LEFT JOIN topics t ON t.tid=p.topic_id WHERE t.tid=7[/sql]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"xml":{"id":"17","title":"XML Code","desc":"Allows you to enter formatted/syntax-highlighted XML code","tag":"xml","useoption":"0","example":"[xml]2 Replies - 36 Views - Last Post: Today, 07:31 AM
#1
Reputation: 0
- Posts: 1
- Joined: Yesterday, 11:07 PM
Posted Yesterday, 11:17 PM
Hello guys, i'm new here. i have a code which will write command to serial port and after that read the output from the port. I've tested to read 8 byte data and it works but when i tried to read 111 byte of data, it's not working. Below is my code, please do take a look. Takes in advance.#include <stdio.h> /* Standard input/output definitions */ #include <string.h> /* String function definitions */ #include <unistd.h> /* UNIX standard function definitions */ #include <fcntl.h> /* File control definitions */ #include <errno.h> /* Error number definitions */ #include <termios.h> /* POSIX terminal control definitions */ /* * 'open_port()' - Open serial port 1. * * Returns the file descriptor on success or -1 on error. */ int open_port(void) { int fd; /* File descriptor for the port */ fd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NDELAY); if (fd < 0) { /* Could not open the port */ fprintf(stderr, "open_port: Unable to open /dev/ttyUSB0 - %s\n", strerror(errno)); } return (fd); } void main() { int mainfd=0, i; /* File descriptor */ char cnt, result2; unsigned char result,chout; struct termios options; FILE *fp; mainfd = open_port(); fcntl(mainfd, F_SETFL, FNDELAY); /* Configure port reading */ /* Get the current options for the port */ tcgetattr(mainfd, &options); cfsetispeed(&options, B19200); /* Set the baud rates to 19200 */ cfsetospeed(&options, B19200); /* Enable the receiver and set local mode */ options.c_cflag |= (CLOCAL | CREAD); options.c_cflag &= ~PARENB; /* Mask the character size to 8 bits, no parity */ options.c_cflag &= ~CSTOPB; options.c_cflag &= ~CSIZE; options.c_cflag |= CS8; /* Select 8 data bits */ options.c_cflag &= ~CRTSCTS; /* Disable hardware flow control */ /* Enable data to be processed as raw input */ options.c_lflag &= ~(ICANON | ECHO | ISIG); /* Set the new options for the port */ tcsetattr(mainfd, TCSANOW, &options); result2 = tcsetattr(mainfd, TCSANOW, &options); if ( result2 == -1 ) { perror("error: tcsetattr"); } if ( result2 != 0 ) { fprintf(stderr,"error in tcsetattr, result = %d\n", result2); } result2 = write(mainfd,"\xF5\x23\x00\x00\x00\x00\x23\xF5",8); if ( result2 == -1 ) { perror("error: write"); } if ( result2 != 8 ) { fprintf(stderr,"error in write, result = %d\n", result2); } usleep(5000000); /* wait for 5 second*/ fp = fopen("results_eigenvalue", "w"); /*open and write into existing file*/ for(i=0;i<111;i++) { result = read(mainfd, &chout, sizeof(chout)); /* Read character from ABU (Auto buffering Unit) */ if ( result == -1 ) { perror("error: read"); } /*if ( result!= 1 ) { fprintf(stderr,"error in read, result = %d\n", result); } if (chout!= 0)*/ fprintf(fp,"%02x ",chout); } /* Close the serial port */ close(mainfd); }
Is This A Good Question/Topic? 0
Replies To: Problem Read 111 byte from serial port
#2
Reputation: 8924
- Posts: 33,067
- Joined: 27-December 08
Re: Problem Read 111 byte from serial port
Posted Today, 07:18 AM
Moved to C/C++. Please do not post help questions in the Challenges subforum. The Challenges forums are for fun challenges, not help/homework questions.
#3
Reputation: 2940
- Posts: 8,929
- Joined: 25-December 09
Re: Problem Read 111 byte from serial port
Posted Today, 07:31 AM
Page 1 of 1
Source: http://www.dreamincode.net/forums/topic/318645-problem-read-111-byte-from-serial-port/
chris carter superbowl 2012 kickoff time what time is the super bowl 2012 nfl mvp lana del rey snl performance nick diaz sheryl sandberg
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন