Help for Fatigue testing controller


Today 18:49
Forum: Proton Plus Compiler v3
Starter: Valter
Views: 0
Replies: 10
Today 10:55
Forum: The Lounge
Starter: shantanu@india
Views: 0
Replies: 21
+ Reply to Thread
Results 1 to 4 of 4

Thread: Help for Fatigue testing controller8 days old

  1. #1
    Junior Member amod's Avatar
    Join Date
    Mar 2018
    Posts
    72
    Thumbs Up
    Received: 76
    Given: 4
    Total Downloaded
    5.95 MB

    0 Not allowed!

    Default Help for Fatigue testing controller

    Iam making LCD based fatigue test controller.In My program My UP & UD does not work when i set it to Word and lcd hangs.I have problem in Frequency and RPM Routine which is based on counter pulse.

    my Program

    '************************************************* ***************
    '* Name : UNTITLED.BAS *
    '* Author : [select VIEW...EDITOR OPTIONS] *
    '* Notice : Copyright (c) 2018 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 6/29/2018 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************
    Device = 16F877A
    Xtal = 16
    Include "MODEDEFS.BAS"
    All_Digital = True
    Declare LCD_DTPin = PORTB.4
    Declare LCD_RSPin = PORTB.2
    Declare LCD_ENPin = PORTB.3
    Declare LCD_Interface = 4
    Declare LCD_Lines = 4
    Declare LCD_Type = 0




    Symbol SOL = PORTB.1
    Symbol TARE = PORTD.3
    Symbol ADDO = PORTD.1
    Symbol ADSK = PORTD.0


    Dim onn As Word
    Dim offf As Word
    Dim telbit As Byte
    Dim teller As Float
    Dim n As Float
    Dim adjval As Word
    Dim countr As Float
    Dim countrr As Float
    Dim disval As Float
    Dim i As Byte
    Dim COUN As Dword
    Dim gram As Float


    TRISA=1
    TRISC=%11111111
    TRISB=%00111111
    TRISD=%11111110
    TRISE=0


    offf=0
    onn=0
    teller=0


    Main:






    ADDO=1 'hx711 logic
    ADSK=0
    COUN=0
    While ADDO=1:Wend
    For i= 0 To 23
    ADSK=1
    COUN=COUN<<1
    ADSK=0
    If ADDO =1 Then Inc COUN
    Next i
    ADSK=1
    COUN=COUN^0x800000
    gram=8388608-COUN
    gram=gram/100

    If TARE=0 Then 'tare routine
    adjval=gram
    EndIf
    disval=gram-adjval
    ADSK=0





    If PORTC.5=1 Then 'counter
    If telbit=0 Then
    Inc teller
    EndIf
    telbit=1
    Else
    telbit=0
    EndIf






    DelayMS offf 'relay logic for off
    High PORTB.1
    DelayMS onn 'relay logic for on
    Low PORTB.1

    If PORTD.4=1 Then offf=ERead 00
    If PORTD.4=1 Then Inc offf
    If PORTD.4=0 Then EWrite 00,[offf] 'off timer for relay

    If PORTD.5=1 Then offf=ERead 00
    If PORTD.5=1 Then offf=offf-1
    If PORTD.5=0 Then EWrite 00,[offf]



    If PORTD.6=1 Then onn=ERead 04
    If PORTD.6=1 Then Inc onn
    If PORTD.6=0 Then EWrite 04,[onn] 'onn timer for relay

    If PORTD.7=1 Then onn=ERead 04
    If PORTD.7=1 Then onn=onn-1
    If PORTD.7=0 Then EWrite 04,[onn]




    Print At 2,1,"FREQ=",Dec0 n," "
    Print At 1,1,"LOAD=",Dec1 disval," "
    Print At 3,1,"COUNTER=",Dec0 teller," "
    Print At 4,1,"UP=",Dec0 offf," "
    Print At 4,12,"UD=",Dec0 onn," "
    GoTo Main




    please help me.IMG_20190312_204409.jpg

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,278
    Thumbs Up
    Received: 77
    Given: 39
    Total Downloaded
    3.21 GB

    0 Not allowed!

    Default Re: Help for Fatigue testing controller

    I have a feeling that DELAYMS with a value of zero specified will wait forever.
    I think you code might do this.

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Junior Member amod's Avatar
    Join Date
    Mar 2018
    Posts
    72
    Thumbs Up
    Received: 76
    Given: 4
    Total Downloaded
    5.95 MB

    0 Not allowed!

    Default Re: Help for Fatigue testing controller

    How can I convert my counter to rpm and frequency and how to make peak hold in load values.in load iam using load cell.

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Senior Member Stephen Moss's Avatar
    Join Date
    Jan 2006
    Posts
    429
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    2.33 GB

    0 Not allowed!

    Default Re: Help for Fatigue testing controller

    For UP and UD have you tried try replacing DEC0 with DEC, as those are word values and not floating point.
    By specifying the number of digits to display after the decimal point you may be tripping up the compiler up as I presume it would then be expecting to receive a floating point value to work with and you are not giving it one.

    I did not fully understand your code and I am sure there are many ways to convert a count to RPM/Frequency but I would think the simplest and best would be to use a timer interrupt...

    Setup your timer to interrupt at an appropriate time, i.e 1 minute, 100mS, 1mS, when the timer interrupts
    Code:
    'Timer Interrupt Psuedo code
    Get count
    Adjust count to give RPM, i.e. assuming 1 count = 1 revolution then 10 counts in 100ms = 6000 counts in 1 minute = 6000RPM
    Adjust count to give frequency, assuming same count value is being used and that both the duration of and interval between input pulses is constant then...
    1 count = 10mS (100mS/10) thus Frequency = 1/0.01 or (1/1e-3) = 100Hz
    
    Clear count
    reset timer
    Exit Interrupt
    You appear to be using a direct read of a port pin in your main code flow to get your counts (If PortC.5=1), if that is correct it may not be a very good or accurate way of doing it because if it is high for along time compared to the code execution you may be reading the same input pulse multiple times, equally if it is fast compared to execution time (Print routine uses a lot of instructions and so take a while to execute) you may miss some counts.

    Consequently, I think a better way of counting your input pulses may be to use a port pin with interrupt on change (IOC) or use your input pulse as the external clock source for one of the PIC's timers, it should be more accurate as you are less likely to count the same pulse twice or miss a pulse. Personally, I would go with the timer where possible as it can tick along on its own (until you reset it) without interrupting main code flow unlike the IOC which jumps off to an interrupt handler.

    Opps..
    forgot the peak hold. Simple create a variable, copy the first value into it, then compare it to subsequent values, if the subsequent value is higher then replace it, if not retain it. You can either keep it as an on going value or reset set it every 10, 100, 1000 reads as necessary.
    Last edited by Stephen Moss; 15th March 2019 at 11:03.

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Testing Bits of a register.
    By pic-ignorant in forum The Lounge
    Replies: 2
    Last Post: 16th May 2017, 17:36
  2. Any in the mood to do some beta-testing?
    By hadv215 in forum hadv215's Feedback Forum
    Replies: 0
    Last Post: 14th December 2016, 13:50
  3. CE Marking / Mains Testing
    By rpm26 in forum The Lounge
    Replies: 4
    Last Post: 9th February 2013, 17:45
  4. Debugging/Testing/Emulating
    By t0pP8uZz in forum Proton Plus Compiler v3
    Replies: 6
    Last Post: 5th November 2009, 21:23
  5. PCB Trace Testing
    By ohararp in forum The Lounge
    Replies: 1
    Last Post: 20th November 2007, 19:04

Posting Permissions

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