搜索
bottom↓
楼主: pic_flash

【交流】CCS C PIC 编译器的同好请来交流

  [复制链接]

出0入8汤圆

发表于 2018-6-7 19:40:37 | 显示全部楼层
多谢分享,看起来很好用的样子

出10入10汤圆

发表于 2018-6-16 14:57:19 | 显示全部楼层
pic_flash 发表于 2016-12-4 10:27
PIC 编译器, CCS C
版本: PCWHD_V5.065  (PIC 编译器)

楼主,你好。请问串口发送9bit数据函数是哪个?

出0入8汤圆

发表于 2018-6-17 00:12:44 | 显示全部楼层
szxszx 发表于 2018-6-16 14:57
楼主,你好。请问串口发送9bit数据函数是哪个?

#pragma use rs232(baud=9600, bits = 9, xmit=PIN_C6, rcv=PIN_C7)

出10入10汤圆

发表于 2018-6-17 09:13:15 | 显示全部楼层
harold 发表于 2018-6-17 00:12
#pragma use rs232(baud=9600, bits = 9, xmit=PIN_C6, rcv=PIN_C7)

谢谢,这个是预编译的参数。我想问一下是哪个函数?下面例子可行吗?

void SendData(unsigned char Data)
{
        TX9D = 1;        //第9位需要先赋值?
        putc(Data);   
}

出0入0汤圆

 楼主| 发表于 2018-6-17 12:55:37 | 显示全部楼层
szxszx 发表于 2018-6-16 14:57
楼主,你好。请问串口发送9bit数据函数是哪个?

#use rs232(baud=9600, bits = 9, xmit=PIN_C6, rcv=PIN_C7, errors)
这个就可以了。。

建议看Help, 还有很多附加功能, 比如延时,Timeout , received buffer之类的

出0入0汤圆

 楼主| 发表于 2018-6-17 12:56:45 | 显示全部楼层
szxszx 发表于 2018-6-17 09:13
谢谢,这个是预编译的参数。我想问一下是哪个函数?下面例子可行吗?

void SendData(unsigned char Data ...

应该不需要的

出10入10汤圆

发表于 2018-6-17 13:11:14 | 显示全部楼层

在多机通讯中,第9位用于表示是地址还是数据,可能是1或0,应该要先赋值

出0入0汤圆

发表于 2018-6-23 16:58:18 | 显示全部楼层
我来看看楼主。

出0入0汤圆

发表于 2018-7-10 17:14:05 | 显示全部楼层

我来看看楼主。

出0入0汤圆

发表于 2018-7-20 08:21:28 | 显示全部楼层

我来看看楼主。

出0入0汤圆

发表于 2018-7-29 21:24:53 | 显示全部楼层
楼主有没最新版的CCS

出0入0汤圆

 楼主| 发表于 2018-7-31 08:57:14 | 显示全部楼层
miscell 发表于 2018-7-29 21:24
楼主有没最新版的CCS

PIC 编译器, CCS C
版本: PCWHD_V5.079  (PIC 编译器)
链接:https://pan.baidu.com/s/1GPWtqV-v-S7xwWftp3Hliw
密码:q1fi

出0入4汤圆

发表于 2018-7-31 09:33:23 | 显示全部楼层
这次更新了什么?

出0入0汤圆

 楼主| 发表于 2018-7-31 10:47:09 | 显示全部楼层
gmyu 发表于 2018-7-31 09:33
这次更新了什么?

5.079  A problem with some interrupts on the K42 parts starting in the wrong bank is fixed
5.079  A problem with the IDE finding units when the output directory is specified is fixed
5.079  A wrong warning 227 on some chips and options is fixed
5.079  The ++ operator when used on multi-byte fields in a packed structure sometimes did not work
5.079  A PIC24 optimization issues was fixed related to integer to float conversion
5.079  A PCH problem with function pointers inside structures for some syntaxes is fixed
5.079  A fix was made for dual partition mode
5.079  Fixed restart_wdt() for devices with a WWDT and window is set to less then 100 percent
5.079  Fixed issue with port_x_pullup() function not clearing WPUEN bit for some chips

出0入0汤圆

发表于 2018-7-31 11:07:02 | 显示全部楼层
谢谢热心的楼主!

出0入4汤圆

发表于 2018-7-31 13:01:29 | 显示全部楼层
PIC32MZ2408   支持吗???

出0入0汤圆

 楼主| 发表于 2018-7-31 16:24:26 | 显示全部楼层
zhanyanqiang 发表于 2018-7-31 13:01
PIC32MZ2408   支持吗???

CCS C 目前不支持任何的PIC32。。

出0入0汤圆

发表于 2018-8-2 14:32:29 | 显示全部楼层
LZ威武!!!

出0入0汤圆

发表于 2018-8-9 12:48:59 | 显示全部楼层
CCS C 下,有成功跑protothreads 的吗,发现在PICC 9.83 Pro下跑起来 有异常

出0入0汤圆

 楼主| 发表于 2018-8-9 18:44:03 | 显示全部楼层
mathison 发表于 2018-8-9 12:48
CCS C 下,有成功跑protothreads 的吗,发现在PICC 9.83 Pro下跑起来 有异常

我个人没有用过, 但是有人移值到CCS C, 没有后续的跟进, 有没有问题不知道, 根据移植的作者说,CCS C 并不能很好的支持原创的代码, 他是经过一番修改。

  1. /******************************************************************************
  2. * NAME:  protothreads.h
  3. * AUTH:  Jeremiah (Reworked from Adam Dunkel's code)
  4. * DESC:  Provides a stackless, OS-less, low RAM implementation of cooperative
  5. *        multithreading for the CCS compiler environment.  Based off of the
  6. *        protothreads library provided by Adam Dunkel, but with modifications
  7. *        for the CCS compiler environment.  Specifically:
  8. *           1. CCS doesn't support local continuations, so compiler extensions
  9. *              are used instead.  label_address() and goto_address()
  10. *           2. Removal of do{}while() loops as they generate compiler warnings
  11. *              and are not needed for CCS.
  12. *           3. Changed PT_END() and PT_EXIT() to not reset the local
  13. *              continuation but instead remember the thread finished.
  14. *           4. Re-orged a few macros to better optimize with CCS.
  15. *           5. Changed PT_YIELD_FLAG=0 to PT_YIELD_FLAG=PT_YIELD_FLAG in the
  16. *              PT_END() macro
  17. *           6. Removed PT_THREAD() and replaced it with pt_ret_t
  18. *           7. Added (and defaulted to) the use of reference parameters since
  19. *              those provide less code in most general scenarios.  A #define
  20. *              can be commented out to go back to pointers.
  21. *        Copyright notice from Adam Dunkels code provided near the end of the
  22. *        file.
  23. *
  24. *        TYPES:
  25. *           pt_t     - Protothread context type
  26. *           pt_ret_t - Protothread return type
  27. *                          PT_WAITING - Thread is waiting/blocking
  28. *                          PT_YIELDED - Thread yielded
  29. *                          PT_EXITED  - Thread ended abnormally
  30. *                          PT_ENDED   - Thread ended normally
  31. *           pt_sem_t - Protothread semiphore type
  32. *
  33. *        MACROS:
  34. *           PT_INIT()  - Must be called prior to scheduling a thread
  35. *           PT_BEGIN() - Must be called at the beginning of a protothread.
  36. *           PT_END()   - Must be called at the end of a protothread (once)
  37. *           PT_WAIT_WHILE() - Used to block a thread while a condition is TRUE
  38. *           PT_WAIT_UNTIL() - Used to block a thread until a condition is TRUE
  39. *           PT_YIELD()       - Yields the current thread
  40. *           PT_YIELD_WHILE() - Yields current thread while a condition is TRUE
  41. *           PT_YIELD_UNTIL() - Yields current thread until a condition is TRUE
  42. *           PT_RESTART() - Restarts the current thread
  43. *           PT_EXIT()    - Exits the current thread
  44. *           PT_SCHEDULE()    - Schedules a thread from a non-thread method
  45. *           PT_WAIT_THREAD() - Spawns a child thread and waits on it to end
  46. *           PT_SPAWN()       - Same as PT_WAIT_THREAD() but with PT_INIT()
  47. *           PT_SEM_INIT()   - Initializes a semiphore
  48. *           PT_SEM_WAIT()   - Waits on a semiphore signal (decrements count)
  49. *           PT_SEM_SIGNAL() - Sends a semiphore signal (increments count)
  50. *
  51. * COMPILED WITH:  CCS PCWHD Revision 5.025
  52. *
  53. * HISTORY:  
  54. * 02/20/2014 - JHB - Creation
  55. ******************************************************************************/
  56. #ifndef PROTOTHREADS_H
  57. #define PROTOTHREADS_H
  58. #nolist

  59. ///////////////////////////////////////////////////////////////////////////////
  60. //***************** File Option Settings ************************************//
  61. ///////////////////////////////////////////////////////////////////////////////
  62. //CCS specific - for use with reference parameters vs pointer parameters
  63. #define PT_USE_REFERENCES  //comment this line out to use pointers
  64. #if defined(PT_USE_REFERENCES)
  65. #define PT_STRUCT_ELEM(st, e) ((st).e)
  66. #else
  67. #define PT_STRUCT_ELEM(st, e) ((st)->e)
  68. #endif


  69. ///////////////////////////////////////////////////////////////////////////////
  70. //***************** Local Continuations (Compiler Specific) *****************//
  71. ///////////////////////////////////////////////////////////////////////////////
  72. //This section sets up some macros used by the protothreads interface.  These
  73. //macros should not be used directly.  They are merely tools for the
  74. //protothreads interface.

  75. //Variable typedef
  76. #if defined(__PCH__) || defined(__PCD__)
  77. typedef unsigned int32 lc_t;
  78. #else
  79. typedef unsigned int16 lc_t;
  80. #endif

  81. //Used to reset the local continuation
  82. #define LC_INIT(lc) lc = 0

  83. //Place in PT_BEGIN()
  84. #define LC_RESUME(lc) if(0 != lc){goto_address(lc);}

  85. //Used to create continuations
  86. #define LC_CONCAT_INNER(s1,s2) s1##s2
  87. #define LC_CONCAT(s1,s2) LC_CONCAT_INNER(s1,s2)
  88. #define LC_SET(lc)                                    \
  89.    LC_CONCAT(LC_LABEL, __LINE__):                     \
  90.    (lc) = label_address(LC_CONCAT(LC_LABEL,__LINE__))

  91. //Place in PT_END()
  92. #define LC_END(lc)

  93. ///////////////////////////////////////////////////////////////////////////////
  94. //***************** Protothreads Interface **********************************//
  95. ///////////////////////////////////////////////////////////////////////////////
  96. //This is the meat of the file.  Macros from here will be used to create and
  97. //manage protothreads.

  98. //Variable Typedefs
  99. typedef struct{
  100.    lc_t lc;
  101. } pt_t;

  102. typedef enum{
  103.    PT_WAITING = 0,
  104.    PT_YIELDED = 1,
  105.    PT_EXITED  = 2,
  106.    PT_ENDED   = 3
  107. } pt_ret_t;


  108. ///////////////////////////////////////////////////////////////////////////////
  109. // NAME: PT_INIT
  110. // DESC: Initializes the control structure for a protothread.  Must be called
  111. //       prior to calling the thread.
  112. // IN:   pt - protothread control structure
  113. // OUT:  NONE
  114. // NOTE: Example:
  115. //       pt_ret_t thread(pt_t &pt);
  116. //       void main(){
  117. //          pt_t pt;
  118. //          PT_INIT(pt);
  119. //          while(TRUE){PT_SCHEDULE(thread(pt));}
  120. //       }
  121. ///////////////////////////////////////////////////////////////////////////////
  122. #define PT_INIT(pt)  LC_INIT(PT_STRUCT_ELEM(pt,lc))

  123. ///////////////////////////////////////////////////////////////////////////////
  124. // NAME: PT_BEGIN
  125. // DESC: Starts the control code for a thread.  Must be called after variable
  126. //       declarations and before function program code
  127. // IN:   pt - protothread control structure
  128. // OUT:  NONE
  129. // NOTE: Example:
  130. //       pt_ret_t thread(pt_t &pt){
  131. //          static int variable;
  132. //          PT_BEGIN(pt);
  133. //          variable = 10;
  134. //          //do stuff here
  135. //          PT_END(pt);
  136. //       }
  137. ///////////////////////////////////////////////////////////////////////////////
  138. #define PT_BEGIN(pt) int1 PT_YIELD_FLAG = 1;  LC_RESUME(PT_STRUCT_ELEM(pt,lc))

  139. ///////////////////////////////////////////////////////////////////////////////
  140. // NAME: PT_END
  141. // DESC: Ends the control code for a thread.  Must be called at the end of
  142. //       of a protothread.  Leaves the tread with the PT_ENDED status.
  143. // IN:   pt - protothread control structure
  144. // OUT:  NONE
  145. // NOTE: Example:
  146. //       pt_ret_t thread(pt_t &pt){
  147. //          PT_BEGIN(pt);
  148. //          //do stuff here
  149. //          PT_END(pt);
  150. //       }
  151. ///////////////////////////////////////////////////////////////////////////////
  152. #define PT_END(pt)   LC_SET(PT_STRUCT_ELEM(pt,lc)); \
  153.    LC_END(PT_STRUCT_ELEM(pt,lc));   PT_YIELD_FLAG = PT_YIELD_FLAG;\
  154.    return PT_ENDED

  155. ///////////////////////////////////////////////////////////////////////////////
  156. // NAME: PT_WAIT_WHILE
  157. // DESC: Blocks the current thread while a supplied condition is true
  158. // IN:   pt - protothread control structure
  159. //       condition - condition that causes blocking
  160. // OUT:  NONE
  161. // NOTE: Example:
  162. //       int g_variable = 0;
  163. //       pt_ret_t thread(pt_t &pt){
  164. //          PT_BEGIN(pt);
  165. //          PT_WAIT_WHILE(0 == g_variable);
  166. //          //do stuff here
  167. //          PT_END(pt);
  168. //       }
  169. ///////////////////////////////////////////////////////////////////////////////
  170. #define PT_WAIT_WHILE(pt, condition)   \
  171.    LC_SET(PT_STRUCT_ELEM(pt,lc));  if(condition) { return PT_WAITING;}

  172. ///////////////////////////////////////////////////////////////////////////////
  173. // NAME: PT_WAIT_UNTIL
  174. // DESC: Blocks the current thread until a supplied condition becomes true
  175. // IN:   pt - protothread control structure
  176. //       condition - condition that ends blocking
  177. // OUT:  NONE
  178. // NOTE: Example:
  179. //       int g_variable = 0;
  180. //       pt_ret_t thread(pt_t &pt){
  181. //          PT_BEGIN(pt);
  182. //          PT_WAIT_UNTIL(0 != g_variable);
  183. //          //do stuff here
  184. //          PT_END(pt);
  185. //       }
  186. ///////////////////////////////////////////////////////////////////////////////
  187. #define PT_WAIT_UNTIL(pt, condition)   PT_WAIT_WHILE(pt, !(condition))

  188. ///////////////////////////////////////////////////////////////////////////////
  189. // NAME: PT_YIELD
  190. // DESC: Yields the current thread
  191. // IN:   pt - protothread control structure
  192. // OUT:  NONE
  193. // NOTE: Example:
  194. //       pt_ret_t thread(pt_t &pt){
  195. //          static int16 i;
  196. //          PT_BEGIN(pt);
  197. //          for(i=0; i<10000; i++){
  198. //             //do something
  199. //             PT_YIELD(pt);
  200. //          }
  201. //          PT_END(pt);
  202. //       }
  203. ///////////////////////////////////////////////////////////////////////////////
  204. #define PT_YIELD(pt)    \
  205.    PT_YIELD_FLAG = 0;   \
  206.    LC_SET(PT_STRUCT_ELEM(pt,lc));    \
  207.    if(0 == PT_YIELD_FLAG){ return PT_YIELDED; }

  208. ///////////////////////////////////////////////////////////////////////////////
  209. // NAME: PT_YIELD_WHILE
  210. // DESC: Yields the current thread while a supplied condition is true.  Always
  211. //       yeilds at least once.
  212. // IN:   pt - protothread control structure
  213. //       condition - condition that causes yielding
  214. // OUT:  NONE
  215. // NOTE: Example:
  216. //       int g_variable = 0;
  217. //       pt_ret_t thread(pt_t &pt){
  218. //          PT_BEGIN(pt);
  219. //          PT_YIELD_UNTIL(0 != g_variable);
  220. //          //do stuff here
  221. //          PT_END(pt);
  222. //       }
  223. ///////////////////////////////////////////////////////////////////////////////
  224. #define PT_YIELD_WHILE(pt, condition)  \
  225.    PT_YIELD_FLAG = 0;   \
  226.    LC_SET(PT_STRUCT_ELEM(pt,lc));    \
  227.    if((0 == PT_YIELD_FLAG) || (condition)){ return PT_YIELDED; }

  228. ///////////////////////////////////////////////////////////////////////////////
  229. // NAME: PT_YIELD_UNTIL
  230. // DESC: Yields the current thread until a supplied condition becomes true.  
  231. //       Always yeilds at least once.
  232. // IN:   pt - protothread control structure
  233. //       condition - condition that ends yielding
  234. // OUT:  NONE
  235. // NOTE: Example:
  236. //       int g_variable = 0;
  237. //       pt_ret_t thread(pt_t &pt){
  238. //          PT_BEGIN(pt);
  239. //          PT_YIELD_WHILE(0 != g_variable);
  240. //          //do stuff here
  241. //          PT_END(pt);
  242. //       }
  243. ///////////////////////////////////////////////////////////////////////////////
  244. #define PT_YIELD_UNTIL(pt, condition)  PT_YIELD_WHILE(pt, !(condition))

  245. ///////////////////////////////////////////////////////////////////////////////
  246. // NAME: PT_RESTART
  247. // DESC: Restarts the current thread back to the beginning
  248. // IN:   pt - protothread control structure
  249. // OUT:  NONE
  250. // NOTE: Example:
  251. //       BOOLEAN function();
  252. //       pt_ret_t thread(pt_t &pt){
  253. //          PT_BEGIN(pt);
  254. //          if(!function()){
  255. //             PT_RESTART(pt);
  256. //          }
  257. //          //do stuff
  258. //          PT_END(pt);
  259. //       }
  260. ///////////////////////////////////////////////////////////////////////////////
  261. #define PT_RESTART(pt)  PT_INIT(pt); return PT_WAITING

  262. ///////////////////////////////////////////////////////////////////////////////
  263. // NAME: PT_EXIT
  264. // DESC: Leaves the current thread with the PT_EXITED status
  265. // IN:   pt - protothread control structure
  266. // OUT:  NONE
  267. // NOTE: Example:
  268. //       BOOLEAN function();
  269. //       pt_ret_t thread(pt_t &pt){
  270. //          PT_BEGIN(pt);
  271. //          if(!function()){
  272. //             PT_EXIT(pt);
  273. //          }
  274. //          //do stuff
  275. //          PT_END(pt);
  276. //       }
  277. ///////////////////////////////////////////////////////////////////////////////
  278. #define PT_EXIT(pt)     LC_SET(PT_STRUCT_ELEM(pt,lc)); return PT_EXITED

  279. ///////////////////////////////////////////////////////////////////////////////
  280. // NAME: PT_SCHEDULE
  281. // DESC: Calls a thread from a non-thread function and compares it to
  282. //       the current status.
  283. // IN:   thread - protothread to call
  284. // OUT:  BOOLEAN - True if not PT_EXIT or PT_END
  285. // NOTE: Example:
  286. //       pt_ret_t thread(pt_t &pt);
  287. //       void main(){
  288. //          pt_t pt;
  289. //          PT_INIT(pt);
  290. //          while(PT_SCHEDULE(thread(pt)));
  291. //          while(TRUE);
  292. //       }
  293. ///////////////////////////////////////////////////////////////////////////////
  294. #define PT_SCHEDULE(thread) ((thread) < PT_EXITED)

  295. ///////////////////////////////////////////////////////////////////////////////
  296. // NAME: PT_WAIT_THREAD
  297. // DESC: Calls a child thread from a protothread function and waits until
  298. //       the child thread ends.  Must call PT_INIT() on child prior to calling
  299. //       thread.
  300. // IN:   pt - parent protothread control structure
  301. //       thread - protothread to call
  302. // OUT:  NONE
  303. // NOTE: Example:
  304. //       pt_ret_t childThread(pt_t &pt);
  305. //       int g_variable = 0;
  306. //       pt_ret_t thread(pt_t &pt){
  307. //          pt_t child;
  308. //          PT_BEGIN(pt);
  309. //          PT_WAIT_UNTIL(0 != g_variable);
  310. //          //do stuff here
  311. //          PT_INIT(child);
  312. //          PT_WAIT_THREAD(pt,childThread(child));
  313. //          PT_END(pt);
  314. //       }
  315. ///////////////////////////////////////////////////////////////////////////////
  316. #define PT_WAIT_THREAD(pt, thread)  PT_WAIT_WHILE(pt,PT_SCHEDULE(thread))


  317. ///////////////////////////////////////////////////////////////////////////////
  318. // NAME: PT_SPAWN
  319. // DESC: Initializes a child thread context structure, calls the child
  320. //       thread from a protothread function,  and waits until the child thread
  321. //       ends.
  322. // IN:   pt - parent protothread control structure
  323. //       child - child protothread control structure
  324. //       thread - protothread to call
  325. // OUT:  NONE
  326. // NOTE: Example:
  327. //       pt_ret_t childThread(pt_t &pt);
  328. //       int g_variable = 0;
  329. //       pt_ret_t thread(pt_t &pt){
  330. //          pt_t child;
  331. //          PT_BEGIN(pt);
  332. //          PT_WAIT_UNTIL(0 != g_variable);
  333. //          //do stuff here
  334. //          PT_SPAWN(pt,child,childThread(child));
  335. //          PT_END(pt);
  336. //       }
  337. ///////////////////////////////////////////////////////////////////////////////
  338. #define PT_SPAWN(pt, child, thread) PT_INIT(child); PT_WAIT_THREAD(pt,thread)


  339. ///////////////////////////////////////////////////////////////////////////////
  340. //***************** Semiphore Interface *************************************//
  341. ///////////////////////////////////////////////////////////////////////////////

  342. //Variable typedefs
  343. typedef struct{
  344.    unsigned int16 count;
  345. } pt_sem_t;

  346. ///////////////////////////////////////////////////////////////////////////////
  347. // NAME: PT_SEM_INIT
  348. // DESC: Initializes the a semiphore for a protothread.
  349. // IN:   s - protothread semiphore structure
  350. //       c - initial count
  351. // OUT:  NONE
  352. // NOTE: Example:
  353. //       pt_ret_t thread(pt_t &pt, pt_sem_t &sem);
  354. //       void main(){
  355. //          pt_t pt;
  356. //          pt_sem_t sem;
  357. //          PT_INIT(pt);
  358. //          PT_SEM_INIT(sem,0);
  359. //          while(TRUE){PT_SCHEDULE(thread(pt,sem));}
  360. //       }
  361. ///////////////////////////////////////////////////////////////////////////////
  362. #define PT_SEM_INIT(s, c) PT_STRUCT_ELEM(s,count) = c

  363. ///////////////////////////////////////////////////////////////////////////////
  364. // NAME: PT_SEM_WAIT
  365. // DESC: Forces the current thread to block until the semiphore has a non
  366. //       zero count.  Decrements the count afterwards.
  367. // IN:   pt - protothread control structure
  368. //       s - protothread semiphore structure
  369. // OUT:  NONE
  370. // NOTE: Example:
  371. //       pt_ret_t thread(pt_t &pt, pt_sem_t &sem){
  372. //          PT_BEGIN(pt);
  373. //          PT_SEM_WAIT(pt,sem);
  374. //          //consume something
  375. //          PT_END(pt);
  376. //       }
  377. ///////////////////////////////////////////////////////////////////////////////
  378. #define PT_SEM_WAIT(pt, s)              \
  379.    PT_WAIT_UNTIL(pt, PT_STRUCT_ELEM(s,count) > 0);  \
  380.    --(PT_STRUCT_ELEM(s,count))

  381. ///////////////////////////////////////////////////////////////////////////////
  382. // NAME: PT_SEM_SIGNAL
  383. // DESC: Increments the semiphore count.
  384. // IN:   pt - protothread control structure
  385. //       s - protothread semiphore structure
  386. // OUT:  NONE
  387. // NOTE: Example:
  388. //       int g_variable = 0;
  389. //       pt_ret_t thread(pt_t &pt, pt_sem_t &sem){
  390. //          PT_BEGIN(pt);
  391. //          while(0 == g_variable){
  392. //             //produce some stuff
  393. //          }
  394. //          PT_SEM_SIGNAL(pt,sem);
  395. //          PT_END(pt);
  396. //       }
  397. ///////////////////////////////////////////////////////////////////////////////
  398. #define PT_SEM_SIGNAL(pt, s)  ++(PT_STRUCT_ELEM(s,count))



  399. /*
  400. Copyright (c) 2004-2005, Swedish Institute of Computer Science.
  401. All rights reserved.

  402. Redistribution and use in source and binary forms, with or without
  403. modification, are permitted provided that the following conditions
  404. are met:
  405. 1. Redistributions of source code must retain the above copyright
  406. notice, this list of conditions and the following disclaimer.
  407. 2. Redistributions in binary form must reproduce the above copyright
  408. notice, this list of conditions and the following disclaimer in the
  409. documentation and/or other materials provided with the distribution.
  410. 3. Neither the name of the Institute nor the names of its contributors
  411. may be used to endorse or promote products derived from this software
  412. without specific prior written permission.

  413. THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS `AS IS' AND
  414. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  415. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  416. ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
  417. FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  418. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  419. OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  420. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  421. LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  422. OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  423. SUCH DAMAGE.

  424. Author: Adam Dunkels
  425. */

  426. #list
  427. #endif
复制代码

出0入0汤圆

发表于 2018-8-12 17:47:54 | 显示全部楼层
pic_flash 发表于 2018-8-9 18:44
我个人没有用过, 但是有人移值到CCS C, 没有后续的跟进, 有没有问题不知道, 根据移植的作者说,CCS C ...

谢谢 pic_flash 。

我写的程序结构不好,改着改着就成了意大利面了。

出0入0汤圆

发表于 2018-9-1 21:55:59 | 显示全部楼层
ccs是不是不需要MPLAB了,可以独立运行编辑?

出0入0汤圆

发表于 2018-9-1 23:48:04 | 显示全部楼层
pic_flash 发表于 2018-8-9 18:44
我个人没有用过, 但是有人移值到CCS C, 没有后续的跟进, 有没有问题不知道, 根据移植的作者说,CCS C ...

麻烦更新一下PCWHD_V5.080

出0入0汤圆

 楼主| 发表于 2018-9-2 13:22:39 | 显示全部楼层
lsy5110 发表于 2018-9-1 21:55
ccs是不是不需要MPLAB了,可以独立运行编辑?

是的。。他有自己的IDE, 直接编译。
我没有用MPLAB, 除了需要使用PICKIT3 来烧录时,才用MPLAB IPE 做烧录而已 。

出0入0汤圆

 楼主| 发表于 2018-9-2 15:02:45 | 显示全部楼层
1328616904 发表于 2018-9-1 23:48
麻烦更新一下PCWHD_V5.080

PIC 编译器, CCS C
版本: PCWHD_V5.080  (PIC 编译器)
链接:https://pan.baidu.com/s/1mY3kjAyl-w4T1fYaG3SAMg
密码:y3bi


5.080  A problem with memcpy() throwing an error under Linux is fixed
5.080  A bug involving passing arrays to an inline function for some chips is fixed
5.080  A problem with some fields with a indirect type inside a const struct throwing an error is fixed
5.080  A linker error finding files when an output directory is used is fixed
5.080  Fixed issue with assigning output pins with #pin_select and pin_select() function on some PCD devices
5.080  A bug in make32 for PCD parts when assigned using an indirect address is fixed

出0入0汤圆

发表于 2018-9-2 16:56:29 | 显示全部楼层
pic_flash 发表于 2018-9-2 13:22
是的。。他有自己的IDE, 直接编译。
我没有用MPLAB, 除了需要使用PICKIT3 来烧录时,才用MPLAB IPE 做 ...

谢谢,没用过PIC,有时间玩玩。

出0入0汤圆

 楼主| 发表于 2018-9-2 19:22:29 | 显示全部楼层
lsy5110 发表于 2018-9-2 16:56
谢谢,没用过PIC,有时间玩玩。

PIC很贵, 所以比较少人用吧, 但是他的性能不错。

出0入0汤圆

发表于 2018-9-2 19:55:51 | 显示全部楼层
pic_flash 发表于 2018-9-2 19:22
PIC很贵, 所以比较少人用吧, 但是他的性能不错。

pic kit2可以在线带电下载程序吗?

出0入0汤圆

发表于 2018-9-2 20:11:44 | 显示全部楼层
pic_flash 发表于 2018-9-2 19:22
PIC很贵, 所以比较少人用吧, 但是他的性能不错。

以前都是弄51,AVR,AVR也很好用的。

出0入0汤圆

 楼主| 发表于 2018-9-3 11:00:13 | 显示全部楼层
lsy5110 发表于 2018-9-2 19:55
pic kit2可以在线带电下载程序吗?

可以, ICSP, 你可以由PICKIT2供电, 或者你的板自上电。

但是注意,PICkit2不支持最新的PIC芯片, 我平时是用pickit2, 需要时才用pickit3.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

 楼主| 发表于 2018-9-3 11:02:46 | 显示全部楼层
lsy5110 发表于 2018-9-2 20:11
以前都是弄51,AVR,AVR也很好用的。

有时你习惯了 就这样用下去吧 , 不需要改了。。因为每个人顺手顺心的芯片最好用。

出0入0汤圆

发表于 2018-9-3 11:21:17 | 显示全部楼层
pic_flash 发表于 2018-9-3 11:02
有时你习惯了 就这样用下去吧 , 不需要改了。。因为每个人顺手顺心的芯片最好用。 ...

楼主更新软件挺快的嘛,谢谢!

出0入0汤圆

发表于 2018-9-3 19:41:08 | 显示全部楼层
pic_flash 发表于 2018-9-3 11:00
可以, ICSP, 你可以由PICKIT2供电, 或者你的板自上电。

但是注意,PICkit2不支持最新的PIC芯片, 我 ...

谢谢,业余爱好,没啥太多要求。

出0入0汤圆

发表于 2018-9-4 11:50:43 | 显示全部楼层
LZ威武!!!

出0入0汤圆

发表于 2018-9-11 13:54:33 | 显示全部楼层
pic_flash 发表于 2018-9-3 11:00
可以, ICSP, 你可以由PICKIT2供电, 或者你的板自上电。

但是注意,PICkit2不支持最新的PIC芯片, 我 ...

楼主请问怎么用CCS调试PIC的,还有如何调用ICD2调试,手上只有ICD2和PICkit3,但是测试发现都无法工作,以前一直都是用8点几版本调试pic,可惜老版本不支持新的mcu

出0入0汤圆

 楼主| 发表于 2018-9-12 14:38:28 | 显示全部楼层
1328616904 发表于 2018-9-11 13:54
楼主请问怎么用CCS调试PIC的,还有如何调用ICD2调试,手上只有ICD2和PICkit3,但是测试发现都无法工作, ...

我没有用debugger
我是用Proteus 模拟调试的。

出0入0汤圆

发表于 2018-9-12 22:10:19 | 显示全部楼层
pic_flash 发表于 2018-9-12 14:38
我没有用debugger
我是用Proteus 模拟调试的。

有教程吗?如何操作

出0入0汤圆

 楼主| 发表于 2018-9-12 22:23:28 | 显示全部楼层
1328616904 发表于 2018-9-12 22:10
有教程吗?如何操作

Proteus 本坛可以找到
教程网上搜一搜就有。。

出0入0汤圆

发表于 2018-9-17 18:24:11 | 显示全部楼层
本帖最后由 1328616904 于 2018-9-17 18:25 编辑
pic_flash 发表于 2018-9-12 22:23
Proteus 本坛可以找到
教程网上搜一搜就有。。


已经可以了,但是怎么仿真不支持浮点数显示,你的可以吗?还有默认创建的源码无法工作,必须用CCS编译器单独创建一个项目加载进去才行

出0入0汤圆

 楼主| 发表于 2018-9-18 21:58:37 | 显示全部楼层
1328616904 发表于 2018-9-17 18:24
已经可以了,但是怎么仿真不支持浮点数显示,你的可以吗?还有默认创建的源码无法工作,必须用CCS编译器 ...

你是指debug value 显示不到float?是的 , 我的也不能显示。
尽量少用float, 耗内存的很。。

初次使用Proteus, 有没有被他惊艳到?

出0入0汤圆

发表于 2018-9-18 23:32:47 | 显示全部楼层
本帖最后由 1328616904 于 2018-9-18 23:34 编辑
pic_flash 发表于 2018-9-18 21:58
你是指debug value 显示不到float?是的 , 我的也不能显示。
尽量少用float, 耗内存的很。。


嗯,是的,不用float怎么计算电压范围,放大倍数吗?很多年前只用是protues跑程序,不知道可以调试,而且不能用int1定义变量,不认识的类型,是不是调试的时候不用这个,实际产品用这个操作

出0入0汤圆

发表于 2018-9-20 08:36:34 | 显示全部楼层
本帖最后由 1328616904 于 2018-9-20 08:37 编辑
pic_flash 发表于 2018-9-18 21:58
你是指debug value 显示不到float?是的 , 我的也不能显示。
尽量少用float, 耗内存的很。。


还发现一个问题,怎么计算小数位保留存在不对呀,我取消浮点数,放大一百倍,需要计算的时候用小数位运算才可以保留两位有效小数位,对于数据运算PIC CCS有啥特别吗

出0入0汤圆

发表于 2018-9-20 16:28:50 | 显示全部楼层
pic_flash 发表于 2018-9-18 21:58
你是指debug value 显示不到float?是的 , 我的也不能显示。
尽量少用float, 耗内存的很。。

为啥PIC12F1572 DAC无法输出3.3V

出0入0汤圆

 楼主| 发表于 2018-9-22 17:51:55 | 显示全部楼层
1328616904 发表于 2018-9-20 08:36
还发现一个问题,怎么计算小数位保留存在不对呀,我取消浮点数,放大一百倍,需要计算的时候用小数位运算 ...

看看你的代码

出0入0汤圆

发表于 2018-9-22 21:32:31 | 显示全部楼层
本帖最后由 1328616904 于 2018-9-22 21:42 编辑


#include <12F1572.h>
#device ADC=10

#fuses INTRC_IO                 //I/O function on OSC2
#fuses NOWDT                    //No Watch dog
#fuses NOPUT                    //No Power Up Timer
#fuses NOMCLR                   //Master Clear pin disabled
#fuses NOPROTECT                //Code not protected from reading
#fuses NOBROWNOUT               //No brownout reset
#fuses NOCLKOUT                 //No clkout reset
#fuses NOWRT                    //Program memory not write protected
#fuses STVREN                   //Stack full/underflow will cause reset
#fuses BORV19                   //Brownout reset at 1.9V
#fuses NOLPBOR                  //Low-Power Brownout reset is disabled
#fuses NODEBUG                  //DEBUG is disabled
#fuses NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O

#use delay(internal=16MHz)
#use FIXED_IO( A_outputs=PIN_A5 )
#define GP0_MOSOUT PIN_A5

void main()
{
        unsigned int16 ADCResult[3];
        unsigned int8 dac_value, dac_value_backup;

        setup_adc_ports(sAN1 | sAN2 | sAN3, VSS_VDD);
        setup_adc(ADC_CLOCK_INTERNAL);
        setup_dac(DAC_VDD | DAC_OUTPUT);
//   setup_vref(VREF_ON | VREF_COMP_DAC_4v096);
//   setup_dac(DAC_FVR | DAC_OUTPUT);

        setup_timer_0(RTCC_INTERNAL | RTCC_DIV_16 | RTCC_8_BIT); //1.0 ms overflow
        enable_interrupts(INT_TIMER0);
        enable_interrupts(GLOBAL);
        while(TRUE)
        {
                set_adc_channel(1);
                delay_us(20);
                ADCResult[0] = read_adc();
                set_adc_channel(2);
                delay_us(20);
                ADCResult[1] = read_adc();
                set_adc_channel(3);
                delay_us(20);
                ADCResult[2] = read_adc();
                v6_voltage = (float)ADCResult[0] * (5.0 / 1023);
                v5_voltage = (float)ADCResult[1] * (5.0 / 1023);
                v3_voltage = (float)ADCResult[2] * (5.0 / 1023);
               dac_value = 3.3 * 31 / 5.0;
              dac_write(dac_value);
}
当dac_value = 3.3 * 31 / 5.0;时 DAC输出只有2.36V,还有中断中判断v3_voltage<1.5的数据就会出现这个问题>>> Warning 216 "dc400w.c" Line 286(1,2): Interrupts disabled during call to prevent re-entrancy:  (@FLT)
,不知道啥原因

出0入0汤圆

 楼主| 发表于 2018-9-23 13:10:24 | 显示全部楼层
当dac_value = 3.3 * 31 / 5.0;时 DAC输出只有2.36V

你有驱动什么负载吗?

,还有中断中判断v3_voltage<1.5的数据就会出现这个问题>>> Warning 216 "dc400w.c" Line 286(1,2): Interrupts disabled during call to prevent re-entrancy:  (@FLT)
,不知道啥原因

感觉是代码问题, 中断里面又呼叫中断

出0入0汤圆

发表于 2018-10-29 12:44:26 | 显示全部楼层
来看看楼主。

出0入0汤圆

发表于 2018-12-18 23:32:23 | 显示全部楼层
来看看楼主。

出0入0汤圆

 楼主| 发表于 2018-12-24 17:24:07 | 显示全部楼层
PIC 编译器, CCS C
版本: PCWHD_V5.081  (PIC 编译器)
链接:https://pan.baidu.com/s/1TOPnI4auDscWi26n4R5VVQ
密码:li8x

出0入0汤圆

发表于 2018-12-28 14:11:56 | 显示全部楼层
谢谢分享!!!

出0入0汤圆

发表于 2019-2-22 08:17:40 | 显示全部楼层
来看看楼主。

出0入0汤圆

发表于 2019-3-13 19:21:58 | 显示全部楼层
CCS新手请教!
请楼主和坛友帮个忙!
问题在代码中的中文注释里。
附上RS232调试图片。

#include <RS232.h>

void RS232_RX_EN();
void RS232_TX_EN();
void RS232_ON();

void main()
{
   char key_buffer[20];
   RS232_ON();
   while(TRUE)
   {
   RS232_TX_EN();
   cout<<"please press any key,and then enter!\r\n";
   delay_ms(2);
   RS232_RX_EN();
   cin>>key_buffer; //首次运行到这里,key_buffer[0]里面多出一个空格,
                            //第二次开始就没有出现这个空格了。
                            //把cin换成gets(),也是一样!
   delay_ms(2);
   RS232_TX_EN();
   cout<<key_buffer<<"\r\n";
   delay_ms(2);
   }
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

 楼主| 发表于 2019-3-13 21:42:22 | 显示全部楼层
CCS C 一般不会这样写。。你的源码从那里转过来的?

  1. #include <RS232.h>
  2. void RS232_RX_EN();
  3. void RS232_TX_EN();
  4. void RS232_ON();
复制代码

上面的源码没有放出, 看不到问题在那里。

出0入0汤圆

发表于 2019-3-14 00:34:39 | 显示全部楼层
这是使能485/232芯片模式和使能芯片发送/接收,
由于硬件设计上的问题,不能实现RS232双工模式。
上次说的问题关键在于,上电后,第一次cin就会多一个空格,
之后就没事了。如果断电后,再运行,也是第一次cin多出一个空格。
编译器是你上传的5.080版本。

void RS232_RX_EN()
{
      output_low(DEN);            //Tx is disenabled
      output_low(RXEN_L);       //Rx is enabled
      output_high(RXEN_H);     //Rx is enabled
      delay_ms(1);
}

void RS232_TX_EN()
{
      output_high(RXEN_L);       //Rx is disenabled
      output_low(RXEN_H);       //Rx is disenabled
      output_high(DEN);          //Tx is enabled
      delay_ms(1);
}


void RS232_ON()
{
      output_low(Select485_232);  //RS232 mode
      output_high(ON);                //enables the charge pumps
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

 楼主| 发表于 2019-3-14 09:34:36 | 显示全部楼层
jojo_ou 发表于 2019-3-14 00:34
这是使能485/232芯片模式和使能芯片发送/接收,
由于硬件设计上的问题,不能实现RS232双工模式。
上次说的 ...

我没有用过 C++ 的语法在 CCS C 里, 你是第一个我看到的。。
<RS232.h>  这个可以看看吗?

如果可以, 你上传完整的源码, 我可以用proteus 模拟测试

其实对于RS485 通信,CCS C 有很简单的方法。 因为你只是发部分源码, 我看不到你有没有使用。

出0入0汤圆

发表于 2019-3-14 20:44:45 | 显示全部楼层
仅仅是做简单的测试代码,不是工程文档。
附上测试代码原档。
另外再请教个关于在CCS IDE下如何使用PICKIT3对类似于DSPIC30F6014A有引导保护段功能进行调试和下载的问题。
目前可以在CCS IDE下使用PICKIT3对DSPIC33EP的进行调试和下载,但对DSPIC30F6014A不行。是否有这类资料推荐。
另外对于两款proteus好像没有库,该怎么弄。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

 楼主| 发表于 2019-3-15 09:56:13 | 显示全部楼层
jojo_ou 发表于 2019-3-14 20:44
仅仅是做简单的测试代码,不是工程文档。
附上测试代码原档。
另外再请教个关于在CCS IDE下如何使用PICKIT3 ...

我只是猜测:
开始有空格, 很可能是你的ISL41387 上电后产生的一个乱码。。
   RS232_ON();
   RS232_RX_EN();
过后芯片稳定了。。但是dsPIC 也接收了1个byte
下面源码对Key_buffer 预设已知的/0
再清除USART_Port1的硬件缓存。
请试试看。。

  1. void main()
  2. {

  3.    unsigned int8 x;
  4.    char key_buffer[20];
  5.    RS232_ON();
  6.    RS232_RX_EN();

  7.    for(x=0;x<20;x++)
  8.    {
  9.       key_buffer[x]=0; //init key buffer
  10.    }

  11.    delay_ms(50);/ / 初始,让系统稳定
  12.    while (kbhit(UART_PORT1))
  13.    {
  14.        x=fgetc(UART_PORT1); //把Port1 的buffer 先清除
  15.    }
  16.    
  17.    while(TRUE)
  18.    {
  19.    RS232_TX_EN();
  20.    fputs("please press any key,and then enter!",UART_PORT1);
  21.    delay_ms(2);
  22.    RS232_RX_EN();
  23.    fgets(key_buffer,UART_PORT1); //首次运行到这里,key_buffer[0]里面多出一个空格
  24.                     //第二次开就没有出现了
  25.    delay_ms(2);
  26.    RS232_TX_EN();
  27.    fputs(key_buffer,UART_PORT1);
  28.    delay_ms(2);
  29.    }

  30. }
复制代码

出0入0汤圆

 楼主| 发表于 2019-3-15 10:42:45 | 显示全部楼层
另外再请教个关于在CCS IDE下如何使用PICKIT3对类似于DSPIC30F6014A有引导保护段功能进行调试和下载的问题。
目前可以在CCS IDE下使用PICKIT3对DSPIC33EP的进行调试和下载,但对DSPIC30F6014A不行。是否有这类资料推荐。

抱歉,这个我没有弄过。。可能以后你解决了可以和大家分享。

另外对于两款proteus好像没有库,该怎么弄。

没办法, 目前proteus里面dsPIC 的库很老旧的
  
如果我只是简单测试模拟, 我会找接脚相近的PIC24 来替代。。。

比如:


  1. //#define Proteus
  2. #ifdef Proteus
  3.    #include <24FJ64GA006.h>
  4.    #FUSES WDT, HS,PROTECT
  5.    #use delay(internal=8MHz, clock=8MHz, restart_wdt)
  6.    #use rs232(UART1, baud=19200, stream=UART_PORT1, ENABLE=pin_F6, errors)
  7. #else
  8.    // dsPIC
  9.    #include <33FJ64GS606.h>
  10.    #use delay(clock=100MHz,crystal=10MHz, restart_wdt)
  11.    #FUSES HS, NOWDT, PROTECT, CKSFSM, NOJTAG
  12.    #use rs232(UART1, baud=256000, stream=UART_PORT1, ENABLE=pin_F6, errors)
  13. #EndIF
复制代码


出0入0汤圆

发表于 2019-3-15 13:07:18 | 显示全部楼层
感谢楼主!
15.   while (kbhit(UART_PORT1))

16.   {

17.       x=fgetc(UART_PORT1); //把Port1 的buffer 先清除

18.   }

这一步解决了问题!

出0入0汤圆

发表于 2019-3-15 19:38:30 | 显示全部楼层
楼主:请问这个CCS编译器是不是不严谨?
void main()
{

unsigned int a;
unsigned int8 b;
unsigned int16 c;
unsigned int32 d;
a=-5;
b=-6;
c=-7;

d=a+b+c;
}
像上面的代码,无符号变量赋值负数,编译竟然无任何警告!
0 Errors,  0 Warnings.

出0入0汤圆

 楼主| 发表于 2019-3-16 14:38:48 | 显示全部楼层
jojo_ou 发表于 2019-3-15 19:38
楼主:请问这个CCS编译器是不是不严谨?
void main()
{

或许吧。。

出0入0汤圆

发表于 2019-3-21 19:56:17 | 显示全部楼层

楼主,有没有CCS编写的点阵LCD128*64的ST7565的串行SPI驱动和240*160的UT1698或ST7565的SPI驱动源码推荐下载?

出0入0汤圆

发表于 2019-3-21 20:08:52 | 显示全部楼层
多年前用PIC单片机时就用CCS编译器,它容易上手但Bug多,现PIC价格贵,抗干扰不行,弃用好几年了

出0入0汤圆

 楼主| 发表于 2019-3-24 15:22:01 | 显示全部楼层
jojo_ou 发表于 2019-3-21 19:56
楼主,有没有CCS编写的点阵LCD128*64的ST7565的串行SPI驱动和240*160的UT1698或ST7565的SPI驱动源码推荐 ...

在sample, driver 的文件夹理有。

出0入0汤圆

 楼主| 发表于 2019-3-24 15:23:14 | 显示全部楼层
szdy 发表于 2019-3-21 20:08
多年前用PIC单片机时就用CCS编译器,它容易上手但Bug多,现PIC价格贵,抗干扰不行,弃用好几年了 ...

请问是哪个型号的PIC 抗干扰不行?

出0入0汤圆

发表于 2019-3-24 18:38:52 | 显示全部楼层
PIC抗干扰是强项,怎么会不行?

出0入0汤圆

发表于 2019-3-26 22:02:03 | 显示全部楼层
楼主,有没有DSPIC33系列的CCS资料或书籍推荐

出0入0汤圆

发表于 2019-3-27 08:59:00 | 显示全部楼层
想楼主了,来看看

出0入0汤圆

发表于 2019-3-27 09:10:39 来自手机 | 显示全部楼层
本帖最后由 njhying 于 2019-3-27 09:13 编辑
szdy 发表于 2019-3-21 20:08
多年前用PIC单片机时就用CCS编译器,它容易上手但Bug多,现PIC价格贵,抗干扰不行,弃用好几年了 ...


刚入门的可以理解,老鸟说抗干扰不行,是不是已经转做管理了?
现在国产芯片响声震天,可是芯片垃圾的和新能源车一样一样的,重新回归国外芯片。

出0入0汤圆

发表于 2019-3-30 17:12:50 | 显示全部楼层
njhying 发表于 2019-3-27 09:10
刚入门的可以理解,老鸟说抗干扰不行,是不是已经转做管理了?
现在国产芯片响声震天,可是芯片垃圾的和 ...

楼主,CCS有没有自带的LCD GUI?求推荐

出0入0汤圆

发表于 2019-3-30 23:11:54 | 显示全部楼层
楼主, 我发现Pic写EEPROM 经常有数据没保存的情况。。
w'rite——eeprom

出0入0汤圆

 楼主| 发表于 2019-4-2 15:04:51 | 显示全部楼层
sweet_136 发表于 2019-3-30 23:11
楼主, 我发现Pic写EEPROM 经常有数据没保存的情况。。
w'rite——eeprom

我没有碰过这种问题,但是你可以试验看看:
在 write_eeprom 之前, 加入 interrupt_global (disable);关闭中断, 写好后再开回中断。

看看是不是中断引起写入失败。

出0入0汤圆

 楼主| 发表于 2019-4-2 15:11:30 | 显示全部楼层
jojo_ou 发表于 2019-3-30 17:12
楼主,CCS有没有自带的LCD GUI?求推荐

没有自带的。。可以自己找第三方的然后移值过去。
我知道Microchip 官方是有, 好像是给PIC32 的

目前 , 我开始使用 HMI USART 模块了, 省事很多。。而且非常强大。

出0入0汤圆

发表于 2019-4-2 23:03:23 | 显示全部楼层
pic_flash 发表于 2019-4-2 15:11
没有自带的。。可以自己找第三方的然后移值过去。
我知道Microchip 官方是有, 好像是给PIC32 的

那是PIC CCS里面的模块吗?

出0入0汤圆

 楼主| 发表于 2019-4-4 10:28:26 | 显示全部楼层
sweet_136 发表于 2019-4-2 23:03
那是PIC CCS里面的模块吗?

不是的。。。。。

出0入0汤圆

发表于 2019-4-14 15:41:29 | 显示全部楼层
pic_flash 发表于 2019-4-4 10:28
不是的。。。。。

楼主,是否有关于gfx_graphics.c gfx_graphics.h的说明或相关的学习资料介绍?

出0入0汤圆

 楼主| 发表于 2019-4-18 11:05:17 | 显示全部楼层
jojo_ou 发表于 2019-4-14 15:41
楼主,是否有关于gfx_graphics.c gfx_graphics.h的说明或相关的学习资料介绍?

我没有。。如果你找到了, 可以分享一下

出0入0汤圆

发表于 2019-4-21 23:52:20 | 显示全部楼层
pic_flash 发表于 2019-4-18 11:05
我没有。。如果你找到了, 可以分享一下

楼主,帮我看看我的工程编译时,为什么结构体成员会出错,跪谢。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

发表于 2019-4-22 22:50:20 | 显示全部楼层
楼主,在线等。QQ我,46125279

出0入0汤圆

 楼主| 发表于 2019-4-23 09:14:20 | 显示全部楼层
jojo_ou 发表于 2019-4-21 23:52
楼主,帮我看看我的工程编译时,为什么结构体成员会出错,跪谢。


编译了, 没有看到什么报错。。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

 楼主| 发表于 2019-4-23 09:17:41 | 显示全部楼层


Did you hear the news? The CCS C Compiler now supports the dsPIC33CH family of devices! The dsPIC33CH family are the first dual core PICs available from Microchip, which allows the user to run two independent programs on the same device!
Keep an eye out for news stories on our website about the new features!

CCS 宣布他家的编译器已支持双核的dsPIC33CH !

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

发表于 2019-4-23 11:05:11 | 显示全部楼层
pic_flash 发表于 2019-4-23 09:14
编译了, 没有看到什么报错。。

在BSP_key.c里的结构体调用时有提示。理论上应该没问题,我是完全移植STM32的过来的。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

发表于 2019-4-25 20:55:27 | 显示全部楼层
jojo_ou 发表于 2019-4-23 11:05
在BSP_key.c里的结构体调用时有提示。理论上应该没问题,我是完全移植STM32的过来的。
...

楼主,为什么我编译的出这种提示呢?

出0入0汤圆

 楼主| 发表于 2019-4-26 15:18:56 | 显示全部楼层
jojo_ou 发表于 2019-4-25 20:55
楼主,为什么我编译的出这种提示呢?

不知道。。不过请注意, CCS C 不支持指针 pointer。

出0入0汤圆

发表于 2019-5-19 17:09:55 | 显示全部楼层
pic_flash 发表于 2019-4-26 15:18
不知道。。不过请注意, CCS C 不支持指针 pointer。

群主,可以上传最新版的CCS了,在线等。。。。

出0入0汤圆

 楼主| 发表于 2019-5-19 17:57:46 | 显示全部楼层
jojo_ou 发表于 2019-5-19 17:09
群主,可以上传最新版的CCS了,在线等。。。。

最新是 5.085 , 但我没有。。。
努力上传5.083中。。云盘很慢

出0入0汤圆

发表于 2019-5-19 20:44:14 | 显示全部楼层
pic_flash 发表于 2019-5-19 17:57
最新是 5.085 , 但我没有。。。
努力上传5.083中。。云盘很慢

非常感谢楼主更新!

出0入0汤圆

 楼主| 发表于 2019-5-19 20:58:16 | 显示全部楼层
PIC 编译器, CCS C
版本: PCWHD_V5.083  (PIC 编译器)
链接:https://pan.baidu.com/s/1FsdVZzI_EbDxFTrT0HBOmA
提取码:8npq

出0入0汤圆

发表于 2019-5-20 09:22:00 | 显示全部楼层
pic_flash 发表于 2019-5-19 20:58
PIC 编译器, CCS C
版本: PCWHD_V5.083  (PIC 编译器)
链接:https://pan.baidu.com/s/1FsdVZzI_EbDxFTr ...

楼主,请问有没有关于CCS自带MODBUS.C使用方法和说明的资料推荐?

出0入0汤圆

发表于 2019-5-20 11:35:53 | 显示全部楼层
pic_flash 发表于 2019-5-19 20:58
PIC 编译器, CCS C
版本: PCWHD_V5.083  (PIC 编译器)
链接:https://pan.baidu.com/s/1FsdVZzI_EbDxFTr ...

楼主,请教一下,在led.h中声明led.c中的函数,然后#include <led.h>,在main中调用led.h中声明的函数,编译不能通过。
如果用#include <led.c>,刚可以通过。请问这是啥原因
编译出错提示:
Compiling E:\hex\test_ccs\test\test1\main on 20-五月-19 at 11:33
*** Error 112 "E:\hex\test_ccs\test\test1\main.c" Line 10(1,1): Function used but not defined:  ... led_flash 1453  SCR=1949
      1 Errors,  0 Warnings.
Build Failed.
源文件如下:
/////////////////////////////////////
《main.c文件》
#include <main.h>
#include <led.h>
void main()
{
   //Example blinking LED program
   while(true)
   {
led_flash();
   }
}
/////////////////////////////////////
《main.h文件》
#include <33EP512MU814.h>
#device ICSP=1
#use delay(clock=140MHz,crystal=20MHz)
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES CKSFSM                   //Clock Switching is enabled, fail Safe clock monitor is enabled
#define LED PIN_B2
#define DELAY 1000
/////////////////////////////////////
《led.c文件》
#include <led.h>
void led_flash()
   {
      output_low(LED);
      delay_ms(DELAY);
      output_high(LED);
      delay_ms(DELAY);
   }
/////////////////////////////////////
《led.h文件》
#ifndef _LED_H_
#define _LED_H_
extern void led_flash();
#endif

出0入0汤圆

 楼主| 发表于 2019-5-20 12:25:31 | 显示全部楼层
试试:

  1. /////////////////////////////////////
  2. 《main.c文件》
  3. #include <main.h>
  4. #include <led.h>
  5. #include <led.c>
  6. void main()
  7. {
  8.    //Example blinking LED program
  9.    while(true)
  10.    {
  11. led_flash();
  12.    }
  13. }
复制代码

出0入0汤圆

 楼主| 发表于 2019-5-20 12:26:52 | 显示全部楼层
jojo_ou 发表于 2019-5-20 09:22
楼主,请问有没有关于CCS自带MODBUS.C使用方法和说明的资料推荐?

没有哦。。。

出0入0汤圆

发表于 2019-6-3 22:11:44 | 显示全部楼层

群主,请教一下CCS C在条件编译时,没有被编译的能不能改变他颜色?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

 楼主| 发表于 2019-6-4 08:48:46 | 显示全部楼层
jojo_ou 发表于 2019-6-3 22:11
群主,请教一下CCS C在条件编译时,没有被编译的能不能改变他颜色?

这个难倒我了, 我都是用默认的颜色, 没有去改过。
好像上面你那种, 我一般会按 【-】把他们“收”起来不看呢。。

出0入0汤圆

发表于 2019-6-4 16:43:49 | 显示全部楼层
pic_flash 发表于 2019-6-4 08:48
这个难倒我了, 我都是用默认的颜色, 没有去改过。
好像上面你那种, 我一般会按 【-】把他们“收”起来 ...

群主,帮研究研究,如果能改颜色的话,以后可以一劳永逸了!
等回复哦

出0入0汤圆

发表于 2019-7-10 16:38:51 | 显示全部楼层
pic_flash 发表于 2019-5-19 20:58
PIC 编译器, CCS C
版本: PCWHD_V5.083  (PIC 编译器)
链接:https://pan.baidu.com/s/1FsdVZzI_EbDxFTr ...

群主,帮忙找一下MODBUS CCS实例

出0入0汤圆

 楼主| 发表于 2019-7-11 09:41:25 | 显示全部楼层
jojo_ou 发表于 2019-7-10 16:38
群主,帮忙找一下MODBUS CCS实例

C:\Program Files (x86)\PICC\Examples\ex_modbus_master.c
C:\Program Files (x86)\PICC\Examples\ex_modbus_slave.c

出0入0汤圆

发表于 2019-8-7 08:36:33 | 显示全部楼层

出0入0汤圆

发表于 2019-8-9 15:12:12 | 显示全部楼层
CCS可以和iar配合使用吗

出0入0汤圆

 楼主| 发表于 2019-8-10 10:00:37 | 显示全部楼层
喜欢雪的人 发表于 2019-8-9 15:12
CCS可以和iar配合使用吗

应该不能。
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-7-22 23:35

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表