- void tm1650_start(void)
- {
- TM_SCL_1;
- TM_SDA_1;
- TM_SDA_0;
- }
- void tm1650_stop(void)
- {
- TM_SCL_1;
- TM_SDA_0;
- TM_SDA_1;
- }
- void tm1650_ack(void)
- {
- delay_us(5);
-
- TM_SCL_0;
- TM_SCL_1;
- }
- void tm1650_write1(void)
- {
- TM_SDA_1;
- TM_SCL_0;
- TM_SCL_1;
- TM_SCL_0;
- }
- void tm1650_write0(void)
- {
- TM_SDA_0;
- TM_SCL_0;
- TM_SCL_1;
- TM_SCL_0;
- }
- void tm1650_writebyte(int8 val)
- {
- int8 i;
-
- for(i=0x80;i!=0x00;i>>=1)
- {
- if(val&i) tm1650_write1();
- else tm1650_write0();
- }
- }
- void test(void)
- {
- tm1650_start();
- tm1650_writebyte(0x48);
- tm1650_writebyte(0x10); //这里写10就是关闭数码管,11就是打开..现在可以显示正确的值,但是呢,,我写关闭的时候小数点会亮,我打开的时候不会亮.
- tm1650_ack();
- tm1650_stop();
-
- tm1650_start();
- tm1650_writebyte(0x68);
- tm1650_writebyte(0x3f);
- tm1650_ack();
- tm1650_stop();
-
- tm1650_start();
- tm1650_writebyte(0x6a);
- tm1650_writebyte(0x3f);
- tm1650_ack();
- tm1650_stop();
-
- tm1650_start();
- tm1650_writebyte(0x6c);
- tm1650_writebyte(0x3f);
- tm1650_ack();
- tm1650_stop();
-
- tm1650_start();
- tm1650_writebyte(0x6e);
- tm1650_writebyte(0x3f);
- tm1650_ack();
- tm1650_stop();
- }
复制代码
求助..
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>