Robofun 機器人論壇

 找回密碼
 申請會員
搜索
熱搜: 活動 交友 discuz
查看: 5610|回復: 7
打印 上一主題 下一主題

請問一下RM-G144與rb-100的連接

[複製鏈接]
跳轉到指定樓層
1#
發表於 2010-6-14 09:53:09 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
有沒有大大可以教一下,
怎麼接RM-G144與rb-100。
原廠附的線好像不能直接接上rb-100


謝謝
2#
發表於 2010-6-14 14:45:51 | 只看該作者
R-110可以直接接
R100就是看文件自己做線去接了
http://www.roboard.com/Files/G144/RoBoard_RM-G144.pdf  第11頁
和R100的I2C那邊一條一條(pin對pin)自己接上去

VCC/GNC/SDA/SCL 四條不要接錯
原廠的範例程式是可以直接動的
3#
發表於 2010-6-14 15:15:00 | 只看該作者
把黑色那頭的pin 挑出來 就可以 單 pin 接了
GND 可以接到 PWM的 GND
Vcc, SCL, SCA 接到 SPI/I2C 那邊的 2,4,6 Pin
4#
發表於 2010-6-14 15:33:22 | 只看該作者
本帖最後由 mzw2008 於 2010-6-14 15:35 編輯

啊...哈哈, 倒是沒注意腳位可以這樣對準上去
用美工刀就可以把黑線挑出來喔
可別重焊XD

R100 的I2C定義在
http://www.roboard.com/Files/RB-100/RoBoard_Training_HW.pdf 第29頁
5#
發表於 2010-6-14 16:01:35 | 只看該作者
當初那黑色 1x5 是克意加上去的
不然出貨時打算是 裸 pin
但怕 pin 腳去弄壞材
才多扣上黑色  connector 做保護用
6#
 樓主| 發表於 2010-6-14 18:59:42 | 只看該作者
我本來也是這樣想,果然一樣
謝謝了
7#
 樓主| 發表於 2010-6-14 22:28:57 | 只看該作者
另外請問一下,原廠sample code放在哪?
我找不到
8#
發表於 2010-6-14 23:00:25 | 只看該作者
本帖最後由 mzw2008 於 2010-6-14 23:02 編輯

sample code在sensor寄到那天晚上我就寄給你了啊
這是基本的I2C介面控制程式
小修改就能變成用arduino控制了, 相關的規格在這裡,
Address 在官網裡面都有答案, 請自行查詢(打開文件搜尋address)
http://www.roboard.com/Files/G144/HMC5843.pdf
http://www.roboard.com/Files/G144/ADXL345.pdf

#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <roboard.h>
int main(void){
unsigned char d1,d2,d3,d4,d5,d6;
unsigned long i2c_clock = 400000L;
unsigned int i2c_address = 0x53;

    if (i2c_Initialize(I2CIRQ_DISABLE) == false)
    {
  printf("FALSE!!  %s\n", roboio_GetErrMsg());
  return -1;
}

i2c0_SetSpeed(I2CMODE_FAST, i2c_clock);
i2c0master_StartN(i2c_address,I2C_WRITE,2);//write 2 byte
i2c0master_WriteN(0x2d); //Pwoer_Control register
i2c0master_WriteN(0x28); //link and measure mode
delay(100);
i2c0master_StartN(i2c_address,I2C_WRITE,2);//write 2 byte
i2c0master_WriteN(0x31); //Data_Format register
i2c0master_WriteN(0x08); //Full_Resolution
delay(100);

i2c0master_StartN(i2c_address,I2C_WRITE,2);//write 2 byte
i2c0master_WriteN(0x38); //FIFO_Control register
i2c0master_WriteN(0x00); //bypass mode
delay(100);
do
{
  i2c0master_StartN(i2c_address, I2C_WRITE, 1);
  i2c0master_SetRestartN(I2C_READ, 6);
  i2c0master_WriteN(0x32); //Read from X register (Address : 0x32)
  d1 = i2c0master_ReadN();//X LSB
  d2 = i2c0master_ReadN();//X MSB
  d3 = i2c0master_ReadN();//Y LSB
  d4 = i2c0master_ReadN();//Y MSB
  d5 = i2c0master_ReadN();//Z LSB
  d6 = i2c0master_ReadN();//Z MSB
  //Data : 10 bits
  printf("Acceleration of X-axis :%d\n", (d2 & 0x02) ? ~(0xFFFF ^ (d2*256+d1)) : d2*256+d1);
  printf("Acceleration of Y-axis :%d\n", (d4 & 0x02) ? ~(0xFFFF ^ (d4*256+d3)) : d4*256+d3);
  printf("Acceleration of Z-axis :%d\n", (d6 & 0x02) ? ~(0xFFFF ^ (d6*256+d5)) : d6*256+d5);
  delay(100);
}while(getch() != 27);
    i2c_Close();
    return 0;
}
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

小黑屋|手機版|Archiver|機器人論壇 from 2005.07

GMT+8, 2024-4-20 18:03 , Processed in 0.164883 second(s), 8 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表