小弟最近在做从51上驱动RC500读卡器移植到STM32上的实验。 知道STM32是3.3V芯片,RC500是5V芯片. 硬件电路我是这样做的: 使用RC500的独立读/写选通的复用地址总线的连接方式,使用STM32的5V兼容引脚加5V上拉电阻和RC500相连 采用模拟总线的方式,底层相关驱动代码如下: <div class="blockcode" style="word-wrap: break-word; margin: 10px 0px; padding: 10px 0px 5px 10px; overflow: hidden; background-color: rgb(247, 247, 247); color: rgb(102, 102, 102); zoom: 1; border: 1px solid rgb(204, 204, 204); font-family: sans-serif; font-size: 14px; line-height: 21px; background-position: 0px 0px; background-repeat: no-repeat repeat; "><div id="code_axT" style="word-wrap: break-word; margin: 0px; padding: 0px; "><ol style="word-wrap: break-word; margin: 0px 0px 0px 10px !important; padding: 0px !important; list-style: none; "> <li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, '"Lucida Console"', '"Courier New"', serif; font-size: 12px; line-height: 1.8em; ">/** <li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, '"Lucida Console"', '"Courier New"', serif; font-size: 12px; line-height: 1.8em; "> * @name static void GPIO_Write1(u8 value) <li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, '"Lucida Console"', '"Courier New"', serif; font-size: 12px; line-height: 1.8em; "> * @brief GPIOBÒý½Å¸ß8λÊä³öÊý¾Ý <li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, '"Lucida Console"', '"Courier New"', serif; font-size: 12px; line-height: 1.8em; "> * @param value ÒªÊä³öµÄÊý¾Ý <li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, '"Lucida Console"', '"Courier New"', serif; font-size: 12px; line-height: 1.8em; "> * @retval None <li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, '"Lucida Console"', '"Courier New"', serif; font-size: 12px; line-height: 1.8em; "> */ <li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, '"Lucida Console"', '"Courier New"', serif; font-size: 12px; line-height: 1.8em; ">void GPIOB_Write1(u8 value) <li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, '"Lucida Console"', '"Courier New"', serif; font-size: 12px; line-height: 1.8em; ">{ <li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, '"Lucida Console"', '"Courier New"', serif; font-size: 12px; line-height: 1.8em; "> RC500_Adress_Data_GPIO_Config(GPIO_Mode_Out_OD);//ÅäÖÃΪ¿ªÂ©Êä³ö <li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, '"Lucida Console"', '"Courier New"', serif; font-size: 12px; line-height: 1.8em; "> <li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, '"Lucida Console"', '"Courier New"', serif; font-size: 12px; line-height: 1.8em; "> GPIO_SetBits(GPIOB, (value |
RE:关于STM32驱动RC500的问题
对了,STM32的GPIOB 8-15连接RC500的AD0-AD15
PA11 NCS
PA12 NWR
PA13 NRD
PA14 ALE
PA15 RST
PA8 RC500IRQ