English 中文(简体)
例如,关于MCP23017(16 pin IO extensioner, I2C)的文件,作为7-gment LCD驾驶员
原标题:example code, documents on MCP23017 (16 pin IO extender, I2C) as an 7-segment LCD driver

微型芯片中的MCP23017是I2C的16平流体延伸器。 我能够一劳永逸地安放装置(固定方向和价值),但此后不能改变预期的价值,除非这种装置重塑/电循环。 这部法典首次用于对它进行规范化,并设置了皮条:

  I2C_Start();
  I2C_Write(0x40);   // slave address
  I2C_Write(0x00);  // address register
  ... (sequential mode so next 10 are set to I2C_Write(0x00);
  I2C_Write(0x08);  // IOCON: HAEN=1
  I2C_Write(0x08);  // IOCON: HAEN=1
  ... (sequential mode so next 6 are set to I2C_Write(0x00);
  I2C_Write(0xFEu);  // GPIOA
  I2C_Write(0x01u);  // GPIOB
  I2C_Stop();

after this i would like to be able to toggle the output values (0xFE <-> 0x01). I attempted this code:

  I2C_Start();
  I2C_Write(0x40);   // slave address
  I2C_Write(0x12);   // address register
  I2C_Write(0x01u);  // GPIOA
  I2C_Write(0xFEu);  // GPIOB
  I2C_Stop();

在这一点上,午餐似乎随意(投入与产出、产出高和低)。 如果有人使用I2C IO推广器,请帮助我。 即便您不能完全相信你会作出评论。 注:此处显示的I2C 预报器是一种轨道禁止算法,所有24个周期均具有预兆。 两者的重量。

useful documents (kind of): http://ww1.microchip.com/downloads/en/DeviceDoc/21952b.pdf

问题回答

仔细研究一下SCL和SDA信号,使用一个电离镜或逻辑分析器,检查你的时间安排和数据,以确保你向I/O发送你认为你的数值。





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签