No.108077 作者:liufengzhong 邮件:l_fz@sina.com ID:149522 登陆:12次 文章数:695篇 最后登陆IP:183.13.93.245 最后登陆:2015/6/16 17:02:27 注册:2014/7/29 21:51:15 财富:3671 发帖时间:2014/8/5 15:51:23 发贴者IP:111.221.200.181 标题:liufengzhong:[转帖]GPIO ADC Slice 在 Slice Kit 摘要:No.108077[转帖]GPIO ADC Slice 在 Slice Kit 嘿,我连接gpio adc slice用slicekit遇到麻烦。我似乎无法从任何的ADC的对它读值。 我用一个简单的电位器接口板,并尝试只是发送3.3V到ADC来读任何东西。有一张图附在这个问题关于我对在GPIO slice引脚ADC的理解。 这是我用过的代码(其修改的代码,用于简单的GPIO例子) 。 n stdcore[0]: struct r_i2c i2cOne = { XS1_PORT_1F, XS1_PORT_1F, 1000 }; void app_manager() { unsigned button_press_1,button_press_2,time,time1; int button =1,index=0,toggle=0; timer t; unsigned char data[1]={0x23}; unsigned char data1[2]; int adc_value; unsigned led_value=0x0E; p_PORT_BUT_1:> button_press_1; set_port_drive_low(p_PORT_BUT_1); //::Write config i2c_master_init(i2cOne); i2c_master_write_reg(0x28, 0x00, data, 1, i2cOne); //Write configuration information to ADC //::Config t:> time; printstrln("** WELCOME TO SIMPLE GPIO DEMO **"); while(1) { //::Select start select { case button => p_PORT_BUT_1 when pinsneq(button_press_1):> button_press_1: //checks if any button is pressed button=0; t:> time; break; //waits for 20ms and checks if the same button is pressed or not case !button => t when timerafter(time+debounce_time):> void: p_PORT_BUT_1:> button_press_2; if(button_press_1==button_press_2) //Button 1 is pressed if(button_press_1 == BUTTON_PRESS_value) { printstrln("Button 1 Pressed"); p_led <:(led_value); led_value=led_value < <1; led_value|=0x01; led_value=led_value & 0x0F; ......
>>返回讨论的主题
|