Re: 問幾個ccs 的問題?
|
||||
---|---|---|---|---|
資深會員
|
參照:
看來你用的是 CC5X,不是 CCS,呵呵
發表於: 2005/7/6 12:29
|
|||
|
Re: ccs程式問題
|
||||
---|---|---|---|---|
資深會員
|
參照:
no, no, CCS 的 fprintf( ) 的輸出目的地 _不限於_ buffer ! CCS 做 輸出導向其他裝置 ... 一點也不花時間 printf ( putc, "hello world, x = %u", x ) 就送到 STDOUT 依此類推 printf ( lcd_putc, "hello world, x = %u", x ); 就送到 LCD 去啦 只要你有一個可以接受字元變數的 lcd_putc ( char c ) 就搞定啦 (CCS 所提供的驅動程式 lcd.c 裡面就有 lcd_putc ) 照貓畫虎,還可以搞出一堆好玩的 ... printf ( i2c_write, ... ) 就送到 I2C 去 或是 printf ( mmc_write, ... ) 就寫到 MMC 記憶卡去 printf ( nic_putc, ... ) 就送到 Ethernet 去 實在是超好用的東東,呵呵 喔,忘了說最基本的用途,多通道軟硬體 RS232 先宣告一個硬體RS232和兩個軟體RS232,以 16F877 或 18F452 為例,如下 #use rs232(baud=9600,xmit=pin_c6, rcv=pin_c7,stream=HOSTPC) #use rs232(baud=1200,xmit=pin_b1, rcv=pin_b0,stream=GPS) #use rs232(baud=9600,xmit=pin_b3, stream=DEBUG) 然後 fprintf(DEBUG,"Got a CR\r\n"); 就送到 PIN_B3 去 fputc(c,HOSTPC); 就用硬體 USART 送到 PIN_C6 去 c=fgetc(GPS); 就去讀 PIN_B0 的 GPS 囉 兩三行輕鬆搞定,PIC16 與 PIC18 甚至於 PIC12 都可以 _無痛苦_ 快速移植! 會佔空間嗎? 我手上沒有 Hi-Tech C,也沒有 C18,不過, CCS 站上有篇老文章可以參考一下 http://www.ccsinfo.com/compare.shtml 看來 CCS 的 printf 的效率要比 Hi-Tech 高太多太多啦 ,有興趣的朋友不妨再測試比較一下吧 http://www.ccsinfo.com/demo.shtml 此外,目前的 CCS 3.226 與四年前的 3.002 相比,可真是有天壤之別喔,呵呵 Enjoy !
發表於: 2005/6/27 23:23
|
|||
|
Re: 用c寫程式哪一套比較好
|
||||
---|---|---|---|---|
資深會員
|
ADC 的,就 Help -> Index -> Read_xxx
有 Read_ADC 也有 Read_EEPROM 還有 .... 一堆 先看看 Read_ADC() 吧 ... 有說明,有範例,不需要書啊 ... 其他的 ... 就依此類推囉 ... 還不夠? 就下載一本 CCS-C 使用手冊 K 囉 http://www.ccsinfo.com/ccscmanual.zip http://www.ccsinfo.com/download.shtml 祝 如意 READ_ADC() Syntax: value = read_adc ([mode]) Parameters: mode is an optional parameter. If used the values may be: ADC_START_AND_READ (this is the default) ADC_START_ONLY (starts the conversion and returns) ADC_READ_ONLY (reads last conversion result) Returns: Either a 8 or 16 bit int depending on #DEVICE ADC= directive. Function: This function will read the digital value from the analog to digital converter. Calls to setup_adc(), setup_adc_ports() and set_adc_channel() should be made sometime before this function is called. The range of the return value depends on number of bits in the chips A/D converter and the setting in the #DEVICE ADC= directive as follows: #DEVCE 8 bit 10 bit 11 bit 16 bit ADC=8 00-FF 00-FF 00-FF 00-FF ADC=10 x 0-3FF x x ADC=11 x x 0-7FF x ADC=16 0-FF00 0-FFC0 0-FFEO 0-FFFF Note: x is not defined Availability: This function is only available on devices with A/D hardware. Requires #include <STDLIB.H> Examples: setup_adc( ADC_CLOCK_INTERNAL ); setup_adc_ports( ALL_ANALOG ); set_adc_channel(1); while ( input(PIN_B0) ) { delay_ms( 5000 ); value = read_adc(); printf("A/D value = %2x\n\r", value); } read_adc(ADC_START_ONLY); sleep(); value=read_adc(ADC_READ_ONLY); Example Files: ex_admm.c, ex_14kad.c Also See: setup_adc(), set_adc_channel(), setup_adc_ports(), #DEVICE
發表於: 2005/6/23 18:15
|
|||
|
Re: 用c寫程式哪一套比較好
|
||||
---|---|---|---|---|
資深會員
|
>> 只是CCS指令不懂 就直說你要啥吧 不然要我從哪裡開始說? 要 ADC 還是 PWM 做 DA ? 還是要 EEPROM ? <CCS -> Help -> 有完整的指令介紹說明 >====>太多了 也不知從何下手 先全部瀏覽一遍吧,我也是這樣幹的
發表於: 2005/6/21 19:19
|
|||
|
Re: 用c寫程式哪一套比較好
|
||||
---|---|---|---|---|
資深會員
|
>> 只是C語法 C指令不知道
沒學過 C? CCS -> Help -> 有完整的指令介紹說明 The C Programming Language, Second Edition by Brian W. Kernighan and Dennis M. Ritchie. 這是 C 的聖經 http://cm.bell-labs.com/cm/cs/cbook/ 先用 PC 的 Turbo-C 或 VC 玩玩吧 圖書館一定有,中文書也是一堆 上 Google 查 C 語言,一堆教學網站 Have fun !
發表於: 2005/6/21 17:15
|
|||
|
Re: 用c寫程式哪一套比較好
|
||||
---|---|---|---|---|
資深會員
|
1. 下載 CCS 試用版 http://www.ccsinfo.com/demo.shtml
2. 找範例 C:\Program Files\PICC\Examples\*.c 就從 LED 開始玩吧 EX_SQW.c C:\Program Files\PICC\Examples\EX_SQW.c 3. 看書 http://www.ccsinfo.com/newtopiccbooks.shtml 4. 買套實驗板 http://www.ccsinfo.com/hardware.shtml#devkits http://www.ccsinfo.com/evalkit877.shtml#16f877 這塊本土實驗板 Microchip General Purpose EVM Board (APP001) 非常好,台幣 1500, http://www.microchip.com.tw/images0/evm-app001.JPG 沒板子的話,就玩模擬器吧,呵呵 5. 買套學生版的合法軟體, 50 美金就好,一堆範例http://www.ccsinfo.com/education.shtml
發表於: 2005/6/21 16:04
|
|||
|
Re: 請問CCS COMPILER IDE 可以使用ICD2 除錯嗎
|
||||
---|---|---|---|---|
資深會員
|
>> 是不是不ㄧ定要在CCS COMPILER IDE 編輯呢?
No >> 而ccs在MPLAB編輯下使用PIC16,PIC18是不是都可以呢? Yes >>請問一下CCS 可以在MPLAB裡面編輯並下載至ICD2執行模擬嗎? Yes and No. CCS 在MPLAB裡面編輯並下載至ICD2,應該是只能執行 ASM 模擬,不能執行 C-level 模擬。 我沒用 MPLAB,不敢保證啦 還是去 CCS 討論區發問吧 http://www.ccsinfo.com/forum/
發表於: 2005/6/20 18:32
|
|||
|
Re: 請問CCS COMPILER IDE 可以使用ICD2 除錯嗎
|
||||
---|---|---|---|---|
資深會員
|
不行的
CCS provides a high level debugger for the Microchip PIC® line of microcontrollers. This debugger is included with PCW, CCS's C Compiler with Windows IDE, and requires an ICD unit (Microchip MPLAB®-ICD1, CCS ICD-S40 or CCS ICD-U40) connected to a flash PIC series microcrontroller that is capable of debugging (such as the PIC16F87x or PIC18Fxx2). Future support will include other emulator and debugging hardware and the dsPIC® line of microcontrollers. 你可以用 CCS 做的 ICD-U (美金 75) 或是用舊的 ICD-1 加上 CCS 的韌體讓 ICD-1 可以玩 18F If you own an MPLAB® ICD1 you can load it with CCS-ICD firmware to get PIC18 debugging and ICSP functionality, but this functionality is only provided through CCS's software and not Microchip's software. However this is a great way to upgrade your existing ICD1's for use with PIC18s. http://www.ccsinfo.com/icds.shtml
發表於: 2005/6/19 17:30
|
|||
|
Re: 4~20mA帶電壓
|
||||
---|---|---|---|---|
資深會員
|
若雙方回流點(地線)的準位不同,建議加顆 差動放大器 或 儀表放大器 (INA118 或 Microchip 的 ??), 就可以保險啦
發表於: 2005/6/9 22:25
|
|||
|
Re: 用c寫程式哪一套比較好
|
||||
---|---|---|---|---|
資深會員
|
參照:
完整版 CCS 有範例 123 個,驅動程式 86 個,demo 版的給的比較少 http://www.ccsinfo.com/examples.shtml CCS 說近期內就會支援 dsPIC ,我還在等 http://www.ccsinfo.com/dspic.shtml CCS 最有用的就是它的討論區,有一堆樂於助人的高手 http://www.ccsinfo.com/forum/
發表於: 2005/6/7 15:04
|
|||
|