Problem in Tension/compression


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Just posting this for an email notification that I changed the program above.

    In case you're already trying it.
    <br>
    DT

  2. #2
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Just posting this for an email notification that I changed the program above.

    In case you're already trying it.
    <br>
    Sir Darrel Taylor
    Thanks
    Peak-hold now working well for both side.
    But my problem is , i want to counting down side 0 to 1 ,2 , 3 ......... ( not 65535, 65534 , 65533 .......)


    .

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    You might want to just try the whole program I posted, instead of making the changes to yours. Because I think you've missed something.

    With the SDEC modifier in the lcdout statements, it will read -1, -2, -3 etc. And will never show 65535.

    There are several other subtle changes too.
    <DT>
    DT

  4. #4
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89


    Did you find this post helpful? Yes | No

    Default

    Thanks it is work on lcd.
    but on 7 seg. LED display , it is not work in +/- ,
    this is my code

    Code:
    ; CHIP 18F4550
    
    DEFINE OSC 20
    INCLUDE "MODEDEFS.BAS"
    CMCON = 7
    ADCON1 = 15
    CVRCON = %00000000 'CVref turned off
    
    TRISE = %000 
    TRISA = 11111
    TRISB = %11111111
    TRISC = %11111111
    TRISD = %11111111
    
    
    Symbol HC_latch = PORTE.2   
    symbol HC_Data = PORTE.1   
    SYMBOL HC_Clk = PORTE.0   
    
    B1 VAR BYTE
    B2 VAR BYTE                         
    B3 VAR BYTE
    B4 VAR BYTE
    B5 VAR BYTE
    B6 VAR WORD
    
    W0 VAR WORD
    w3 var word
    DUMMY VAR WORD
    
    DIGIT1 VAR BYTE
    DIGIT2 VAR BYTE
    DIGIT3 VAR BYTE
    DIGIT4 VAR BYTE
    DIGIT5 VAR BYTE
    DIGIT6 VAR BYTE
    
    W1 VAR WORD
    MASK VAR WORD
     
    LastW0 VAR WORD
    
    B1 = 0
    B2 = 0
    B3 = 0
    B4 = 0
    B5 = 0
    W1 = 0
    W0 = 0
    w3 = 0
    E1 VAR BYTE
    E2 VAR BYTE
    E3 VAR BYTE
    E4 VAR BYTE
    E5 VAR BYTE
    
    PAUSE 500                           
    '-------------------------------------------------------------------------
    INCLUDE "DT_INTS-18.bas"     ; Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas"     ; Include if using PBP interrupts
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    INT0_INT,  _ToggleLED1,   PBP,  yes                
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE   INT0_INT     ; enable external (INT) interrupts@   INT_ENABLE   INT1_INT     ; enable external (INT) interrupts
    
    '-------------------------------------------------------------------------
    
    
    LOOP:   
             IF W0 <> LastW0 then
             LastW0 = W0                  
             if ABS(LastW0) > ABS(w3) then w3 = LastW0
    
              
            B1 = LastW0 DIG 0    
            B2 = LastW0 DIG 1
            B3 = LastW0 DIG 2
            B4 = LastW0 DIG 3
            B5 = LastW0 DIG 4
      
      
            '------------------------------------------        
              DIGIT1 = B1 
            LOOKUP DIGIT1,[$C0,$F9,$A4,$B0,$99,$92,$82,$F8,$80,$90],MASK        
            E1 = MASK
            '------------------------------------------
            DIGIT2 = B2 
            LOOKUP DIGIT2,[$C0,$F9,$A4,$B0,$99,$92,$82,$F8,$80,$90],MASK        
            E2 = MASK       
            '-------------------------------------------
             DIGIT3 = B3 
            LOOKUP DIGIT3,[$C0,$F9,$A4,$B0,$99,$92,$82,$F8,$80,$90],MASK        
            E3 = MASK     
            '----------------------------------------
             DIGIT4 = B4 
            LOOKUP DIGIT4,[$C0,$F9,$A4,$B0,$99,$92,$82,$F8,$80,$90],MASK        
            E4 = MASK
            '---------------------------------------
            DIGIT5 = B5 
            LOOKUP DIGIT5,[$C0,$F9,$A4,$B0,$99,$92,$82,$F8,$80,$90],MASK        
            E5 = MASK 
            '---------------------------------------
            
             HC_Latch=0
            shiftout HC_data, HC_Clk, MSBFIRST,[E1,E2,E3,E4,E5,$C0]        
            pauseus 1
            HC_Latch=1
                    
            '---------------------------------------
            endif   
             GOTO LOOP
             
    ToggleLED1: if PORTB.1 = 0 THEN
                  W0 = W0 + 1
                   ELSE 
                  W0 = W0 - 1
                 ENDIF
            @ INT_RETURN

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Oi vey!
    Where'd the 7-segment come from?

    Oh well.
    Code:
            B1 = ABS(LastW0) DIG 0    
            B2 = ABS(LastW0) DIG 1
            B3 = ABS(LastW0) DIG 2
            B4 = ABS(LastW0) DIG 3
            B5 = ABS(LastW0) DIG 4
    - or -

    Code:
            W4 = ABS(LastW0)
            B1 = W4 DIG 0    
            B2 = W4 DIG 1
            B3 = W4 DIG 2
            B4 = W4 DIG 3
            B5 = W4 DIG 4
    <br>
    DT

  6. #6
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89


    Did you find this post helpful? Yes | No

    Default

    Oh..Thanks Sir Darrel Taylor.

    working fine now. but how i show "-" sign for tension measurements.

    One thing more , just for information.

    my encoder is 1000 PPR
    CHIP 18F4550
    XTAL mount 20 mhz
    Code:
    __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H
    DEFINE OSC 20
    I lose the count in > 5 RPM with above code.

    And if mount XTAL 20 mhz
    and if i code
    Code:
    __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H
    DEFINE OSC 3
    this is work up to 20 RPM. No counts lose.
    Is DEFINE OSC 3 will increase the speed of PIC ?

    .

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    18F4550
    20Mhz crystal (22pF caps)

    Use ...
    Code:
    @   __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    @   __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H
    DEFINE OSC 48
    <br>
    DT

Similar Threads

  1. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  2. Microcode Studio 18f2455 problem?????
    By volkan in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 21st May 2007, 21:04
  3. Hardware problem or what ?
    By Steve S. in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 4th March 2007, 21:39
  4. 1 slave 1 master 1 MAX232 1 problem ?
    By SuB-ZeRo in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 31st July 2005, 22:59
  5. PORTA.PinNo = 1 ' problem
    By frank small in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 6th May 2004, 14:30

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