• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
:::

論壇索引


Board index » All Posts




PIC18 ADC function!!!
高級會員
高級會員


關於有支援ADC的PIC18
如果我一次有多個channel要轉換
是否要一個一個channel轉
還是有沒有辦法同時轉呢
如果要一個一個轉
若一個channel的轉換時間平均為39us
那10個channel轉完就要花390us囉

發表於: 2005/8/4 16:18
頂部


Re: 使用C18相關問題~~請各位先進指導
新會員
新會員


在PIC18F8720上面移植成功了uC/OS-II,并且在硬件板上运行稳定。解决了.tmpdata和MATH_DATA的保存问题。改天发上来。

發表於: 2005/8/4 16:15
頂部


Re: 請問各位高手有關LCD程式....
高級會員
高級會員


原來如此.......

謝謝您的告知...

我已經解決了....

原來CCS和C18差很多....

不過我用C18寫的...也算是模擬CCS的寫法...
因為用的是同一塊LCD.....


發表於: 2005/8/4 16:13
頂部


PIC18 SPI function!!!
高級會員
高級會員


請教一下哦
我現在在study pic18的FW
其中有一個是要用到SPI的功能
在C18中有支援spi.h這個函式
但是當我把該spi的device的cs設為1
該控制腳的tris也設為1
用OpenSPI這個函式把SPI打開
如下程式所示

CS_DAC = 1;
TRIS_CS_DAC = 0;
OpenSPI(sync_mode, bus_mode, smp_phase);

請問之後我要怎麼把資料寫進去呢
那是否寫完後就直接把CS_DAC設為0就可以完成SPI的傳輸了呢
請各位高手不吝指教

發表於: 2005/8/4 15:50
頂部


Re: 想請問I2C應用範例
高級會員
高級會員


void IIC_INIT(void)
{
output_high(P_SDA);
output_high(P_SCL);
}
void IIC_WAIT(void)
{
delay_us(10);
}

void IIC_START(void)
{
output_high(P_SDA); //P_SDA = 1;
output_high(P_SCL); //P_SCL = 1;
IIC_WAIT();
output_low(P_SDA); //P_SDA = 0;
IIC_WAIT();
output_low(P_SCL); //P_SCL = 0;

}
//***** VERSION : 1.0 *****
// /------------
// SCL -----/
//
// /----------
// SDA-------/
//
// SCL先拉HI SDA 再跟著拉HI
//
//***********************************

void IIC_STOP(void)
{
output_low(P_SDA); //P_SDA = 0;
IIC_WAIT();
output_high(P_SCL); //P_SCL = 1;
IIC_WAIT();
output_high(P_SDA); //P_SDA = 1;
}
int8 IIC_SEND_BYTE(int8 databyte)
{
int8 i;
int8 ack;
for(i = 0;i<8;i++)
{
if ( databyte & 0x80)
output_high(P_SDA);
else
output_low(P_SDA);
databyte <<=1;
// IIC_WAIT();
output_high(P_SCL);
IIC_WAIT();
output_low(P_SCL);
// IIC_WAIT();

}
//in 8051 mcu is setting input mode output_high(P_SDA);
input(P_SDA);
IIC_WAIT();
output_high(P_SCL);
IIC_WAIT();
IIC_WAIT();
IIC_WAIT();
ack = input(P_SDA);
output_low(P_SCL);
IIC_WAIT();


return ack;
}
int8 IIC_RECEIVE_BYTE(void)
{
int8 i;
int8 databyte =0;
input(P_SDA);
for (i=0;i<8;i++)
{
output_high(P_SCL);
IIC_WAIT();
databyte <<=1;
if (input(P_SDA)) databyte |= 0x01;
output_low(P_SCL);
IIC_WAIT();

}
return databyte;
}

void SEND_ACK(int8 ack)
{
if (ack==0x01)
output_high(P_SDA);
else
output_low(P_SDA);
output_high(P_SCL);
IIC_WAIT();
output_low(P_SCL);

}
void IIC_BYTEWRITE(int8 device,int8 address,int8 databyte1,int8 databyte2)
{
int8 i;
int8 ack;
for (i=0;i<10;i++)
{
IIC_START();
ack = IIC_SEND_BYTE(device);
if (ack==1)
{
IIC_STOP();
continue;
}
ack = IIC_SEND_BYTE(address);
if (ack==1)
{
IIC_STOP();
continue;
}
ack = IIC_SEND_BYTE(databyte1);
if (ack==1)
{
IIC_STOP();
continue;
}
ack = IIC_SEND_BYTE(databyte2);
if (ack==1)
{
IIC_STOP();
continue;
}

IIC_STOP();
if (ack==0) break;

}
delay_us(2);
}
void IIC_READ_IOPORT(int8 device,int8 command)
{
int8 i;
int8 ack;
// F_SENDTIMEOUT = 1;
for (i=0;i<10;i++)
{
IIC_START();
ack = IIC_SEND_BYTE(device);
if (ack==1)
{
IIC_STOP();
continue;
}
ack = IIC_SEND_BYTE(command);
if (ack==1)
{
IIC_STOP();
continue;
}
IIC_STOP();
if (ack==0) break;

}

delay_us(2);
PORTDATA = IIC_RECEIVE_BYTE();

}
void READ_IO(int8 address,int8 command,int8 address1)
{
int8 i;
int8 ack;
/*
i2c_start(); // Generate START condition
i2c_write(AddressW); // Transmit ADDRESS with WRITE command
i2c_write(Command); // Transmit COMMAND byte
i2c_repStart(); // Generate a REPEATED-START condition
i2c_write(AddressR); // Transmit ADDRESS with READ command
MCP_LSB=i2c_read(1); // Receive first DATA byte (LSB) and acknowledge
MCP_MSB=i2c_read(0); // Receive second DATA byte (MSB) and don't acknowledge
i2c_stop(); // Generate a STOP condition
*/
// F_SENDTIMEOUT = 1;
for (i=0;i<10;i++)
{
IIC_START();
ack = IIC_SEND_BYTE(address);
if (ack==1)
{
IIC_STOP();
continue;
}
ack = IIC_SEND_BYTE(command);
if (ack==1)
{
IIC_STOP();
continue;
}
if (ack==0) break;
}
delay_us(14);
for (i=0;i<10;i++)
{
IIC_START();
ack = IIC_SEND_BYTE(address1);
if (ack==1)
{
IIC_STOP();
continue;
}
if (ack==0) break;

}
BUFFER1 = IIC_RECEIVE_BYTE();
delay_us(20);
input(P_SDA);
IIC_WAIT();
output_high(P_SCL);
IIC_WAIT();
IIC_WAIT();
IIC_WAIT();
if (input(P_SDA))
{
IIC_STOP();
}
output_low(P_SCL);
IIC_WAIT();
BUFFER2 = IIC_RECEIVE_BYTE();
input(P_SDA);
IIC_WAIT();
output_high(P_SCL);
IIC_WAIT();
IIC_WAIT();
IIC_WAIT();
if (input(P_SDA))
{
IIC_STOP();
}
output_low(P_SCL);
IIC_WAIT();

IIC_STOP();
}

void main() {
delay_ms(100);
EXPANDER_IO_INITIAL();

while (TRUE)
{
if (!input(P_INTERRUPT))
{
debug_pin();
READ_IO(WRITECOMMAND_TO_IC,ACCES_GP1,READCOMMAND_FROM_IC);

while(!input(P_INTERRUPT));
}else
{
IIC_BYTEWRITE(WRITECOMMAND_TO_IC,ACCES_OLAT0,0X7F,0xff); //寫初始直
delay_ms(250);
IIC_BYTEWRITE(WRITECOMMAND_TO_IC,ACCES_OLAT0,0XBF,0xff); //寫初始直
delay_ms(250);
}

}
}


發表於: 2005/8/4 15:18
頂部


Re: 請教各位先進們有單晶片在通信的過程中關接收方面的問題
資深會員
資深會員


問題點會不會是出在這裡?
GOTO $-1
18系列程式計數器一次+2
記得有人說使用$-1這種方式跳躍會出問題

發表於: 2005/8/4 13:11
頂部


請教各位先進們有單晶片在通信的過程中關接收方面的問題
初級會員
初級會員


各位先進們,我現在適用的ICPIC是18F252,使用的晶體頻率是12.000MHz,SPBRG=0X26,TXSTA=0X24,RCSTA=0X90,鮑特率是19200,但是我下面的程式卻接收不到資料,我的想法是在接收到一個不為零的資料時,我們單晶片就發送一些資料出來,通過調試,卻發現沒有送資料出來。(發送部份已經試過沒有問題)。
BEGIN
BTFSS PIR1, RCIF
GOTO $-1
BTFSC RCSTA, OERR
GOTO OER
BTFSC RCSTA, FERR
GOTO FER
BTFSS RCSTA, RX9D
GOTO FER
MOVF RCREG, W
MOVWF TEMP
GOTO RECIEVE
OER
BCF RCSTA, CREN
CALL DELAY1
BSF RCSTA, CREN
GOTO BEGIN
FER
MOVF RCREG, W
GOTO BEGIN
RECIEVE
MOVLW 0X00
MOVWF CNT
LB
CALL Send
DECFSZ CNT
GOTO LB
GOTO STOP

發表於: 2005/8/4 11:44
頂部


Re: INT interrupt problem
新會員
新會員


Thank you, you are so nice a guy.

I found the reason last night. The J6 connecting causes RB0 low. My carelessness brings you a trouble, sorry.

I change R7 into 470 from 4.7k to resolve this problem.

I feel so glad to join this bbs although I am not in Taiwan.

發表於: 2005/8/4 11:25
頂部


RFID ic及發展工具
新會員
新會員


想要學習RFID
在網路上搜尋到microchip有相關的產品
不過在詢問過代理商後好像對這方面都不是很熟悉
不知道各位先進有沒有使用過
或是有代理商可以推鑑
可以的話麻煩mail相關資料
謝謝

lsj@vot.url.com.tw
小莫

發表於: 2005/8/3 23:47
頂部


Re: 想請問I2C應用範例
新會員
新會員


不好意思補充一下我的問題
我有APPOO1工作版以及ICD2

我是想用PIC當master做I2C串列通訊格式
發出及接收SDA以及SCL的命令
目前看到16F873有I2C的功能
請問18F系列有出I2C功能的晶片嗎

還有是否有可能拿到C18或C16的I2C控制範例程式

還有 請問24LCXX與25LCXX,,93c86
這些東西是用I2C格式做溝通的外接記憶體ㄇ
因為我是新手
看不太懂
希望可以得到解答
感激不盡阿

發表於: 2005/8/3 23:46
頂部



« 1 ... 6985 6986 6987 (6988) 6989 6990 6991 ... 7522 »



:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------