High priority/low priority program parts


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: High priority/low priority program parts

    Hello Henrik,
    thank you for your suggestion
    here:

    '************************************************* ***************
    '* Name : PUMP16F88V1 *
    '* Test with 20-23 °C RB0 = HPWM out *
    '* Author : M.David *
    '* Notice : Copyright (c) 2018 *
    '* : All Rights Reserved *
    '* Date : 01.01.2018 *
    '* Version : AB sensor M12x1,5 *
    '* Notes : 16F88 kein LCD funktioniert halbwegs *
    '* : PORTA.0 analog IN 0-2V channel 0 *
    '* PORTB.1 Fan out PPORTB.0 Water pump out *
    '************************************************* ***************

    #CONFIG
    __config _CONFIG1,_EXTCLK & _WDT_ON & _LVP_OFF & _CP_OFF
    #ENDCONFIG
    Define OSC 20
    TRISB = %00000000

    Define ADC_BITS 8 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uSec
    DEFINE DEBUG_REG PORTB
    DEFINE DEBUG_BIT 2
    DEFINE DEBUG_BAUD 19200
    DEFINE DEBUG_MODE 0
    DEFINE DEBUG_PACING 500

    define CCP1_REG PORTB 'für HPWM
    DEFINE CCP1_bit 0 'HPWM port B.0


    TRISA = %11111111 ' Set PORTA to all input
    ADCON1 = %00000010 ' Set PORTA analo
    CMCON = 7 ' Disable analog comparator
    ANSEL = %00000001 ' set AN0 (RA0) as analog, others to digital




    FAN VAR PORTB.1
    Uin VAR Word
    Temp Var word
    speed var word
    Pump var word
    RX var word
    RS var word
    B0 var word

    Speed = 0
    FAN = 0
    pause 1000
    DEBUG 10,13

    main:

    ADCIN 0,Uin ' Read channel 0 (RA)

    DEBUG "*.*",DEC3 RX,dec3 RS,dec1 FAN,13,10 ' dec3 is important
    DEBUG 10,13
    HPWM 1,speed,2442

    IF Uin => 64 then
    B0 = Uin/2
    Temp = 100-B0
    else
    Temp = 131 - Uin
    endif
    TEMP = Temp-5 ;Korrekturfaktor nach Kalibrierung Anzeige ok bei 75-90°C


    RX = TEMP
    RS = pump


    Select Case temp
    Case is < 67
    speed = 0
    pump = 0
    case 68, 69, 70, 71, 72
    speed = 8
    pump = 3
    case 73, 74
    speed = 16
    pump = 6
    case 75, 76
    speed = 32
    pump = 12
    case 77, 78
    speed = 64
    pump = 25
    case 79, 80
    speed = 124
    pump = 50
    case 81,82
    pump = 75
    Speed = 191
    case is > 80
    speed = 255
    pump = 100
    End Select

    IF (Temp <= 84 ) then
    FAN = 0
    else
    FAN = 1
    endif

    goto main

    END ' End of program

  2. #2
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: High priority/low priority program parts

    Here three pics of that housing and so on:Name:  Pumpcontroller1.png
Views: 1254
Size:  735.0 KBName:  Pumpcontroller2.png
Views: 1235
Size:  700.4 KBName:  Pumpcontroller3.png
Views: 1254
Size:  762.8 KB

  3. #3
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: High priority/low priority program parts

    Mugelpower, I would also like to help so, if you could please explain the whole project overview. Contact me directly via, [email protected] or private email to this site. I have designed N.O.S. controllers for Bracket racers and timing equipment for National Drag Boat Association here in the US. I'm getting ready to retire from current job and need something to do with my spare time...... Been working with PBP for 20+ years.... BTW, I like the Billet housing...
    Dave Purola,
    N8NTA
    EN82fn

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: High priority/low priority program parts

    If that's the complete code for the '88 it does not seem to be the culprit after all....

    The message being sent is 12 bytes, that's 6.35ms @19200 baud, then you have 500us pacing so that's Another 5.5ms for a total of around 12ms. There's nothing else in there that should be taking any considerable amount of time.

    Do you have a scope? Can you verify the speed at which the '88 is actually sending messages? It looks like it should be in region of 80Hz...

    /Henrik.

  5. #5
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: High priority/low priority program parts

    Hello Henrik,
    i used a scope and found out that the 16F88 program runs with about 60Hz.
    So the 18F1320 doesn´t have to wait too long.
    The 18F1320 program runs much slower. If I count only 50ms it runs 16Hz. with 100ms it runs 8Hz thats too slow.
    50ms count is too short to count while cranking.
    So i set it up to 75ms.
    The 18F1320 program now runs at 11 Hz. So I call it a day.
    I guess the LCD routines gobble up much time.
    I put in some IF-THEN commands that showed hardly any effect in slowing down.
    I´ll try modifiing "DEFINE LCD_COMMANDUS 1500 "
    maybe that can speed things up a little bit.

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: High priority/low priority program parts

    So, now you're saying it does - sort of - work? No more 300ms delays?

    Regarding the LCD: You can try tweaking the default 1500us setting but it's highly dependant on the specific LCD module you're using.
    I suspect most of what's on the LCD is static text. If that's true you might gain a fair bit of time (and a much better appearance on the LCD) by just updating the part of the LCD that's actually changing.

  7. #7
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116


    Did you find this post helpful? Yes | No

    Wink Re: High priority/low priority program parts

    Hello Henrik,
    I set the baud rate to 38400, that helped a bit.
    Then tried set the LCD_COMMANDUS to 1500 that gained hardly anything but made the LCD a bit unreliable.
    The count time is down to 75, 50 is loo little, i get no signal when cranking,100 slows the routine cycle down to 8Hz.
    Now I got the frequency of a complete routine up to 11.5 Hz.
    I guess that should do.
    Now I´m back into hardware, soldering and juggling tools, after that testing with real electric motors.
    Noise suppression is a real challenge in car electric.

    I appreciate your help and the help of all of you folks.

Similar Threads

  1. DT lOW PRIORITY INTERRUPTS - ASM WARNING
    By longpole001 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th September 2014, 01:56
  2. Programme Flow Priority ?
    By gunayburak in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 10th August 2014, 00:20
  3. Replies: 4
    Last Post: - 24th January 2014, 20:38
  4. Priority interrupt?
    By Qacer in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 6th October 2006, 17:47
  5. Can you give varied levels of priority to blocks of code?
    By Archangel in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th August 2006, 02:58

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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