Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Timer interrupt to achieve trip timing

Status
Not open for further replies.

ajit_nayak87

Member level 5
Member level 5
Joined
Oct 30, 2017
Messages
86
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Activity points
981
Dear all ,
I am using PIC16F1938.I have used Mplabv 8.86 for coding with hitech compiler v9.86.
I need simple favor implementing this code in timer interrupt.
I have excel sheet attached for reference.
I have overload trip of motor setting 30A with Trip Time 30S. i would like to achieve attached curve using timer interrupt. can someone guide me how it can be implemented.
user can change overloadtrip and timing accordingly.

curve is meant to achieve below function
Lower current higher trip time and higher current lower trip time
 

Attachments

  • TIMING.pdf
    17.9 KB · Views: 115

Do you want c code or algorithm ?

What is your Fosc ?

Create a 500ms Timer 1 interrupt if you are using 4 MHz Fosc.
Use a counter variable in timer ISR and increment it once on each interrupt.

If it is 2 then time spent is 1 sec.

So, convert your current (adc value) to required timer trip delay like;

tripDelayCount = -2.000*I + 62.00

I = 1A

tripDelayCount = 60

I = 30A

tripDelayCount = -60 + 62 = 2

So in timer ISR you do like this;

Code:
void timerISR() {
   If((TMR1IE_bit) && (TMR1IF_bit)) {
        TMR1IF_bit = 0;
        //Reload TMR1H and TMR1L

       if(++tripDelayCounter >= tripDelayCount) {
              tripDelayCounter = 0;
              //trip the load
      }
   }
}
 
Last edited:

Hi,

Some thoughts:

Motor is: DC, BLDC, AC 1 phase, 3 phase or anything else?

***

* RMS_current represents the heating in the winding, in either case.
* Usually with motors one takes I^2t overcurrent limiting algorithm.
--> this means if you do it this way you don´t need to take the square root of the current. (which makes processing more fast and easy)

Klaus
 

implement an timer for 1 sec using timer
then apply algorithm for trip delay

***
trip delay= 31 - ADC processed o/p
if,trip delay =31 (i.e ADC o/p is 0)
loop up timer for trip delay times to achieve trip delay time


(this logic will only work for ADC o/p ranging from 1-30)
***
make sure that necessary condition should be provided for ADC range beyond specified
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top