![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c
PI_sunyang
Assistant embedded engineer!
Facebook:Yang Sun
Stack overflow:Sun_yy
Gmail:johnsonyang1994@gmail.com
一群志同道合的人共同到达一个从未到达的地方
展开
-
c
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <fcntl.h>#include <unistd.h>#include <sys/types.h>int main (){ int fd1,fd2,ret; char str[] = "You are foolish"; char b原创 2017-09-27 08:52:37 · 322 阅读 · 0 评论 -
c
void send_char_com( unsigned char ch){ES=0;TI=0;SBUF=ch;while (!TI );TI= 0 ;ES=1 ;}void main() {SCON = 0x50; //串口方式1,允许接收TMOD = 0x20; //定时器1定时方式2PCON=0x00; //cup正常工作TCON = 0x50; //设定时器1开始计原创 2017-09-28 11:26:26 · 296 阅读 · 0 评论 -
C
#include <stdio.h>#include <string.h>#include <stdlib.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>int main(void){ int fd, bytenum; int currpos; char wbuf[10] = "123原创 2017-09-20 11:37:27 · 330 阅读 · 0 评论 -
c
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <fcntl.h>#include <unistd.h>void *mymemcpy(void *desc,const void * src,size_t size){ if((desc == NULL) && (原创 2017-10-11 11:41:22 · 328 阅读 · 0 评论 -
Big-endian & Little-endian
#include <stdio.h>int main(void){ short int x; char x0,x1; x = 0x1234; x0 = ((char *)&x)[0];//低地址 x1 = ((char *)&x)[1];//高地址 printf("x0 = 0x%x , x1 = 0x%x\n",x0,x1 ); return原创 2017-10-16 13:53:23 · 237 阅读 · 0 评论 -
Configure Linux kernel source
1.ls /proc 2.cat /proc/version 查看内核版本 lsb_release -a原创 2017-11-23 13:30:13 · 318 阅读 · 0 评论 -
c 返回多个值
c training 1.利用全局变量(毒药)#include //input five int numbers,return min & max, in one functionint min_element;int max_element;int min_max(int a,int b,int c){ int t; if (a > b) {原创 2018-01-17 13:59:57 · 973 阅读 · 0 评论 -
I2C
linux application access i2c device#include <sys/ioctl.h> #include <fcntl.h> #include <linux/i2c-dev.h> #include <linux/i2c.h> #define CHIP "/dev/i2c-1" #define CHIP_AD...原创 2018-02-26 17:37:38 · 247 阅读 · 0 评论