#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>

//逻辑通道和物理通道的对应关系
//channel7 ain0

//channel6 ain1

//channel3 ain2

//channel4 ain3

//channel5 ain4

//channel2 ain5

//channel1 ain6

//channel0 ain7

int main(int argc, char *argv)
{

int i, n, fd;
        int ret;
        unsigned short val[8];
       
        fd = open("/dev/ad7927", O_RDWR);               //打开设备
        
    if (fd < 0)
        {
            printf("can't open /dev/ad7927!\n");
            exit(1);
        }

ret = read(fd, val, 8*sizeof(unsigned short)); //读取

if(ret > 0)
        {

for(i=0;i<8;i++)

printf("channel=%d,result = %x\n",
            (val[i]&0xe000)>>13, val[i]&0x1fff);

}
   
    sleep(10);
    return 0;
 }

sama5d3 环境检测 adc测试的更多相关文章

  1. sama5d3 环境检测 gpio--yk测试

    说明: gpio的MAP关系 yk0--pioA7  yk1--pioA5   yk2--pioA9   yk3--pioA3   yk4--pioA1  yk5--pioA8    (端子从左--& ...

  2. sama5d3 环境检测 gpio--yx测试

    说明: yx0--pioA0 yx1--pioA2  yx2--pioA4  yx3--pioA10  yx4--pioA14  yx5--pioA16 yx6--pioA12 yx7--pioA20 ...

  3. ADC测试matlab代码

    前面有做过ADC性能测试,测试方式是先使用ADC采集一个单频信号,然后利用matlab进行性能分析. 下面把matlab分析的代码记录下来: %The following program code p ...

  4. sam9260 adc 测试

    /* * adc_test.c * * Copyright (C) 2007 Mengrz */ #include <stdio.h> #include <stdlib.h> ...

  5. sama5d3 开入测试

    root@sama5d3-linux:~ echo 20 > /sys/class/gpio/export root@sama5d3-linux:~ echo 16 > /sys/clas ...

  6. 【嵌入式】FS2410非操作系统外围资源测试

    在刚接触FS2410时,其实这个测试也没有多大意义,但是对于以后来说,当一个产品做成功时,产品测试还是一个必须经过的一个阶段,所以这个流程还是有必要走一下! 在非操作系统下,主要进行RTC测试,按键测 ...

  7. STM32F412应用开发笔记之七:片上ADC的应用测试

    在我们的应用项目中需要采集一些模拟量,这些量使用MCU自带的ADC就可以满足要求.在NUCLEO-F412ZG实验板上的STM32F412ZG有一个16通道的ADC,我们试验用它采集几个数据. 在NU ...

  8. STM32CubeMX 多通道 ADC DMA 配置 测试小程序

    要点: 1.STM32F103C8T6单片机 2.ADC+DMA 多通道 重点是ADC+DMA配置,ADC+DMA配置如下 其他配置略略略略. 然后各位自行直看.ioc文件,生成代码后在while之前 ...

  9. 嵌入式Linux驱动学习之路(十九)触摸屏驱动、tslib测试

    触摸屏使用流程: 1. 按下产生中断. 2.在中断处理程序中启动AD转换XY坐标. 3.AD转换结束并产生AD中断. 4. 在AD的中断处理函数中上报信息,启动定时器. 5. 定时器时间到后进入中断, ...

随机推荐

  1. 【Networking】(转)一个非常好的epoll+线程池服务器Demo

    (转)一个非常好的epoll+线程池服务器Demo Reply 转载自:http://zhangyafeikimi.javaeye.com/blog/285193 [cpp] /** 张亚霏修改 文件 ...

  2. [AngularJS] Angular 1.3 $submitted for Form in Angular

    AngularJS 1.3 add $submitted for form, so you can use  $submitted  to track whether the submit event ...

  3. [ES6] 01. Intro to ES6 and traceur compiler

    ---恢复内容开始--- ES6 is ECMAScript version 6, which JavaScript is based on. The next version of JavaScri ...

  4. 外媒关注:中国版Twitter新浪微博推出微米对抗微信

    Sina, China’s answer to Twitter, enters the mobile messaging battle with its own app 中国版Twitter新浪,用自 ...

  5. 扩展MSEG 加入Z字段

    append    MSEG append    IMSEG append    BAPI_TE_XMSEG 实现 BADI: MB_BAPI_GOODSMVT_CREATE BAPI中: BAPI_ ...

  6. FastDFS简易概括

    FastDFS是一个文件系统,可以部署在Linux上. 该文件系统具备高可用和负载均衡特性,还可以动态扩充容量. 此文件系统有两个服务组成:跟踪服务和存储服务,也就是说你必须部署了这两种服务,这个文件 ...

  7. 【LeetCode】94. Binary Tree Inorder Traversal (3 solutions)

    Binary Tree Inorder Traversal Given a binary tree, return the inorder traversal of its nodes' values ...

  8. EF--Code First配置问题

    用EntityFramework Reverse POCO Generator工具生成的连接:<add name="Base_dbContext" connectionStr ...

  9. 对C++对象内存模型造成的影响(类/对象的大小)

    首先重新回顾一下关于类/对象大小的计算原则: 类大小计算遵循结构体对齐原则 第一个数据成员放在offset为0的位置 其它成员对齐至min(sizeof(member),#pragma pack(n) ...

  10. 使用PsExec tool在Session 0下运行程序

    在Service程序中使用OutputDebugString输出log信息, 在当前用户直接运行DbgView.exe, log信息是不会输出到DbgView窗口的.原因是Server程序运行在Ses ...