找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 11646|回复: 23
打印 上一主题 下一主题
收起左侧

MSP430F5529硬件IIC驱动IIC接口的OLED源码

  [复制链接]
跳转到指定楼层
楼主
ID:222477 发表于 2018-7-17 10:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
  1. //******************************************************************************
  2. //   MSP430F552x Demo - USCI_B0, I2C Master multiple byte TX/RX
  3. //
  4. //   Description: I2C master communicates to I2C slave sending and receiving
  5. //   3 different messages of different length. I2C master will enter LPM0 mode
  6. //   while waiting for the messages to be sent/receiving using I2C interrupt.
  7. //   ACLK = NA, MCLK = SMCLK = DCO 16MHz.
  8. //
  9. //                                     /|\ /|\
  10. //                   MSP430F5529       4.7k |
  11. //                 -----------------    |  4.7k
  12. //            /|\ |             P3.1|---+---|-- I2C Clock (UCB0SCL)
  13. //             |  |                 |       |
  14. //             ---|RST          P3.0|-------+-- I2C Data (UCB0SDA)
  15. //                |                 |
  16. //                |                 |
  17. //                |                 |
  18. //                |                 |
  19. //                |                 |
  20. //                |                 |
  21. //
  22. //   Nima Eskandari
  23. //   Texas Instruments Inc.
  24. //   April 2017
  25. //   Built with CCS V7.0
  26. //******************************************************************************

  27. #include <msp430.h>
  28. #include <stdint.h>
  29. #include <stdbool.h>
  30. #include "oledfont.h"

  31. //******************************************************************************
  32. // Example Commands ************************************************************
  33. //******************************************************************************
  34. #define X_WIDTH         128
  35. #define Y_WIDTH         64
  36. #define OLED_CMD  0        //写命令
  37. #define OLED_DATA 1        //写数据
  38. #define SLAVE_ADDR  0x3C

  39. /* CMD_TYPE_X_SLAVE are example commands the master sends to the slave.
  40. * The slave will send example SlaveTypeX buffers in response.
  41. *
  42. * CMD_TYPE_X_MASTER are example commands the master sends to the slave.
  43. * The slave will initialize itself to receive MasterTypeX example buffers.
  44. * */

  45. #define CMD_TYPE_0_SLAVE      0
  46. #define CMD_TYPE_1_SLAVE      1
  47. #define CMD_TYPE_2_SLAVE      2

  48. #define CMD_TYPE_0_MASTER      3
  49. #define CMD_TYPE_1_MASTER      4
  50. #define CMD_TYPE_2_MASTER      5

  51. #define TYPE_0_LENGTH   1
  52. #define TYPE_1_LENGTH   2
  53. #define TYPE_2_LENGTH   6

  54. #define MAX_BUFFER_SIZE     20

  55. /* MasterTypeX are example buffers initialized in the master, they will be
  56. * sent by the master to the slave.
  57. * SlaveTypeX are example buffers initialized in the slave, they will be
  58. * sent by the slave to the master.
  59. * */

  60. uint8_t MasterType2 [TYPE_2_LENGTH] = {'F', '4', '1', '9', '2', 'B'};
  61. uint8_t MasterType1 [28] = {0xae,0x00,0x10,0x40,0x81,0xcf,0xa1,0xc8,0xa6,0xa8,0x3f,0xd3,0x00,0xd5,0x80,0xd9,0xf1,0xda,0x12,0xdb,0x40,0x20,0x02,0x8d,0x14,0xa4,0xa6,0xaf};
  62. uint8_t MasterType0 [1] = {0};


  63. uint8_t SlaveType2 [TYPE_2_LENGTH] = {0};
  64. uint8_t SlaveType1 [TYPE_1_LENGTH] = {0};
  65. uint8_t SlaveType0 [TYPE_0_LENGTH] = {0};

  66. void delay(unsigned int z)
  67. {
  68.   unsigned int x,y;
  69.   for(x=z;x>0;x--)
  70.     for(y=5000;y>0;y--);
  71. }

  72. //******************************************************************************
  73. // General I2C State Machine ***************************************************
  74. //******************************************************************************

  75. typedef enum I2C_ModeEnum{
  76.     IDLE_MODE,
  77.     NACK_MODE,
  78.     TX_REG_ADDRESS_MODE,
  79.     RX_REG_ADDRESS_MODE,
  80.     TX_DATA_MODE,
  81.     RX_DATA_MODE,
  82.     SWITCH_TO_RX_MODE,
  83.     SWITHC_TO_TX_MODE,
  84.     TIMEOUT_MODE
  85. } I2C_Mode;

  86. /* Used to track the state of the software state machine*/
  87. I2C_Mode MasterMode = IDLE_MODE;

  88. /* The Register Address/Command to use*/
  89. uint8_t TransmitRegAddr = 0;

  90. /* ReceiveBuffer: Buffer used to receive data in the ISR
  91. * RXByteCtr: Number of bytes left to receive
  92. * ReceiveIndex: The index of the next byte to be received in ReceiveBuffer
  93. * TransmitBuffer: Buffer used to transmit data in the ISR
  94. * TXByteCtr: Number of bytes left to transfer
  95. * TransmitIndex: The index of the next byte to be transmitted in TransmitBuffer
  96. * */
  97. uint8_t ReceiveBuffer[MAX_BUFFER_SIZE] = {0};
  98. uint8_t RXByteCtr = 0;
  99. uint8_t ReceiveIndex = 0;
  100. uint8_t TransmitBuffer[MAX_BUFFER_SIZE] = {0};
  101. uint8_t TXByteCtr = 0;
  102. uint8_t TransmitIndex = 0;

  103. /* I2C Write and Read Functions */

  104. /* For slave device with dev_addr, writes the data specified in *reg_data
  105. *
  106. * dev_addr: The slave device address.
  107. *           Example: SLAVE_ADDR
  108. * reg_addr: The register or command to send to the slave.
  109. *           Example: CMD_TYPE_0_MASTER
  110. * *reg_data: The buffer to write
  111. *           Example: MasterType0
  112. * count: The length of *reg_data
  113. *           Example: TYPE_0_LENGTH
  114. *  */
  115. I2C_Mode I2C_Master_WriteReg(uint8_t dev_addr, uint8_t reg_addr, uint8_t *reg_data, uint8_t count);

  116. /* For slave device with dev_addr, read the data specified in slaves reg_addr.
  117. * The received data is available in ReceiveBuffer
  118. *
  119. * dev_addr: The slave device address.
  120. *           Example: SLAVE_ADDR
  121. * reg_addr: The register or command to send to the slave.
  122. *           Example: CMD_TYPE_0_SLAVE
  123. * count: The length of data to read
  124. *           Example: TYPE_0_LENGTH
  125. *  */
  126. I2C_Mode I2C_Master_ReadReg(uint8_t dev_addr, uint8_t reg_addr, uint8_t count);
  127. void CopyArray(uint8_t *source, uint8_t *dest, uint8_t count);

  128. I2C_Mode I2C_Master_ReadReg(uint8_t dev_addr, uint8_t reg_addr, uint8_t count)
  129. {
  130.     /* Initialize state machine */
  131.     MasterMode = TX_REG_ADDRESS_MODE;
  132.     TransmitRegAddr = reg_addr;
  133.     RXByteCtr = count;
  134.     TXByteCtr = 0;
  135.     ReceiveIndex = 0;
  136.     TransmitIndex = 0;

  137.     /* Initialize slave address and interrupts */
  138.     UCB0I2CSA = dev_addr;
  139.     UCB0IFG &= ~(UCTXIFG + UCRXIFG);       // Clear any pending interrupts
  140.     UCB0IE &= ~UCRXIE;                       // Disable RX interrupt
  141.     UCB0IE |= UCTXIE;                        // Enable TX interrupt

  142.     UCB0CTL1 |= UCTR + UCTXSTT;             // I2C TX, start condition
  143.     __bis_SR_register(LPM0_bits + GIE);              // Enter LPM0 w/ interrupts

  144.     return MasterMode;

  145. }


  146. I2C_Mode I2C_Master_WriteReg(uint8_t dev_addr, uint8_t reg_addr, uint8_t *reg_data, uint8_t count)
  147. {
  148.     /* Initialize state machine */
  149.     MasterMode = TX_REG_ADDRESS_MODE;
  150.     TransmitRegAddr = reg_addr;

  151.     //Copy register data to TransmitBuffer
  152.     CopyArray(reg_data, TransmitBuffer, count);

  153.     TXByteCtr = count;
  154.     RXByteCtr = 0;
  155.     ReceiveIndex = 0;
  156.     TransmitIndex = 0;

  157.     /* Initialize slave address and interrupts */
  158.     UCB0I2CSA = dev_addr;
  159.     UCB0IFG &= ~(UCTXIFG + UCRXIFG);       // Clear any pending interrupts
  160.     UCB0IE &= ~UCRXIE;                       // Disable RX interrupt
  161.     UCB0IE |= UCTXIE;                        // Enable TX interrupt

  162.     UCB0CTL1 |= UCTR + UCTXSTT;             // I2C TX, start condition
  163.     __bis_SR_register(LPM0_bits + GIE);              // Enter LPM0 w/ interrupts

  164.     return MasterMode;
  165. }

  166. void CopyArray(uint8_t *source, uint8_t *dest, uint8_t count)
  167. {
  168.     uint8_t copyIndex = 0;
  169.     for (copyIndex = 0; copyIndex < count; copyIndex++)
  170.     {
  171.         dest[copyIndex] = source[copyIndex];
  172.     }
  173. }

  174. //******************************************************************************
  175. // Device Initialization *******************************************************
  176. //******************************************************************************

  177. void initClockTo16MHz()
  178. {
  179.     UCSCTL3 |= SELREF_2;                      // Set DCO FLL reference = REFO
  180.     UCSCTL4 |= SELA_2;                        // Set ACLK = REFO
  181.     __bis_SR_register(SCG0);                  // Disable the FLL control loop
  182.     UCSCTL0 = 0x0000;                         // Set lowest possible DCOx, MODx
  183.     UCSCTL1 = DCORSEL_5;                      // Select DCO range 16MHz operation
  184.     UCSCTL2 = FLLD_0 + 487;                   // Set DCO Multiplier for 16MHz
  185.                                               // (N + 1) * FLLRef = Fdco
  186.                                               // (487 + 1) * 32768 = 16MHz
  187.                                               // Set FLL Div = fDCOCLK
  188.     __bic_SR_register(SCG0);                  // Enable the FLL control loop

  189.     // Worst-case settling time for the DCO when the DCO range bits have been
  190.     // changed is n x 32 x 32 x f_MCLK / f_FLL_reference. See UCS chapter in 5xx
  191.     // UG for optimization.
  192.     // 32 x 32 x 16 MHz / 32,768 Hz = 500000 = MCLK cycles for DCO to settle
  193.     __delay_cycles(500000);//
  194.     // Loop until XT1,XT2 & DCO fault flag is cleared
  195.     do
  196.     {
  197.         UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG); // Clear XT2,XT1,DCO fault flags
  198.         SFRIFG1 &= ~OFIFG;                          // Clear fault flags
  199.     }while (SFRIFG1&OFIFG);                         // Test oscillator fault flag
  200. }


  201. void initGPIO()
  202. {
  203.     //I2C Pins
  204.     P3SEL |= BIT0 + BIT1;                     // P3.0,1 option select

  205. }

  206. void initI2C()
  207. {
  208.     UCB0CTL1 |= UCSWRST;                      // Enable SW reset(复位使能)
  209.     UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC;     //  Master, I2C,synchronous mode(同步模式)
  210.     UCB0CTL1 = UCSSEL_2 + UCSWRST;            // Use SMCLK, keep SW reset
  211.     UCB0BR0 = 160;                            // fSCL = SMCLK/160 = ~100kHz
  212.     UCB0BR1 = 0;
  213.     UCB0I2CSA = SLAVE_ADDR;                   // Slave Address is 048h
  214.     UCB0CTL1 &= ~UCSWRST;                     // Clear SW reset, resume operation
  215.     UCB0IE |= UCNACKIE;                       //使能中断
  216. }

  217. void OLED_WrCmd(unsigned char IIC_Command)
  218. {
  219.         MasterType0[0]=IIC_Command;
  220.       I2C_Master_WriteReg(SLAVE_ADDR, 0x00,MasterType0, 1);
  221. }

  222. void OLED_WrDat(unsigned char IIC_Data)
  223. {
  224.         MasterType0[0]=IIC_Data;
  225.       I2C_Master_WriteReg(SLAVE_ADDR, 0x40,MasterType0, 1);
  226. }

  227. //******************************************************************************
  228. // Main ************************************************************************
  229. // Send and receive three messages containing the example commands *************
  230. //******************************************************************************

  231. void OLED_Fill(unsigned char bmp_dat)
  232. {
  233.         unsigned char y,x;
  234.         for(y=0;y<8;y++)
  235.         {
  236.                 OLED_WrCmd(0xb0+y);
  237.                 OLED_WrCmd(0x01);
  238.                 OLED_WrCmd(0x10);
  239.                 for(x=0;x<128;x++)
  240.                 OLED_WrDat(bmp_dat);
  241.         }
  242. }

  243. void OLED_Set_Pos(unsigned char x, unsigned char y)
  244. {
  245.         OLED_WrCmd(0xb0+y);
  246.         OLED_WrCmd(((x&0xf0)>>4)|0x10);
  247.         OLED_WrCmd((x&0x0f)|0x01);
  248. }

  249. void OLED_Init(void)
  250. {
  251.         unsigned char i=0;
  252.         for(;i<28;i++)
  253.         {
  254.           MasterType0[0]=MasterType1[i];
  255.           I2C_Master_WriteReg(SLAVE_ADDR, 0x00,MasterType0, 1);
  256.         }
  257.         OLED_Fill(0x00); //初始清屏
  258.         OLED_Set_Pos(0,0);
  259. }

  260. void OLED_WR_Byte(unsigned dat,unsigned cmd)
  261. {
  262.         if(cmd)
  263.                         {

  264.    OLED_WrDat(dat);
  265.    
  266.                 }
  267.         else {
  268.    OLED_WrCmd(dat);
  269.                
  270.         }
  271. }


  272. void OLED_ShowChar(unsigned char x,unsigned char y,unsigned char chr,unsigned char Char_Size)
  273. {           
  274.         unsigned char c=0,i=0;       
  275.                 c=chr-' ';//得到偏移后的值                       
  276.                 if(x>128-1){x=0;y=y+2;}
  277.                 if(Char_Size ==16)
  278.                         {
  279.                         OLED_Set_Pos(x,y);       
  280.                         for(i=0;i<8;i++)
  281.                         OLED_WR_Byte(F8X16[c*16+i],OLED_DATA);
  282.                         OLED_Set_Pos(x,y+1);
  283.                         for(i=0;i<8;i++)
  284.                         OLED_WR_Byte(F8X16[c*16+i+8],OLED_DATA);
  285.                         }
  286.                         else {       
  287.                                 OLED_Set_Pos(x,y);
  288.                                 for(i=0;i<6;i++)
  289.                                 OLED_WR_Byte(F6x8[c][i],OLED_DATA);
  290.                                
  291.                         }
  292. }

  293. void OLED_U32toU16(unsigned char x,unsigned char y ,unsigned int n,unsigned char k)
  294. {
  295.         switch(n)
  296.         {
  297.                 case 0 :OLED_ShowChar(x,y,'0',k);break;
  298.                 case 1 :OLED_ShowChar(x,y,'1',k);break;
  299.                 case 2 :OLED_ShowChar(x,y,'2',k);break;
  300.                 case 3 :OLED_ShowChar(x,y,'3',k);break;
  301.                 case 4 :OLED_ShowChar(x,y,'4',k);break;
  302.                 case 5 :OLED_ShowChar(x,y,'5',k);break;
  303.                 case 6 :OLED_ShowChar(x,y,'6',k);break;
  304.                 case 7 :OLED_ShowChar(x,y,'7',k);break;
  305.                 case 8 :OLED_ShowChar(x,y,'8',k);break;
  306.                 case 9 :OLED_ShowChar(x,y,'9',k);break;
  307.         }
  308. }

  309. void OLED_Show_Number(unsigned char x,unsigned char y ,unsigned int a,unsigned char n)
  310. {
  311.         unsigned int b,c,d,e,f,g;
  312.         b=a/100000;
  313.         c=a%100000/10000;
  314.         d=a%10000/1000;
  315.         e=a%1000/100;
  316.         f=a%100/10;
  317.         g=a%10;
  318.         if(b!=0)
  319.         {
  320.                 OLED_U32toU16(x,y,b,n);
  321.                 OLED_U32toU16(x+n/2,y,c,n);
  322.                 OLED_U32toU16(x+n,y,d,n);
  323.                 OLED_U32toU16(x+(n/2)*3,y,e,n);
  324.                 OLED_U32toU16(x+2*n,y,f,n);
  325.                 OLED_U32toU16(x+(n/2)*5,y,g,n);
  326.         }else if(b==0&&c!=0)
  327.         {
  328.                 OLED_U32toU16(x,y,c,n);
  329.                 OLED_U32toU16(x+n/2,y,d,n);
  330.                 OLED_U32toU16(x+n,y,e,n);
  331.                 OLED_U32toU16(x+(n/2)*3,y,f,n);
  332.                 OLED_U32toU16(x+2*n,y,g,n);
  333.         }else if(b==0&&c==0&&d!=0)
  334.         {
  335.                 OLED_U32toU16(x,y,d,n);
  336.                 OLED_U32toU16(x+n/2,y,e,n);
  337.                 OLED_U32toU16(x+n,y,f,n);
  338.                 OLED_U32toU16(x+(n/2)*3,y,g,n);
  339.         }else if(b==0&&c==0&&d==0&&e!=0)
  340.         {
  341.                 OLED_U32toU16(x,y,e,n);
  342.                 OLED_U32toU16(x+n/2,y,f,n);
  343.                 OLED_U32toU16(x+n,y,g,n);
  344.         }else if(b==0&&c==0&&d==0&&e==0&&f!=0)
  345.         {
  346.                 OLED_U32toU16(x,y,f,n);
  347.                 OLED_U32toU16(x+n/2,y,g,n);
  348.         }else
  349.         {
  350.                 OLED_U32toU16(x,y,g,n);
  351.         }
  352. }

  353. int main(void) {

  354.     WDTCTL = WDTPW | WDTHOLD;                 // Stop watchdog timer

  355.     initClockTo16MHz();                        //配置系统时钟为16Mhz
  356.     initGPIO();
  357.     initI2C();
  358.     delay(500);
  359.     OLED_Init();
  360.     OLED_Show_Number(0,0,500,16);
  361.     __bis_SR_register(LPM0_bits + GIE);
  362. }

  363. //******************************************************************************
  364. // I2C Interrupt ***************************************************************
  365. //******************************************************************************

  366. #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
  367. #pragma vector=USCI_B0_VECTOR
  368. __interrupt void USCI_B0_ISR(void)
  369. #elif defined(__GNUC__)
  370. void __attribute__ ((interrupt(USCI_B0_VECTOR))) USCI_B0_ISR (void)
  371. #else
  372. #error Compiler not supported!
  373. #endif
  374. {
  375.   //Must read from UCB0RXBUF
  376.   uint8_t rx_val = 0;

  377.   switch(__even_in_range(UCB0IV,0xC))
  378.   {
  379.     case USCI_NONE:break;                             // Vector 0 - no interrupt
  380.     case USCI_I2C_UCALIFG:break;                      // Interrupt Vector: I2C Mode: UCALIFG
  381.     case USCI_I2C_UCNACKIFG:break;                    // Interrupt Vector: I2C Mode: UCNACKIFG
  382.     case USCI_I2C_UCSTTIFG:break;                     // Interrupt Vector: I2C Mode: UCSTTIFG
  383.     case USCI_I2C_UCSTPIFG:break;                     // Interrupt Vector: I2C Mode: UCSTPIFG
  384.     case USCI_I2C_UCRXIFG:
  385.         rx_val = UCB0RXBUF;
  386.         if (RXByteCtr)
  387.         {
  388.           ReceiveBuffer[ReceiveIndex++] = rx_val;
  389.           RXByteCtr--;
  390.         }

  391.         if (RXByteCtr == 1)
  392.         {
  393.           UCB0CTL1 |= UCTXSTP;
  394.         }
  395.         else if (RXByteCtr == 0)
  396.         {
  397.           UCB0IE &= ~UCRXIE;
  398.           MasterMode = IDLE_MODE;
  399.           __bic_SR_register_on_exit(CPUOFF);      // Exit LPM0
  400.         }
  401.         break;                      // Interrupt Vector: I2C Mode: UCRXIFG
  402.     case USCI_I2C_UCTXIFG:
  403.         switch (MasterMode)
  404.         {
  405.           case TX_REG_ADDRESS_MODE:
  406.               UCB0TXBUF = TransmitRegAddr;
  407.               if (RXByteCtr)
  408.                   MasterMode = SWITCH_TO_RX_MODE;   // Need to start receiving now
  409.               else
  410.                   MasterMode = TX_DATA_MODE;        // Continue to transmission with the data in Transmit Buffer
  411.               break;

  412.           case SWITCH_TO_RX_MODE:
  413.               UCB0IE |= UCRXIE;              // Enable RX interrupt
  414.               UCB0IE &= ~UCTXIE;             // Disable TX interrupt
  415.               UCB0CTL1 &= ~UCTR;            // Switch to receiver
  416.               MasterMode = RX_DATA_MODE;    // State state is to receive data
  417.               UCB0CTL1 |= UCTXSTT;          // Send repeated start
  418.               if (RXByteCtr == 1)
  419.               {
  420.                   //Must send stop since this is the N-1 byte
  421.                   while((UCB0CTL1 & UCTXSTT));
  422.                   UCB0CTL1 |= UCTXSTP;      // Send stop condition
  423.               }
  424.               break;

  425.           case TX_DATA_MODE:
  426.               if (TXByteCtr)
  427.               {
  428.                   UCB0TXBUF = TransmitBuffer[TransmitIndex++];
  429.                   TXByteCtr--;
  430.               }
  431.               else
  432.               {
  433.                   //Done with transmission
  434.                   UCB0CTL1 |= UCTXSTP;     // Send stop condition
  435.                   MasterMode = IDLE_MODE;
  436.                   UCB0IE &= ~UCTXIE;                       // disable TX interrupt
  437.                   __bic_SR_register_on_exit(CPUOFF);      // Exit LPM0
  438.               }
  439.               break;

  440.           default:
  441.               __no_operation();
  442.               break;
  443.         }
  444.         break;                      // Interrupt Vector: I2C Mode: UCTXIFG
  445.     default: break;
  446.   }
  447. }
复制代码


IIC&amp;OLED.rar

399.04 KB, 下载次数: 392, 下载积分: 黑币 -5

评分

参与人数 3黑币 +61 收起 理由
bec长街 + 10
1106998808 + 1 淡定
admin + 50 共享资料的黑币奖励!

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏9 分享淘帖 顶4 踩1
回复

使用道具 举报

沙发
ID:240626 发表于 2018-7-20 23:45 | 只看该作者
用keil5打开乱码咋回事
回复

使用道具 举报

板凳
ID:222477 发表于 2018-7-24 01:37 来自手机 | 只看该作者
1106998808 发表于 2018-7-20 23:45
用keil5打开乱码咋回事

是用IAR编写的
回复

使用道具 举报

地板
ID:383455 发表于 2018-8-9 09:26 | 只看该作者
是个好贴 我准备下载下来试试
回复

使用道具 举报

5#
ID:417544 发表于 2018-10-29 22:50 | 只看该作者
好贴,可惜积分不够,很想下载来试一下。
回复

使用道具 举报

6#
ID:417544 发表于 2018-10-31 10:54 | 只看该作者
刚好有个其他LCD要硬件IIC接口,在楼主的基础上改了一下测试OK,谢谢楼主分享!
回复

使用道具 举报

7#
ID:417544 发表于 2018-11-7 15:58 | 只看该作者
发现有个问题,在运行1-2小时后会宕机,屏幕显示刷新一部分后面刷新不动,重启运行又是正常的,I2C频率改慢也是一样的,上拉电阻使用4.7K.
回复

使用道具 举报

8#
ID:542238 发表于 2019-6-16 12:40 | 只看该作者
switch(__even_in_range(UCB0IV,0xC))因为我用的芯片头文件里没有找到UCB0IV,可以用其他的
回复

使用道具 举报

9#
ID:542238 发表于 2019-6-16 12:44 | 只看该作者
switch(__even_in_range(UCB0IV,0xC)),因为用的不是F5529,在头文件中没有找到UCB0IV,可以用其他的代替吗?
回复

使用道具 举报

10#
ID:574354 发表于 2019-7-2 23:33 | 只看该作者
这个我最近在用不错
回复

使用道具 举报

11#
ID:294235 发表于 2019-7-27 19:40 | 只看该作者
这是官方例程吗
回复

使用道具 举报

12#
ID:623987 发表于 2019-10-14 17:44 | 只看该作者
谢谢,太有用了!!!
回复

使用道具 举报

13#
ID:645686 发表于 2020-3-23 08:32 | 只看该作者
能显示汉自吗?
回复

使用道具 举报

14#
ID:347452 发表于 2020-9-24 11:33 | 只看该作者
请问下OLED这个怎么作为子函数使用啊
回复

使用道具 举报

15#
ID:443608 发表于 2021-6-25 16:20 | 只看该作者
您好 为什么我的IIC配置进不去中断呢?
回复

使用道具 举报

16#
ID:955970 发表于 2021-7-23 17:52 | 只看该作者
1106998808 发表于 2018-7-20 23:45
用keil5打开乱码咋回事

msp430好像只能用ccs或者iar for msp430
回复

使用道具 举报

17#
ID:956252 发表于 2021-7-25 09:58 | 只看该作者
怎么接线
回复

使用道具 举报

18#
ID:955821 发表于 2021-7-27 15:59 | 只看该作者
driverlib.h显示找不到是怎么回事
回复

使用道具 举报

19#
ID:810658 发表于 2021-7-30 21:07 | 只看该作者
想问一下移植了您的程序为什么程序会卡在这里不动啊  if (RXByteCtr == 1)         {           UCB0CTL1 |= UCTXSTP;《----这一行         }         else if (RXByteCtr == 0) 我只不过用的是ccs啊
回复

使用道具 举报

20#
ID:958485 发表于 2021-8-3 20:20 | 只看该作者
问一下,sda和scl的io接口3.0和3.1换成别打接口(比如3.5和3.6),程序怎么改,我直接改mainc里面那个gpio没用
回复

使用道具 举报

21#
ID:1009475 发表于 2022-3-10 15:05 | 只看该作者
好代码,下载用用了
回复

使用道具 举报

22#
ID:1037933 发表于 2022-7-1 17:39 | 只看该作者

可以用gcc打开
回复

使用道具 举报

23#
ID:1089866 发表于 2023-7-28 00:35 | 只看该作者
1106998808 发表于 2018-7-20 23:45
用keil5打开乱码咋回事

软件编码改一下就可以了
回复

使用道具 举报

24#
ID:1090317 发表于 2023-8-1 22:11 | 只看该作者
tiger_work 发表于 2018-10-29 22:50
好贴,可惜积分不够,很想下载来试一下。

很容易得的
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

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