CH555 USB使用碰到點(diǎn)疑問
void?USB_DeviceInit(void)
{
????IE_USB?=?0;?//?禁止USB總中斷
????USB_CTRL?=?0;

????/*USBD0控制器配置,緩沖區(qū)為固定地址(無需配置)*/
????D0_EP0RES?=?UEP_R_RES_ACK?|?UEP_T_RES_NAK;
????D0_EP1RES?=?bUEP_X_AUTO_TOG?|?UEP_X_RES_ACK;
????D0_EP2RES?=?bUEP_X_AUTO_TOG?|?UEP_X_RES_NAK;
????D0_EP3RES?=?bUEP_X_AUTO_TOG?|?UEP_X_RES_NAK;
????D0_EP_MOD?=?bUX_DEV_EN?|?bUX_EP1O_EN;?//?啟用USBD0子設(shè)備,設(shè)置端點(diǎn)1為OUT,設(shè)置端點(diǎn)2-3為IN,禁用端點(diǎn)4-6
????D0_ADDR?=?0x00;?//?復(fù)位USBD0設(shè)備地址

????/*USBD1控制器配置,緩沖區(qū)為固定地址(無需配置)*/
????D1_EP0RES?=?UEP_R_RES_ACK?|?UEP_T_RES_NAK;
????D1_EP1RES?=?bUEP_X_AUTO_TOG?|?UEP_X_RES_NAK;
????D1_EP2RES?=?bUEP_X_AUTO_TOG?|?UEP_X_RES_NAK;
????D1_EP3RES?=?bUEP_X_AUTO_TOG?|?UEP_X_RES_NAK;
????D1_EP_MOD?=?bUX_DEV_EN;?//?啟用USBD1子設(shè)備,設(shè)置端點(diǎn)1-3為IN,禁用端點(diǎn)4-6
????D1_ADDR?=?0x00;?//?復(fù)位USBD1設(shè)備地址

????HB_ADDR?=?0x7F;?//?將收到的數(shù)據(jù)直接轉(zhuǎn)發(fā)到D0

????USB_IF?=?0xFF;?//?清空USB中斷標(biāo)志寄存器
????USB_IE?=?bUX_IE_SUSPEND?|?bUX_IE_TRANSFER?|?bUX_IE_BUS_RST;?//?使能<總線掛起&喚醒&復(fù)位,數(shù)據(jù)傳輸完成>中斷
????USB_CTRL?=?bUX_DP_PU_EN;?//?使能USB復(fù)合設(shè)備,啟用DP內(nèi)部上拉1.5K電阻
????IE_USB?=?1;?//?使能USB總中斷
}


問題一:

????代碼段中,單獨(dú)注釋掉USBD0或者USBD1,另一個USB子設(shè)備都能正常枚舉成功。如果兩個都保留,則只有USBD1子設(shè)備枚舉成功,USBD0沒有參與通信過程,照理來說應(yīng)該兩個子設(shè)備都能枚舉才對。


問題二:

????HB_ADDR=0x7F; 這句代碼是從官方提供的實(shí)例代碼照抄的,它的作用是什么? USBHUB的地址不需要上位機(jī)分配嗎?

哎,等了一周過去,舊問題沒解決,又碰到了新問題.

CH555的LED控制器的工作原理是怎么樣的,能否請沁恒的工程師解答下?

我在示例代碼內(nèi)看到在LED幀掃描結(jié)束中斷函數(shù)內(nèi)有調(diào)用"RGBLOAD.ASM"內(nèi)的匯編函數(shù),實(shí)際打開匯編函數(shù)發(fā)現(xiàn)完全看不懂,里面操作的都是一些通用寄存器,所以搞不懂是為什么在幀掃描結(jié)束后需要操作這些寄存器.

希望能夠得到解答,另外希望知道是否能用C語言重寫這部分匯編代碼.


附官方例程資料:

icon_rar.gifCH555_RGB機(jī)械鍵盤資料.zip



to be fair i dont know the ch555 in detail but the header looks like the usual E52 core. Must be a new chip.


check this out:

? ?SETB? P? ? ;copy LED_DMA into DPTR1

This is definately wrong the parity bit is read only! How would changing the parity bit help anyway?


Maybe they want to enable?bDPTR_AUTO_INC, which would make sense for coping data. AutoInc is potentially dangerous, thats why they disable all interrupts.



Yes, i just can see copy LED_DMA to DPTR1 in asm file, but i don't know why need do that.

I don't know how the LED Scanner work.


I want to know the meaning of the asm function, which may be very helpful for me to write programs.


well i am guessing here..

that movx seems just to eat cycles

same as the movc for code access. (movc is slower therefor just 8 movc)


or possibly that triggers something internally. I cant see anything in the datasheet to support this theory.


further i have no idea how they control DPTR to have the correct value on entry.

The rest of the code seems for keyboard prepare


@Antecer 你好,我的微信號18951773083,可以加我微信詳細(xì)溝通。


只有登錄才能回復(fù),可以選擇微信賬號登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频