»ùÓÚATmega128ºÍCH374µÄUSB½Ó¿ÚÉè¼Æ[ͼ]

Ïà¹ØרÌ⣺ оƬ

Ëæ×ÅǶÈëʽϵͳµÄ·¢Õ¹£¬Ç¶ÈëʽMCUÐèÒªÔö¼ÓUSB½Ó¿Ú£¬ÒÔ±ãʵÏÖÓëPC»úµÈUSBÖ÷»úϵͳµÄͨÐÅ¡£Õë¶ÔÕâÑùµÄÐèÇ󣬽â¾ö·½°¸±È½Ï¶à£¬¾ùÓÐÒ»¸ö¹²Í¬µã£¬¶¼²ÉÓÃPHILIPS¹«Ë¾µÄPDIUSBD12оƬ£¬¸ÃоƬΪ²¢ÐÐ×ÜÏß½Ó¿Ú£¬Õ¼Óùý¶àµÄMCU¶Ë¿Ú×ÊÔ´£¬ÇÒÓëMCUµÄÈí¼þ½Ó¿Ú±àд¸´ÔÓ£¬Í¬Ê±Ð¾Æ¬¼Û¸ñÒ²²»±ãÒË¡£Îª´Ë£¬²ÉÓÃÄϾ©Çߺãµç×ÓÓÐÏÞ¹«Ë¾µÄUSBоƬCH374Éè¼ÆÁËÒ»¿îUSB½Ó¿Ú£¬ÒÔ½â¾öǶÈëʽMCUÓëPC»úͨÐÅÎÊÌâ¡£CH374²»½ö¼Û¸ñÓÐÓÅÊÆ£¬¸Ã¹«Ë¾»¹ÌṩÁËÍêÉƵÄUSBÇý¶¯³ÌÐò£¬ÇÒÔÚоƬÄÚ²¿¼¯³ÉÁËÊý¾Ý»º³åÇø¡¢±»¶¯²¢Ðнӿڡ¢´®Ðнӿڡ¢ÃüÁî½âÊÍÆ÷¡¢Í¨ÓõĹ̼þ³ÌÐòµÈ£¬ÕâÑù£¬ÒÔCH374Éè¼ÆµÄUSBÉ豸£¬²»ÐèÒªÏêϸÁ˽âUSBͨѶЭÒ飬¿ª·¢±à³Ì·Ç³£·½±ã¡£

1 ϵͳӲ¼þÉè¼Æ

1.1 ϵͳԭÀí

¸ÃϵͳÒÔATmega128µ¥Æ¬»úºÍCH374½Ó¿ÚоƬΪºËÐÄ¡£ATmega128µ¥Æ¬»úÊÇ»ùÓÚAVR RISC½á¹¹8λµÍ¹¦ºÄCMOS΢´¦ÀíÆ÷£¬ÄÚ²¿´øÓÐ128 KbµÄϵͳÄڿɱà³ÌFLASH³ÌÐò´æ´¢Æ÷£»4 KbµÄEEPROM;4 KbµÄSRAM;´®ÐÐÍâΧÉ豸½Ó¿Ú£¨SPI£©£»ÓÐ53¸ö¿É±à³ÌµÄͨÓÃI/O½Å£¬32¸öͨÓù¤×÷¼Ä´æÆ÷£»ÓÐ4¸öÁé»îµÄ¾ßÓбȽÏģʽºÍPWM¹¦ÄܵĶ¨Ê±Æ÷/¼ÆÊýÆ÷£¨T/C£©£»×Ô´ø8ͨµÀ10λADC,¿ÉÑ¡µÄ¿É±à³ÌÔöÒ棻ƬÄÚÕñµ´Æ÷µÄ¿É±à³Ì¿´ÃŹ·¶¨Ê±Æ÷£ºÓëIEEE1149.1¹æ·¶¼æÈݵÄJTAG²âÊÔ½Ó¿Ú£¬¿ÉÒÔÓÃÓÚƬÉϵ÷ÊÔ£»6ÖÖ¿ÉÒÔͨ¹ýÈí¼þÑ¡ÔñµÄÊ¡µçģʽ£¬²ÉÓÃ64Òý½ÅTQFPÓëMLF·â×°£»·åÖµÔËËãËٶȴï16 MIPS,·Ç³£ÊʺÏÓ¦ÓÃÔÚǶÈëʽϵͳÖС£

USBÆ÷¼þ²ÉÓÃCH374.¸ÃоƬ֧³ÖUSB-HOSTÖ÷»ú·½Ê½ºÍUSB-DEVICE/SLAVEÉ豸·½Ê½£¬ÄÚÖÃ3¶Ë¿ÚHUB¸ù¼¯ÏßÆ÷£¬Ö§³ÖµÍËÙºÍÈ«ËٵĿØÖÆ´«Êä¡¢ÅúÁ¿´«Êä¡¢Öжϴ«ÊäÒÔ¼°Í¬²½/µÈʱ´«Êä¡£CH374¾ßÓÐ8λÊý¾Ý×ÜÏߺͶÁ¡¢Ð´¡¢Æ¬Ñ¡¿ØÖÆÏßÒÔ¼°ÖжÏÊä³ö£¬¿ÉÒÔ·½±ãµØ¹Ò½Óµ½µ¥Æ¬»ú/DSP /MCU/MPUµÈ¿ØÖÆÆ÷µÄϵͳ×ÜÏßÉÏ¡£ÔÚ¼ÆËã»úϵͳÖУ¬CH374µÄÅäÌ×Èí¼þÌṩÁ˼ò½àÒ×ÓõIJÙ×÷½Ó¿Ú£¬Óë±¾µØ¶ËµÄµ¥Æ¬»úͨОÍÈçͬ¶ÁдÎļþ£¬½µµÍÁË¿ª·¢ÄѶȣ¬³ý´ËÖ®Í⣬CH374»¹ÌṩÁ˽ÚÔ¼I/OÒý½ÅµÄSPI´®ÐÐͨѶ·½Ê½£¬Í¨¹ýSPI´®ÐнӿÚÒÔ¼°ÖжÏÊä³öÓ뵥Ƭ»ú/DSP/MCU/ MPUµÈÏàÁ¬½Ó¡£ÏµÍ³Ô­ÀíͼÈçͼ1Ëùʾ¡£

ͼ1 ϵͳԭÀíͼ

1.2 Ó²¼þµç·

CH374ͨ¹ýSPI´®ÐнӿÚÒÔ¼°ÖжÏÊä³öÓ뵥Ƭ»úÁ¬½Ó£¬ÒÔ±ã½ÚÔ¼µ¥Æ¬»úµÄI/OÒý½Å¡£CH374оƬµÄRD#Òý½ÅºÍWD#ΪµÍµçƽ£¨½ÓµØ£©ÇÒCS#Òý½ÅΪ¸ßµçƽ£¨½ÓÕýµçÔ´£©£¬ÔòCH374½«¹¤×÷ÓÚSPI´®¿Ú·½Ê½¡£ÔÚSPI´®¿Ú·½Ê½Ï£¬CH374Ö»ÐèÒªÓëATmega128µ¥Æ¬»úÁ¬½Ó5¸öÐźÅÏߣºSCS#Òý½Å¡¢SCKÒý½Å¡¢SDIÒý½Å¡¢SDOÒý½ÅÒÔ¼°INT#Òý½Å£¬ÆäËüÒý½Å¶¼¿ÉÒÔÐü¿Õ¡£µç·ʾÒâͼÈçͼ2Ëùʾ¡£

ͼ2 Ó²¼þµç·ʾÒâͼ

ATmega128µ¥Æ¬»úÅäÖÃΪSPIÖ÷»úʱ£¬SPI½Ó¿Ú²»×Ô¶¯¿ØÖÆPBO£¨SS#£©Òý½Å£¬±ØÐëÓÉÓû§Èí¼þÔÚͨÐÅ¿ªÊ¼Ç°½øÐд¦Àí¡£¶ÔSPIÊý¾Ý¼Ä´æÆ÷дÈëÊý¾Ý¼´Æô¶¯SPIʱÖÓ£¬½«8±ÈÌصÄÊý¾ÝÒÆÈëCH374оƬ¡£CH374µÄSPI½Ó¿ÚÖ§³ÖSPIģʽ0ºÍSPIģʽ3,CH374×ÜÊÇ´ÓSPIʱÖÓSCKµÄÉÏÉýÑØÊäÈëÊý¾Ý£¬²¢ÔÚÔÊÐíÊä³öʱ´ÓSCKµÄϽµÑØÊä³öÊý¾Ý£¬Êý¾Ýλ˳ÐòÊǸßλÔÚÇ°£¬¼ÆÂú8λΪһ¸ö×Ö½Ú¡£SPIµÄ²Ù×÷²½ÖèÈçÏ£º

1£©ATmega128²úÉúCH374оƬµÄSPIƬѡ£¬µÍµçƽÓÐЧ£»

2£©ATmega128°´SPIÊä³ö·½Ê½·¢³öÒ»¸ö×ֽڵĵØÖ·Â룬ÓÃÓÚÖ¸¶¨Æäºó¶Áд²Ù×÷µÄÆðʼµØÖ·£»

3£©ATmega128·¢³öÒ»¸ö×Ö½ÚµÄÃüÁîÂëÖ¸Ã÷²Ù×÷·½Ïò£¬¶Á²Ù×÷ÃüÁîÂëÊÇCOH,д²Ù×÷ÃüÁîÂëÊÇ80H;

4£©Èç¹ûÊÇд²Ù×÷£¬ATmega128·¢³öÒ»¸ö×ֽڵĴýдÊý¾Ý£¬CH374ÊÕµ½²¢±£´æµ½Ö¸¶¨µØÖ·ºóµØÖ·×Ô¶¯¼Ó1,ATmega128¼ÌÐø·¢³öÈô¸É¸ö×ֽڵĴýдÊý¾Ý£¬CH374ÒÀ´Î´¦Àí£¬Ö±µ½ATmega128½ûÖ¹SPIƬѡ£»

5£©Èç¹ûÊǶÁ²Ù×÷£¬CH374´ÓÖ¸¶¨µØÖ·¶Á³öÒ»¸ö×Ö½ÚÊý¾Ý²¢Êä³öºóµØÖ·×Ô¶¯¼Ó1,ATmega128ÊÕµ½Êý¾Ý²¢±£´æ£¬CH374¼ÌÐø´ÓÏÂÒ»¸öµØÖ·¶Á³öÊý¾Ý²¢Êä³ö£¬Ö±µ½ATmega128½ûÖ¹SPIƬѡ£»

6£©ATmega128½ûÖ¹CH374оƬµÄSPIƬѡ£¬ÒÔ½áÊøµ±Ç°SPI²Ù×÷¡£

2 ϵͳÈí¼þÉè¼Æ

Èí¼þ¿ª·¢²ÉÓÃATMEL¹«Ë¾µÄAVR STUDIO 3.53¼¯³É¿ª·¢»·¾³£¬°üÀ¨£ºAVR ASSEMBLER±àÒëÆ÷¡¢AVR STUDIOµ÷ÊÔ¹¦ÄÜ¡¢AVR PROG´®ÐС¢²¢ÐÐÏÂÔع¦ÄÜ¡¢JTAG ICE·ÂÕ湦ÄÜ£¬±¾Éè¼Æ²ÉÓõÄÊÇJTAG ICE·ÂÕæµ÷ÊÔ¡£Èí¼þÉè¼ÆÖ÷Òª°üÀ¨¹Ì¼þ³ÌÐòÉè¼Æ¡¢Ó¦ÓóÌÐòÉè¼ÆºÍÇý¶¯³ÌÐòÉè¼Æ3¸ö²¿·Ö¡£

2.1 ¹Ì¼þ³ÌÐòÉè¼Æ

CH374ÄÚÖÃÁËUSBͨÐÅÖеĵײãЭÒ飬Òò´Ëµ¥Æ¬»ú³ÌÐò·Ç³£¼ò½à¡£ÔÚÍâÖù̼þģʽÏ£¬ÔÚÍê³ÉCH374µÄ³õʼ»¯¹¤×÷ºó£¬ÓÉÍⲿµ¥Æ¬»ú¸ù¾ÝÐèÒª×ÔÐд¦Àí¸÷ÖÖUSBÇëÇ󣬴ӶøÍê³ÉUSB×ÜÏßÁ¬½Ó¹ý³Ì¡£³õʼ»¯CH374Ö÷ÒªÍê³ÉUSBÉ豸µÄö¾Ù£¬CH374³õʼ»¯³ÌÐòµÄ³ÌÐòÈçÏ£º

void CH374_PORT_INIT£¨£© /*½øÐгõʼ»¯*/

{ unsigned char i;

PORTB |=0x03;/*½ûÖ¹SPIƬѡ£¬ÉèÖÃSCS#ĬÈÏΪ¸ßµçƽ*/

DDRB |=0x07;/*ÉèÖÃSCS#,SCK,SDIΪÊä³ö*/

DDRB&=0x08;/*SDOÊäÈë*/

SPCR=0x5C;/*ÉèÖÃSPIģʽ3*/

CH374_DAT_PORT=1;/*ÉèÖÃΪʹÓÃÍâÖù̼þµÄUSBÉ豸·½Ê½*//*ÏÂÊöÆôÓÃÖжϣ¬CH374Á¬½ÓÔÚINT0*/

IT0=0;/*ÖÃÍⲿÐźÅΪµÍµçƽ´¥·¢*/

IE0=0;/*ÇåÖжϱêÖ¾*/

EX0=1;/*ÔÊÐíCH374ÖжÏ*/

}

2.2 Ó¦ÓóÌÐòÉè¼Æ

CH374ÔÚ¼ÆËã»ú¶ËÌṩÁËÓ¦Óòã½Ó¿Ú£¬Ó¦ÓóÌÐòµÄÉè¼Æ¿É¸ù¾ÝÓû§µÄÐèÇó½øÐÐÊʵ±µ÷Õû¡£Ó¦Óòã½Ó¿ÚÊÇÓÉCH374¶¯Ì¬Á´½Ó¿âDLLÌṩµÄÃæÏò¹¦ÄÜÓ¦ÓõÄAPI,°üÀ¨É豸¹ÜÀíAPI¡¢Êý¾Ý´«ÊäAPIºÍÖжϴ¦ÀíAPI¡£

É豸¹ÜÀíAPIÖ÷Òª°üÀ¨£º1£©´ò¿ª¡¢¹Ø±ÕÉ豸£»2£©»ñÈ¡USBÉ豸£¬ÅäÖÃÃèÊö·û£»3£©¸´Î»USBÉ豸¡£

Êý¾Ý´«ÊäAPIÖ÷Òª°üÀ¨£º1£©¶ÁÈ¡Êý¾Ý¿é£»2£©Ð´³öÊý¾Ý¿é¡£

Öжϴ¦ÀíAPIÖ÷Òª°üÀ¨£º1£©¶ÁÈ¡ÖжÏÊý¾Ý£»2£©É趨ÖжϷþÎñ³ÌÐò¡£

ʹÓÃÕâЩAPIº¯Êý£¬¿ÉÒÔºÜÈÝÒ׵ؿª·¢³öÓëÓ²¼þµç·ÏàÅäÌ×µÄÓ¦ÓÃÈí¼þ£¬CH374Óë¼ÆËã»úÁ¬½ÓµÄÉÏλ»ú×ÜÌå³ÌÐòÁ÷³ÌͼÈçͼ3Ëùʾ¡£

ͼ3 ÉÏλ»ú×ÜÌå³ÌÐòÁ÷³Ìͼ

2.3 USBÇý¶¯³ÌÐòÉè¼Æ

USBÇý¶¯³ÌÐò¿ÉÒÔ²ÉÓÃWDM£¨Windows Driver Mode£©Ä£Ê½Éè¼Æ¡£WDMÇý¶¯³ÌÐò²ÉÓÃÁé»îµÄ·Ö²ãÇý¶¯·½·¨£¬ÔÚÓû§ºÍÎïÀíÉ豸֮¼ä´æÔÚ׿¸¸ö²»Í¬µÄÇý¶¯³ÌÐò²ã´Î£¬ÇÒ¸÷²ãÉϵÄWDMÇý¶¯³ÌÐò¾ßÓв»Í¬ÓÅÏȼ¶¡£ÀûÓÃWDMÉè¼ÆµÄÇý¶¯³ÌÐò¿É¸ù¾ÝÓû§µÄÐèÒªµ÷Õû£¬Áé»îÐԺ㬵«ÐèÒªÁ˽â²Ù×÷ϵͳԭÀí¼°Ïà¹ØÓ²¼þ¹¤×÷ϸ½Ú£¬¶øÇÒ¹¤×÷Á¿½Ï´ó¡£ËùÒÔ£¬USBÇý¶¯³ÌÐòÉè¼Æ²ÉÓÃCH374оƬ³§¼ÒÌṩµÄͨÓÃÇý¶¯³ÌÐò£¬Ö±½ÓÏÂÔغó°²×°¼´¿É£¬´ó´ó½µµÍÁË¿ª·¢µÄÄѶȡ£

3 Ó¦Óýá¹û

ÎÄÖÐËùÉè¼ÆµÄUSB½Ó¿ÚÔÚ1kWµúʽ˹ÌØÁÖÌ«ÑôÄÜÈÈ·¢µç×°ÖÃÖеõ½ÁËÓ¦Óã¬ÊµÏÖ¶ÔÌ«Ñô¸ß¶È½ÇºÍ·½Î»½ÇµÄ¸ú×Ù£¬ÏµÍ³½á¹¹Èçͼ4Ëùʾ¡£¸Ã·¢µç×°ÖöÔÌ«ÑôµÄ¸ú×Ù²ÉÓÃÊÓÈÕÔ˶¯¹ì¼£·¨£¬ËùÐèÒªµÄÌ«Ñô³àγ¶È½Çδ¡¢Î³¶È½ÇδºÍʱ½ÇδÓɼÆËã»úͨ¹ýUSB½Ó¿ÚоƬCH374дÈëATmega128µ¥Æ¬»ú£¬È»ºóµ¥Æ¬»úͨ¹ýÒ»Ì×¼ÆË㹫ʽ¼ÆËã³öÌ«ÑôµÄλÖ㬼´Êµ¼Êʱ¿ÌÌ«ÑôËùÔڸ߶ȽǺͷ½Î»½Ç£¬Êä³öÒ»¶¨µÄÂö³åÊý£¬Çý¶¯ËÅ·þµç»úת¶¯£¬Ê¹·¢µç×°ÖÃתµ½ÒªÇóµÄλÖã¬ÊµÏÖ¶ÔÌ«ÑôµÄ¸ú×Ù¡£Í¬Ê±£¬Í¨¹ýCH374°ÑÕû¸ö·¢µç×°ÖõÄ״̬Êý¾Ý·¢¸ø¼ÆËã»ú£¬ÔÚ¼ÆËã»úÏÔʾ£¬ÒÔ±ãʵÏÖÈË»ú¶Ô»°£¬Îª½ñºóÔÚ25 kWµúʽ˹ÌØÁÖÌ«ÑôÄÜÈÈ·¢µçϵͳµÄÑÐÖÆ´òÏ»ù´¡¡£Êµ¼ùÖ¤Ã÷£¬¸ÃUSB½Ó¿Ú¹¤×÷Îȶ¨¡¢¿É¿¿£¬³É±¾½ÏµÍ£¬ÍêÈ«Äܹ»Âú×ãµúʽ˹ÌØÁÖÌ«ÑôÄÜÈÈ·¢µç×°ÖõĿØÖÆÖ¸±êÒªÇó£¬È¡µÃÁËÁ¼ºÃµÄÓ¦ÓÃЧ¹û¡£

ͼ4 1kWµúʽ˹ÌØÁÖÌ«Ñô¸ú×Ùϵͳ½á¹¹Í¼

4 ½áÊøÓï

ÒÔATmega128ºÍCH374ΪºËÐÄ£¬Í¨¹ýSPI´®¿ÚͨѶ·½Ê½Éè¼ÆÁËÒ»¿îUSB½Ó¿Ú£¬ÏµÍ³Ó²¼þ¼òµ¥£¬²»ÐèÒª±àд¸´ÔÓµÄUSBÇý¶¯³ÌÐò£¬ÀûÓÃÆ䶯̬Á´½Ó¿â¼´¿ÉʵÏÖUSBÓëPCµÄͨÐÅ£¬Ñз¢¼òµ¥£¬Ò×ÓÚʵÏÖ¡£¸ÃÉè¼ÆÔÚʵ¼ÊÏîÄ¿ÖÐͶÈëÁËʹÓã¬Ð§¹ûÁ¼ºÃ£¬¾ßÓÐÒ»¶¨µÄÉè¼Æ²Î¿¼¼ÛÖµ¡£

×÷Õߣº·¶Î°³É ×ÚÇé Öì³½Ôª ÅíС·½ À´Ô´£º¡¶µç×ÓÉè¼Æ¹¤³Ì¡·

ÎÒÍƼö´ó¼Ò¶Á

ÇáËɲÎÓë

VS

±í´ïÁ¢³¡

ÕâÊÇÀ¬»øÎÄÕÂ


΢ÐÅɨÃè·ÖÏí±¾Îĵ½ÅóÓÑȦ
ɨÂë¹Ø×¢5GͨÐŹٷ½¹«ÖÚºÅ,Ãâ·ÑÁìÈ¡ÒÔÏÂ5G¾«Æ·×ÊÁÏ
  • 1¡¢»Ø¸´¡°YD5GAI¡±Ãâ·ÑÁìÈ¡¡¶ÖйúÒƶ¯£º5GÍøÂçAIÓ¦ÓõäÐͳ¡¾°¼¼Êõ½â¾ö·½°¸°×ƤÊé¡·
  • 2¡¢»Ø¸´¡°5G6G¡±Ãâ·ÑÁìÈ¡¡¶5G_6GºÁÃײ¨²âÊÔ¼¼Êõ°×ƤÊé-2022_03-21¡·
  • 3¡¢»Ø¸´¡°YD6G¡±Ãâ·ÑÁìÈ¡¡¶ÖйúÒƶ¯£º6GÖÁ¼òÎÞÏß½ÓÈëÍø°×ƤÊé¡·
  • 4¡¢»Ø¸´¡°LTBPS¡±Ãâ·ÑÁìÈ¡¡¶¡¶ÖйúÁªÍ¨5GÖն˰×ƤÊé¡·¡·
  • 5¡¢»Ø¸´¡°ZGDX¡±Ãâ·ÑÁìÈ¡¡¶ÖйúµçÐÅ5GNTN¼¼Êõ°×ƤÊé¡·
  • 6¡¢»Ø¸´¡°TXSB¡±Ãâ·ÑÁìÈ¡¡¶Í¨ÐÅÉ豸°²×°¹¤³ÌÊ©¹¤¹¤ÒÕͼ½â¡·
  • 7¡¢»Ø¸´¡°YDSL¡±Ãâ·ÑÁìÈ¡¡¶ÖйúÒƶ¯ËãÁ¦²¢Íø°×ƤÊé¡·
  • 8¡¢»Ø¸´¡°5GX3¡±Ãâ·ÑÁìÈ¡¡¶R1623501-g605GµÄϵͳ¼Ü¹¹1¡·
  • ±¾ÖÜÈȵ㱾ÔÂÈȵã

     

      ×îÈÈͨÐÅÕÐƸ

    Òµ½ç×îÐÂ×ÊѶ


      ×îÐÂÕÐƸÐÅÏ¢

    ×îм¼ÊõÎÄÕÂ

    ×îÐÂÂÛ̳Ìù×Ó