IOC on the 27k40


+ Reply to Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    808

    Default IOC on the 27k40

    Hi guys

    The IOC options on this chip are very good , with both neg/ pos trig selection on most of the ports

    The dt_int18-34c currently does not appear the clear IOCxF bits after being trigger even if the flagreset is set
    Code:
    ASM
    INT_LIST macro; IntSource,  Label     , Type, ResetFlag?
        INT_Handler  IOC_INT, _Rx_mode_IOC ,  PBP, yes      ; Call Rx_mode_IOC subroutine for RF RX_mode
        
     endm
     INT_CREATE								; Creates the Interrupt Processor
    ENDASM
    also enable/disable of IOC " @ INT_DISABLE IOC_INT " ( PIE0.4 = 0) , will not stop the IOC interrupt being set on the IOCxF

    the triggered IOC port flag bit needs to be cleared after the interrupt is serviced - eg IOCxF.x = 0

    this what i found for my 27k40 silicon 0 ,

    but if i am wrong please check and correct me

    cheers

    Sheldon

  2. #2
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    323

    Default Re: IOC on the 27k40

    First, you get a PIR0.4 generic IOCIF that's read only. Second, you also get an IOCAF/IOCBF/IOCCF.PortPin flag that indicates either an IOCAN or IOCAP type flag (since you can use either). the PIR0.4 flag automatically clears when IOCxFs = 0. With that said, you can clear the flag manually in the ISR. If you got IOCAF.2 (RA2 changed state according to your IOCAP/IOCAN Registers), at the end of your ISR add IOCAF.2 = 0 (PBP3). If you are using an ASM ISR, BCF IOCAF,2.

    "16.1 Enabling the Module
    To allow individual port pins to generate an interrupt, the IOCIE bit of the PIE0 register must be set. If the IOCIE bit is disabled, the edge detection on the pin will still occur, but an interrupt will not be generated."

    That being said, we're getting more familiar with how the K40 chip & Data Sheet don't always agree. You could clear the IOCxN/P in the Register to disable IOCIE if PIE0.4 = 0 fails to work.

  3. #3
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    808

    Default Re: IOC on the 27k40

    yes your correct, in that i could have turned off the IOC port trigger in neg or Pos , which ever was set , but the main toggling the IOC enable wont work as prev k22,k80 where it will stop the IOC being registered on k40 ,

    as i am porting code from k80,k22 where the enable / disable of IOC is in many places in code , so having to ensure the IOCxF is cleared where i am disable/ enable, this stops a not required jump to the ISR to clear it , requires a bit of work

    its just another step to do on the k40, as there is no main clear of the all IOCxF registers that i can see so far except by manual clearing,
    nor a way to ensure a globle enable / disable that ensure that IOCxF wont register a change , after being setup in the IOCxN, IOCxP triggers

    only a globle IOC status if triggered in in PIR0.4 as you pointed out in

    that said with the flag set on the which IOC was triggered in each port, and if it was negative or positive , you can have a nice branch system for each IOC or group of IOC, possible in the ISR where it was not so great in the k22, k80 IOC system

    sheldon

  4. #4
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    323

    Default Re: IOC on the 27k40

    You can clear most flags from anywhere by:

    IOCAF = 0
    PIR1.5 = 0
    ...etc

    Flags for UART require reading the RC1REG to clear the flag, but they are in the exception category.

  5. #5
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    808

    Default Re: IOC on the 27k40

    hi mike ,

    has there any further updates to the int-18-k40 v3.4c


    regards

    Sheldon

  6. #6
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    323

    Default Re: IOC on the 27k40

    Sheldon, lately I've been using XC8 in MPLABX. I fell madly in love with the PIC16F18426 and have used it for a couple projects. Because it was so new that PBP3 didn't yet cover it, I forced myself to get functional with C & MPLABX. I haven't used PBP in a project in about a year now. In fact, I'm using dsPIC33's in projects now that I have the tools. I personally don't have any updates.

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,964

    Default Re: IOC on the 27k40

    Well, what is it on that chip that is special?

    You are brave enough to tame that beast called MPLABX!

    Ioannis

  8. #8
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    323

    Default Re: IOC on the 27k40

    Quote Originally Posted by Ioannis View Post
    Well, what is it on that chip that is special?
    - 12-bit ADC2
    - 4/4 Timers
    - 4 CCP & 2 PWM
    - EEPROM
    - 20-bit NCO
    - PPS
    - 4 CLC

    I've used it in a couple projects. In one, I needed many PWMs but with PPS where I could swap output pins. In another, I needed the 12-bit ADC, EEPROM, and ALL of the Timers. In another I needed the EEPROM, NCO, PPS, and CLC combo.

    In other words, I have found a couple projects where this was the only PIC 8-bit offering to include ALL of the peripherals I needed all in one package.

    Having used MPLABX for over a year now, it's like learning anything; the more you use it, the more it just becomes natural. Microchip offers online tutorials to help us learn a wide range of skills regarding their MCUs and tools at:

    http://microchipdeveloper.com/training-self:start

    I started with PICAXE and believe me, learning the necessary building blocks just to program anything was a long steep hill. After I got proficient with PICAXE I realized I was throttling myself. The PICAXE chips are just PIC chips with a boot loader. However, that limits the capabilities of the chips, and slows them down. With that said...

    I saw an ad for PBP3 Basic in Nuts & Volts Magazine. I checked it out and liked what I saw. This opened the entire line of PIC 8-bit MCUs to me, and I could have full control over their functions. I bit & bought. Though it might not seem like such a leap, it took me several months of playing with PBP to get comfortable enough to start using it in my projects. After awhile, I forgot the idiosynchrocies of PICAXE (would have to relearn again).

    As for MPLABX, I had been using ASM in many PBP3 projects, so I created a simple ASM project in MPLABX. Once I learned the nuts & bolts of the IDE, I bought a couple books and started learning how to get the job done in XC8. I still only know a fraction of the capabilities of the C programming language, but at least I'm functional. I probably do many things the hard way.

    It boiled down to "What is important to me?" "What price am I willing to pay to get what I want (need)?" Then make it happen!

  9. #9
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,964

    Default Re: IOC on the 27k40

    Very nice!

    Recently I was testing the 16F19176 chip. It has almost all of what you referred except NCO and is also supported by PBP.

    I tried many times to take the leap to C but things stopped me(urgent projects, little time etc).

    Maybe one day...

    Ioannis

Similar Threads

  1. IOC on a ACD pin ?
    By longpole001 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th August 2013, 01:11
  2. Unorthodox use of IOC Port.B
    By mtripoli in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 2nd April 2013, 21:06
  3. A Simple IOC Routine (Interrupt On Change)
    By lugo.p in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th March 2010, 19:53
  4. IOC question
    By Adrian in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st April 2008, 19:21

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts