|
|
View previous topic :: View next topic |
Author |
Message |
MCUprogrammer
Joined: 08 Sep 2020 Posts: 221
|
PIC16 FAST ISR |
Posted: Sat Mar 25, 2023 8:09 am |
|
|
Hi
I was writing these 2 codes while using FAST ISR on PIC18 series processors.
Code: |
#device HIGH_INTS=TRUE
#INT_TIMER2 FAST
|
So what are we doing for the PIC16 series? Because PIC16F1779 for two code I wrote. Compiler ise give error. How will I do. _________________ Best Regards...
MCUprogrammer
_______________________________
Work Hard |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19477
|
|
Posted: Sat Mar 25, 2023 8:33 am |
|
|
On the PIC16, just use #INT_GLOBAL to declare the handler. Because there
are no interrupt priorities there can only be a single handler. Understand
also, your handler has to do all register saving. Everything, include the
W register etc.. You also don't want/need HIGH_INTS=TRUE, since there
are no interrupt priorities on the PIC16.
ex_glint.c shows this. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9215 Location: Greensville,Ontario
|
|
Posted: Sat Mar 25, 2023 8:41 am |
|
|
As I understand, your PIC16 series PIC doesn't have 'high' or 'fast' capabilities, so YOU have to cut code to control what happens when interrupts occur.
Your code will execute when any interrupt occurs and then decide which ISRs will be called and in which order.
You can printout what your PIC18 program does, then use it as a template to create a similar one for your PIC16. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19477
|
|
Posted: Sun Mar 26, 2023 5:22 am |
|
|
I'm afraid this is a problem with MCUProgrammer. He seems not to realise
that a critical part of being a Micro Controller programmer, is to read the
data sheet. He has asked several questions recently, where the answers
are in the examples, the data sheet, or have been answered many times
here in the past. Preferring to ask, rather than doing a little research.
You then need to use a bit of common sense on the answers you find.
'HIGH_INTS' cannot ever apply to a chip that does not have interrupt
priorities. The FAST option requires a chip that supports priorities, and
at least a tiny ability to save some registers, that can be used to give
this speed. Understanding the limitations of the chip families is vital. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9215 Location: Greensville,Ontario
|
|
Posted: Sun Mar 26, 2023 5:49 am |
|
|
The 'real' problem is there are TOO many PICs to choose from !
Really, it seems like every other day, Microchip comes out with another neat 'must have' PIC. I've stuck with the PIC18F46K22, but gee that CLC peripheral looks nice to play with,so I get another sample of a new PIC.
What's interesting to me is that while the instruction set of PICs hasn't grown much, FUSES sure have ! and now some datasheets are almost 1000 pages long !!!!
Now if we could only talk to the PIC to program it....... |
|
|
MCUprogrammer
Joined: 08 Sep 2020 Posts: 221
|
|
Posted: Wed Mar 29, 2023 12:58 am |
|
|
Hi
@Ttelmah first of all I want you to know that I am aware of this. The problem is that a datasheet is more than 700 pages. But you are right, maybe this subject has been discussed here many times before. But before I write here, I search the page and there are many articles. Relevant and irrelevant. So what exactly is the purpose of this page? There is a problem with everything written here. I thought this site belonged to CCS C company. I guess not. But I have never encountered such things on the sites of companies such as microchip, st, microe. Everything you will look for in such sites already covers the relevant subject under the title. I really don't know how to please you. _________________ Best Regards...
MCUprogrammer
_______________________________
Work Hard |
|
|
PrinceNai
Joined: 31 Oct 2016 Posts: 471 Location: Montenegro
|
|
Posted: Wed Mar 29, 2023 4:02 am |
|
|
MCUprogrammer,
This is not a vanity forum, so you really don't have to please anyone. No, the forum doesn't belong to CCS company, as stated on top of the page. Given the address I'd say it is only hosted on their servers.
About the purpose of this forum. My impression is help and exchange of knowledge between the users of CCS products. And it is a wealth of knowledge, all 100% free. From users that invest their free time trying to help. TANSTAAFL doesn't apply here, as long as you observe very simple rules. Politeness, produce at least a drop of sweat trying to solve the problem before asking or opening a new topic. Yes, datasheets are 700 pages long. PIC's have come a long way from 16c84. But it is divided in sections, so you don't have to read it all in one night. But for sure nobody is going to read it for you.
Relevance of the info? Stick the first thing that enters your mind in Google. 2 zillions of web pages for every question, wildly contrasting. Compare that with answers here. Unfortunately there is no "one answer fits all the situations". What is irrelevant to you might have helped someone else, even if you talk about the same piece of hardware or intended use of it.
To cut it short: this is (for me, at least) by far the best forum I've ever participated in.
Regards,
Samo
Last edited by PrinceNai on Wed Mar 29, 2023 7:18 am; edited 1 time in total |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9215 Location: Greensville,Ontario
|
|
Posted: Wed Mar 29, 2023 6:43 am |
|
|
If you need a 'fast_ISR' then simply cut your own 'handler' code ! It's not that hard to do,CCS C code is 100% readable in the listing,so unlike others, NOTHING is hidden !
Historically 16 series PICs were 'simple' so no need for the fast_ISR but you can make your own, use the 18 series as a guide.It's really just a custom 'lookup table' (something PICs do very well...) that YOU decide who has priority of which ISR gets executed first,second, third,.....
This website is one of the best, with a huge variety of topics all PIC related,though it's be nice to have a 'hardware' section. Often what looks like a software issue is really a simple hardware fault.
Yes, reading hundreds of pages of technical information can be ,well, boring BUT the more you read and understand, the better the PIC programmer you become. Once you understand HOW it works, you'll see you can cut code better and faster. The nice thing about PICs is that they are a 'family' sharing a LOT of same or very similar peripherals and 'guts'. It's best to stick with ONE PIC type. Find one that satisfies 99.44% of ALL your current and future projects. This way you cut code that can be used over and over again and not have to find out the new PIC has a 'bug' or 'critical timing issue'. |
|
|
MCUprogrammer
Joined: 08 Sep 2020 Posts: 221
|
|
Posted: Wed Mar 29, 2023 12:42 pm |
|
|
@PrinceNai, I understand you very well. I also do not disparage the site. So I think it's hard to find what we're looking for. Yes, I need to spend a lot of time on the datasheet. I'm not saying anything about it. I don't think I was being rude. I also think I've worked too hard for this job. How did you come to the conclusion that I didn't spend too much time reading datasheets? Also, I don't want any ready-made code from anyone. We exchange ideas. Therefore, if I ask people for code support from here, I will find you very right. My goal is to benefit from your experience.
I don't want to prolong the topic too much. I don't want to fight or quarrel like children. we all have a purpose. We are trying to do something. Being misunderstood and rude is never my style. I'm sorry if I've been misunderstood like that.
Respects. _________________ Best Regards...
MCUprogrammer
_______________________________
Work Hard |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9215 Location: Greensville,Ontario
|
|
Posted: Wed Mar 29, 2023 12:54 pm |
|
|
re: Quote: | How did you come to the conclusion that I didn't spend too much time reading datasheets |
Probably because if you read the datasheet chapters on interrupts for both the 16 and 18 series PICs that you have, you'd see in the diagrams as well as text, that the 2 are not the same. As I said, if you do want or need fast_ISR and/or priority ISR, then you'll have to write (code) that 'handler' yourself.
The last time I wrote one was for a Z-80 project decades ago, in assembler of course. Actually PIC assembler is rather easy. Only 35 instructions+-, far less than the number of FUSES for a modern PIC ! |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|