View previous topic :: View next topic |
Author |
Message |
aaronik19
Joined: 25 Apr 2011 Posts: 297
|
ccs parameters |
Posted: Wed Jan 09, 2013 2:45 pm |
|
|
I am in the middle of a project and now I want to add Timer0 Interrupts. In most cases I use the wizard at the beginning of the project to insert the features I would like to use. Is it possible to use the wizard to insert the Timer0 interrupts including the parameters associated to it?
Is there any interrupt I can use to send characters from PC to PIC (RS-232)? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Wed Jan 09, 2013 3:10 pm |
|
|
1) I don't use the wizard...
2) You do not use an interrupt to send data from a PC to PIC (well you could but that's a PC issue), however from the PIC 'side' you can use an interrupt to receive data from a PC.
Have a look in the examples folder for a program called 'ex_sisr.c'
hth
jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19509
|
|
Posted: Wed Jan 09, 2013 3:39 pm |
|
|
Actually you can use interrupts to send as well as receive. Much better in fact if you don't want code to have to wait for transmissions. INT_TBE. Look at ex_STISR.c (example serial transmit interrupt service routine).
Key is that you turn it on when data is waiting to be sent, and then turn it off again when data has been sent. Otherwise it'll stay permanently triggered if no more data is to be sent.
The wizard is quite dangerous, with several permanent errors (setup_spi for example), and often initialising things that already default to the same state (wasting space and time). 99% of long term programmers here prefer not to use it. Honestly better to use the standard settings from the examples, then build your own set, to do what you want.
Best Wishes |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Wed Jan 09, 2013 6:04 pm |
|
|
Quote: |
use interrupts to send as well as receive.
|
is true BUT if you are using a timer or other #int for a precise timing requirement,you should be aware that the USART send INT can preempt the timer and extend the period of the timer(or any other #INT ) on an intermittent basis that might be hard to debug- |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jan 09, 2013 6:45 pm |
|
|
His original question is really, "Can I use the CCS Wizard in mid-project,
to add a Timer0 interrupt function ? Can I add the function with the
Wizard, even though I've already typed in a lot of code ? Or, am I only
allowed to use the Wizard at the very start of a new program ?"
If someone has the CCS IDE, they could answer this question. |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1347
|
|
Posted: Wed Jan 09, 2013 8:03 pm |
|
|
I just tried it on a throwaway project of mine and it overwrote both the project file and my main c file. It doesn't appear to update but instead overwrites. That's not to say there's no way to do it, but just trying it offhand by opening an existing project didn't work well. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Wed Jan 09, 2013 11:07 pm |
|
|
Use the Wizard to create a dummy program then copy the code over. _________________ Google and Forum Search are some of your best tools!!!! |
|
|
|