搜索
bottom↓
回复: 5

那位有bascom avr的I2CSLAVE Library文件i2cslave.lib和i2cslave.lbx

[复制链接]

出0入0汤圆

发表于 2006-12-5 13:36:15 | 显示全部楼层 |阅读模式
编译例程I2CSLAVE_PCF8574.bas时用到,编译错误,提示信息:找不到i2cslave.lib和i2cslave.lbx。

哪位大虾有,能提供一下吗?

阿莫论坛20周年了!感谢大家的支持与爱护!!

曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……

出0入0汤圆

 楼主| 发表于 2006-12-5 16:10:29 | 显示全部楼层
补充一下关于这个苦的说明文档:

I2CSLAVE





The I2C-Slave library is intended to create I2C slave chips. This is an add-on library that is not included by default.







All BASCOM I2C routines are master I2C routines. The AVR is a fast chip and allows to implement the I2C slave protocol.



You can control the chips with the BASCOM I2C statements like I2CINIT, I2CSEND, I2CRECEIVE, I2CWBYTE, etc. Please consult the BASCOM Help file for using I2C in master mode.







Before you begin



Copy the i2cslave.lib and i2cslave.lbx files into the BASCOM-AVR\LIB directory.



The i2cslave.lib file contains the ASM source. The i2cslave.lbx file contains the compiled ASM source.







Slave address



Every I2C device must have an address so it can be addressed by the master I2C routines.



When you write to an I2C-slave chip the least significant bit (bit0) is used to specify if we want to read from the chip or that we want to write to the chip.



When you specify the slave address, do not use bit 0 in the address!







For example a PCF8574 has address &H40. To write to the chip use &H40, to read from the chip, use &H41. When emulating a PCF8574 we would specify address &H40.







Use the CONFIG statement to specify the slave address:







Config I2cslave = &B01000000 ' same as &H40

Optional use : CONFIG I2CSLAVE = address, INT= int , TIMER = tmr



Where INT is INT0, INT1 etc. and TIMER is TIMER0, TIMER1 etc.



When using other interrupts or timers, you need to change the library source. The library was written for TIMER0 and INT0.



The I2C slave routines use the TIMER0 and INT0. You can not use these interrupts yourself. It also means that the SCL and SDA pins are fixed.







Note that new AVR chips have a TWI or hardware I2C implementation. It is better to use hardware I2C, then the software I2C. The slave library is intended for AVR chips that do not have hardware I2C.







CONFIG I2CSLAVE will enable the global interrupts.







After you have configured the slave address, you can insert your code.



A do-loop would be best:







Do



?your code here



Loop







This is a simple never-ending loop. You can use a GOTO with a label or a While Wend loop too but ensure that the program will never end.







After your main program you need to insert two labels with a return:







When the master needs to read a byte, the following label is always called



You must put the data you want to send to the master in variable _a1 which is register R16



I2c_master_needs_data:



'when your code is short, you need to put in a waitms statement



'Take in mind that during this routine, a wait state is active and the master will wait



'After the return, the waitstate is ended



Config Portb = Input ' make it an input



_a1 = Pinb ' Get input from portB and assign it



Return

出0入0汤圆

发表于 2006-12-6 15:34:40 | 显示全部楼层
这个是需要购买的,具体内容请参考代理的网站



http://www.avrbascom.com/buySoftware.html

出0入0汤圆

 楼主| 发表于 2006-12-6 16:25:10 | 显示全部楼层
昨天打电话了,不通!

发邮件,没回音!

郁闷!

出0入0汤圆

发表于 2006-12-7 10:48:25 | 显示全部楼层
邮件已经给您回复了 请您查收。

出0入0汤圆

发表于 2013-7-12 03:33:52 | 显示全部楼层
miamia 发表于 2006-12-6 20:48
邮件已经给您回复了 请您查收。

我也要一份  zxttgg@gmail.com
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-8-26 23:54

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表