我要如何用變數方式去定址PIC裡的Register address
|
||||
---|---|---|---|---|
新會員
|
請叫大大們 我的問題是我想要PIC的Register 用變數去做
要如何使用? compiler is HI-TECH V9.5 以下是我寫的可是不能動 Compiler可以過 例如 我要 把PIC16F946 LCDDATA0 的位置裡填上 0xAA的資料 // 這是HI-TECH .H裡的定義 static bank2 unsigned char LCDDATA0 @ 0x110; static bank2 unsigned char LCDDATA1 @ 0x111; static bank2 unsigned char LCDDATA2 @ 0x112; reg是可以改變address位置 reg = 1 // LCDDATA1 reg = 2 // LCDDATA2 unsigned int*lcd_ptr = (unsigned int *)(0x110+reg); if (ch & 1) *lcd_ptr |= mask; else *lcd_ptr &= ~mask;
發表於: 2006/3/7 19:39
|
|||
|