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

論壇索引


Board index » All Posts (mechwu)




Re: 問幾個ccs 的問題?
#21
資深會員
資深會員


參照:

jchuang 寫道:
deal all:

Message[302] C:\CC5X\PORTA3.ASM 34 :

謝謝各位的解答囉~


看來你用的是 CC5X,不是 CCS,呵呵

發表於: 2005/7/6 12:29
頂部


Re: ccs程式問題
#22
資深會員
資深會員


參照:

...
printf( ) 會將字串以及變數依照選定的格式輸出至 stdout , 在 CCS 裡的內定值是 USART. 當然 , 修改相關的 Low Level code 也可將輸出導向其他裝置. 但要花點時間 .
...
所以 CCS 的 fprintf( ) 的輸出目的地是 buffer !
...
這兩個函式很好用 , 但是 ..... 很佔空間 .


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寫程式哪一套比較好
#23
資深會員
資深會員


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寫程式哪一套比較好
#24
資深會員
資深會員



>> 只是CCS指令不懂

就直說你要啥吧

不然要我從哪裡開始說?

要 ADC 還是 PWM 做 DA ?

還是要 EEPROM ?

<CCS -> Help -> 有完整的指令介紹說明
>====>太多了 也不知從何下手

先全部瀏覽一遍吧,我也是這樣幹的

發表於: 2005/6/21 19:19
頂部


Re: 用c寫程式哪一套比較好
#25
資深會員
資深會員


>> 只是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寫程式哪一套比較好
#26
資深會員
資深會員


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 除錯嗎
#27
資深會員
資深會員


>> 是不是不ㄧ定要在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 除錯嗎
#28
資深會員
資深會員


不行的

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帶電壓
#29
資深會員
資深會員



若雙方回流點(地線)的準位不同,建議加顆 差動放大器
或 儀表放大器 (INA118 或 Microchip 的 ??),
就可以保險啦

發表於: 2005/6/9 22:25
頂部


Re: 用c寫程式哪一套比較好
#30
資深會員
資深會員


參照:

maru2000 寫道:
眾合各位大俠意見
CCS比較容易入門及易懂.容易學習
可是CCS只支援PIC16.PIC18系列
並不支援DSPIC
那麼以後要使用DSPIC 時還要再學另外一套了

CCS的範例程式有很多嗎?

CCS及PICC16.18 可以外掛在MPLAB上面嗎
有支援ICD2嗎?


完整版 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
頂部



« 1 2 (3) 4 5 6 ... 16 »



:::

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... ]

教育訓練中心

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